text:
<?php

namespace spec\Nanbando\Console\Command;

use Nanbando\Backup\BackupArchiveFactory;
use Nanbando\Backup\BackupArchiveInterface;
use Nanbando\Backup\BackupRunner;
use Nanbando\Console\Command\DifferentialBackupCommand;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DifferentialBackupCommandSpec extends ObjectBehavior
{
    public function let(
        BackupRunner $backupRunner,
        BackupArchiveFactory $factory,
        InputInterface $input
    ) {
        $this->beConstructedWith($backupRunner, $factory);

        $input->bind(Argument::cetera())->willReturn(null);
        $input->isInteractive()->willReturn(null);
        $input->hasArgument(Argument::cetera())->willReturn(null);
        $input->validate()->willReturn(null);
    }

    public function it_is_initializable()
    {
        $this->shouldHaveType(DifferentialBackupCommand::class);
    }

    public function it_extends_symfony_command()
    {
        $this->shouldBeAnInstanceOf(Command::class);
    }

    public function it_should_run_backup(
        BackupArchiveFactory $factory,
        InputInterface $input,
        OutputInterface $output,
        BackupRunner $backupRunner,
        BackupArchiveInterface $backupArchive
    ) {
        $factory->createDifferential('20180422-114300')->willReturn($backupArchive);

        $input->getArgument('parent')->willReturn('20180422-114300');
        $input->getArgument('label')->willReturn(null);
        $input->getOption('message')->willReturn(null);

        $backupArchive->set('label', null)->shouldBeCalled();
        $backupArchive->set('message', null)->shouldBeCalled();

        $backupRunner->run($backupArchive)->shouldBeCalled()->willReturn($backupArchive);

        $this->run($input, $output);
    }

    public function it_should_run_backup_should_pass_tag(
        BackupArchiveFactory $factory,
        InputInterface $input,
        OutputInterface $output,
        BackupRunner $backupRunner,
        BackupArchiveInterface $backupArchive
    ) {
        $factory->createDifferential('20180422-114300')->willReturn($backupArchive);

        $input->getArgument('parent')->willReturn('20180422-114300');
        $input->getArgument('label')->willReturn('testlabel');
        $input->getOption('message')->willReturn(null);

        $backupArchive->set('label', 'testlabel')->shouldBeCalled();
        $backupArchive->set('message', null)->shouldBeCalled();

        $backupRunner->run($backupArchive)->shouldBeCalled()->willReturn($backupArchive);

        $this->run($input, $output);
    }

    public function it_should_run_backup_should_pass_message(
        BackupArchiveFactory $factory,
        InputInterface $input,
        OutputInterface $output,
        BackupRunner $backupRunner,
        BackupArchiveInterface $backupArchive
    ) {
        $factory->createDifferential('20180422-114300')->willReturn($backupArchive);

        $input->getArgument('parent')->willReturn('20180422-114300');
        $input->getArgument('label')->willReturn(null);
        $input->getOption('message')->willReturn('testmessage');

        $backupArchive->set('label', null)->shouldBeCalled();
        $backupArchive->set('message', 'testmessage')->shouldBeCalled();

        $backupRunner->run($backupArchive)->shouldBeCalled()->willReturn($backupArchive);

        $this->run($input, $output);
    }
}


text:
describe("API", function() {

    var actual = window;
    var expected = {Ext:{core:{Element: function(){} }}},
    Ext = expected.Ext;

    /* Element-more.js */ Ext.core.Element.prototype.clean = function clean(){};
    /* Element-more.js */ Ext.core.Element.prototype.createProxy = function createProxy(){};
    /* Element-more.js */ Ext.core.Element.prototype.getLoader = function getLoader(){};
    /* Element-more.js */ Ext.core.Element.prototype.monitorMouseLeave = function monitorMouseLeave(){};
    /* Element-more.js */ Ext.core.Element.prototype.relayEvent = function relayEvent(){};
    /* Element-more.js */ Ext.core.Element.prototype.swallowEvent = function swallowEvent(){};
    /* Element-more.js */ Ext.core.Element.prototype.load = function load(){};

    /* Element.alignment.js */ Ext.core.Element.prototype.getConstrainVector = function getConstrainVector(){};

    // /* Element.anim.js */ Ext.core.Element.prototype.fadeIn = function fadeIn(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.fadeOut = function fadeOut(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.frame = function frame(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.ghost = function ghost(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.highlight = function highlight(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.pause = function pause(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.puff = function puff(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.scale = function scale(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.shift = function shift(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.slideIn = function slideIn(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.slideOut = function slideOut(){};
    // /* Element.anim.js */ Ext.core.Element.prototype.switchOff = function switchOff(){};

    // /* Element.dd.js */ Ext.core.Element.prototype.initDD = function initDD(){};
    // /* Element.dd.js */ Ext.core.Element.prototype.initDDProxy = function initDDProxy(){};
    // /* Element.dd.js */ Ext.core.Element.prototype.initDDTarget = function initDDTarget(){};

    /* Element.fx-more.js */ Ext.core.Element.prototype.createShim = function createShim(){};
    /* Element.fx-more.js */ Ext.core.Element.prototype.enableDisplayMode = function enableDisplayMode(){};
    /* Element.fx-more.js */ Ext.core.Element.prototype.isDisplayed = function isDisplayed(){};
    /* Element.fx-more.js */ Ext.core.Element.prototype.isMasked = function isMasked(){};

    /* Element.fx.js */ Ext.core.Element.prototype.isVisible = function isVisible(){};
    /* Element.fx.js */ Ext.core.Element.prototype.originalDisplay = String();
    /* Element.fx.js */ Ext.core.Element.prototype.setDisplayed = function setDisplayed(){};
    /* Element.fx.js */ Ext.core.Element.prototype.setVisibilityMode = function setVisibilityMode(){};
    /* Element.fx.js */ Ext.core.Element.prototype.toggle = function toggle(){};
    /* Element.fx.js */ Ext.core.Element.visibilityCls = String();

    /* Element.insertion.js */ Ext.core.Element.prototype.appendChild = function appendChild(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.appendTo = function appendTo(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.createChild = function createChild(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.insertAfter = function insertAfter(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.insertBefore = function insertBefore(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.insertFirst = function insertFirst(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.insertHtml = function insertHtml(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.insertSibling = function insertSibling(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.replace = function replace(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.replaceWith = function replaceWith(){};
    /* Element.insertion.js */ Ext.core.Element.prototype.wrap = function wrap(){};

    /* Element.js */ Ext.core.Element.prototype.autoBoxAdjust = true;
    /* Element.js */ Ext.core.Element.prototype.blur = function blur(){};
    /* Element.js */ Ext.core.Element.prototype.clearListeners = function clearListeners(){};
    /* Element.js */ Ext.core.Element.prototype.destroy = function destroy(){};
    /* Element.js */ Ext.core.Element.prototype.focus = function focus(){};
    /* Element.js */ Ext.core.Element.prototype.getAttributeNS = function getAttributeNS(){};
    /* Element.js */ Ext.core.Element.prototype.hover = function hover(){};
    /* Element.js */ Ext.core.Element.prototype.isBorderBox = function isBorderBox(){};
    /* Element.js */ Ext.core.Element.prototype.on = function on(){};
    /* Element.js */ Ext.core.Element.prototype.un = function un(){};
    /* Element.js */ Ext.core.Element.prototype.update = function update(){};

    /* Element.keys.js */ Ext.core.Element.prototype.addKeyListener = function addKeyListener(){};
    /* Element.keys.js */ Ext.core.Element.prototype.addKeyMap = function addKeyMap(){};

    /* Element.position.js */ Ext.core.Element.prototype.clearPositioning = function clearPositioning(){};
    /* Element.position.js */ Ext.core.Element.prototype.getPositioning = function getPositioning(){};
    /* Element.position.js */ Ext.core.Element.prototype.getRegion = function getRegion(){};
    /* Element.position.js */ Ext.core.Element.prototype.getViewRegion = function getViewRegion(){};
    /* Element.position.js */ Ext.core.Element.prototype.move = function move(){};
    /* Element.position.js */ Ext.core.Element.prototype.moveTo = function moveTo(){};
    /* Element.position.js */ Ext.core.Element.prototype.position = function position(){};
    /* Element.position.js */ Ext.core.Element.prototype.setBounds = function setBounds(){};
    /* Element.position.js */ Ext.core.Element.prototype.setLeftTop = function setLeftTop(){};
    /* Element.position.js */ Ext.core.Element.prototype.setLocation = function setLocation(){};
    /* Element.position.js */ Ext.core.Element.prototype.setPositioning = function setPositioning(){};
    /* Element.position.js */ Ext.core.Element.prototype.setRegion = function setRegion(){};

    /* Element.scroll.js */ Ext.core.Element.prototype.getScroll = function getScroll(){};
    /* Element.scroll.js */ Ext.core.Element.prototype.isScrollable = function isScrollable(){};
    /* Element.scroll.js */ Ext.core.Element.prototype.scroll = function scroll(){};
    /* Element.scroll.js */ Ext.core.Element.prototype.scrollIntoView = function scrollIntoView(){};
    /* Element.scroll.js */ Ext.core.Element.prototype.scrollTo = function scrollTo(){};

    /* Element.static.js */ Ext.core.Element.fromPoint = function fromPoint(){};
    /* Element.static.js */ Ext.core.Element.getDocumentHeight = function getDocumentHeight(){};
    /* Element.static.js */ Ext.core.Element.getDocumentWidth = function getDocumentWidth(){};
    /* Element.static.js */ Ext.core.Element.getOrientation = function getOrientation(){};
    /* Element.static.js */ Ext.core.Element.getViewportHeight = function getViewportHeight(){};
    /* Element.static.js */ Ext.core.Element.getViewportWidth = function getViewportWidth(){};
    /* Element.static.js */ Ext.core.Element.normalize = function normalize(){};
    /* Element.static.js */ Ext.core.Element.parseBox = function parseBox(){};
    /* Element.static.js */ Ext.core.Element.parseStyles = function parseStyles(){};
    /* Element.static.js */ Ext.core.Element.unitizeBox = function unitizeBox(){};

    /* Element.style.js */ Ext.core.Element.prototype.addClsOnClick = function addClsOnClick(){};
    /* Element.style.js */ Ext.core.Element.prototype.addClsOnFocus = function addClsOnFocus(){};
    /* Element.style.js */ Ext.core.Element.prototype.addClsOnOver = function addClsOnOver(){};
    /* Element.style.js */ Ext.core.Element.prototype.boxWrap = function boxWrap(){};
    /* Element.style.js */ Ext.core.Element.prototype.clearOpacity = function clearOpacity(){};
    /* Element.style.js */ Ext.core.Element.prototype.clip = function clip(){};
    /* Element.style.js */ Ext.core.Element.prototype.getColor = function getColor(){};
    /* Element.style.js */ Ext.core.Element.prototype.getComputedHeight = function getComputedHeight(){};
    /* Element.style.js */ Ext.core.Element.prototype.getComputedWidth = function getComputedWidth(){};
    /* Element.style.js */ Ext.core.Element.prototype.getFrameWidth = function getFrameWidth(){};
    /* Element.style.js */ Ext.core.Element.prototype.getStyleSize = function getStyleSize(){};
    /* Element.style.js */ Ext.core.Element.prototype.getStyles = function getStyles(){};
    // /* Element.style.js */ Ext.core.Element.prototype.private = Object();
    /* Element.style.js */ Ext.core.Element.prototype.setOpacity = function setOpacity(){};
    /* Element.style.js */ Ext.core.Element.prototype.unclip = function unclip(){};
    /* Element.style.js */ Ext.core.Element.prototype.unselectable = function unselectable(){};

    /* Element.traversal.js */ Ext.core.Element.prototype.child = function child(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.down = function down(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.findParent = function findParent(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.findParentNode = function findParentNode(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.first = function first(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.last = function last(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.next = function next(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.parent = function parent(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.prev = function prev(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.query = function query(){};
    /* Element.traversal.js */ Ext.core.Element.prototype.up = function up(){};

    APITest({Ext:expected.Ext}, {Ext:actual.Ext});

});

redpajama_set_name: RedPajamaGithub


text:
package com.univocity.ddl;

/**
 * A {@link Database} implementation for MySQL (also works with MariaDB).
 *
 * @author uniVocity Software Pty Ltd - <a href="mailto:dev@univocity.com">dev@univocity.com
 *
 */
class MySqlDatabase extends Database {

	@Override
	public String getDatabaseName() {
		return "MySql";
	}

	@Override
	String getDriverClassName() {
		return "com.mysql.jdbc.Driver";
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using Lucene.Net.Store;
using Lucene.Net.Util;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;

namespace Indexer
{
    public class IntranetIndexer
    {
        private IndexWriter writer;
        private string docRootDirectory;
        private string pattern;

        /// <summary>
        /// Creates a new index in <c>directory</c>. Overwrites the existing index in that directory.
        /// </summary>
        /// <param name="directory">Path to index (will be created if not existing).</param>
        public IntranetIndexer(string directory)
        {
            writer = new IndexWriter(FSDirectory.Open(directory), new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30), true, IndexWriter.MaxFieldLength.LIMITED);
            //writer = new IndexWriter(FSDirectory.Open(directory), new Lucene.Net.Analysis.WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
            writer.UseCompoundFile = true;
        }
        public IntranetIndexer(string directory, bool create)
        {
            writer = new IndexWriter(FSDirectory.Open(directory), new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30), create, IndexWriter.MaxFieldLength.LIMITED);
            //writer = new IndexWriter(FSDirectory.Open(directory), new Lucene.Net.Analysis.WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
            writer.UseCompoundFile = true;
        }

        /// <summary>
        /// Add HTML files from <c>directory</c> and its subdirectories that match <c>pattern</c>.
        /// </summary>
        /// <param name="directory">Directory with the HTML files.</param>
        /// <param name="pattern">Search pattern, e.g. <c>"*.html"</c></param>
        public void AddDirectory(DirectoryInfo directory, string pattern)
        {
            try
            {
                this.docRootDirectory = directory.FullName;
                this.pattern = pattern;

                addSubDirectory(directory);
            }
            catch (Exception m)
            {
                MyException mobj = new MyException(m.Message);
            }
        }

        private void addSubDirectory(DirectoryInfo directory)
        {
            try
            {
                int i = 0;
                foreach (FileInfo fi in directory.GetFiles(pattern))
                {
                    // string[] ext = { ".dll", ".img", ".exe", ".zip", ".png", ".exe", ".jpeg", ".jpg", ".gif", ".config" };
                    //string[] Folders = { "Correspondence","KPERS" };
                    //if (!ext.Contains(fi.Extension))
                    //{

                    FileAttributes attributes = File.GetAttributes(fi.FullName);
                    if ((attributes & FileAttributes.Hidden) != FileAttributes.Hidden || fi.Length < 209715200)
                    {
                        AddHtmlDocument(fi.FullName, fi.Name, fi.Extension);
                    }
                    else
                    {
                        AddHtmlDocument(fi.FullName, fi.Name, fi.Extension, true);
                    }
                    i++;
                    if (i == 100)
                    {
                        i = 0;
                        Console.WriteLine(fi.FullName);
                    }
                }
            }
            catch (Exception m)
            {
                writer.Dispose();
                writer = new IndexWriter(FSDirectory.Open(directory), new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30), false, IndexWriter.MaxFieldLength.LIMITED);

                MyException mobj = new MyException(m.Message);
            }
            foreach (DirectoryInfo di in directory.GetDirectories())
            {
                addSubDirectory(di);
            }
        }

        /// <summary>
        /// Loads, parses and indexes an HTML file.
        /// </summary>
        /// <param name="path"></param>
        public void AddHtmlDocument(string path, string FileName, string Extension, bool skipFile = false)
        {
            try
            {
                Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
                doc.GetField("Name");
                string html = "";
                string[] Image_ext = { ".img", "png", ".jpeg", ".jpg", ".gif" };
                string[] Other_ext = { ".vsd", ".rpt" };

                if (Extension == ".docx" || Extension == ".doc")
                {
                    WordParcer wordParcer = new WordParcer();
                    html = wordParcer.ExtractTextWordOpenXML(path);
                }
                else if (Extension == ".xlsx" || Extension == ".xls")
                {
                    XSLSParser xslxParser = new XSLSParser();
                    html = xslxParser.ExtractText(path);
                }
                else if (Extension == ".pdf")
                {
                    PDFParser pdfParser = new PDFParser();
                    html = pdfParser.ExtractText(path);
                }
                else if (Extension == ".ppt" || Extension == ".pptx")
                {
                    WordParcer wordParcer = new WordParcer();
                    html = wordParcer.ExtractTextPptOpenXML(path);
                }
                else if (Image_ext.Contains(Extension))
                {
                    html = "";
                }
                else if (Other_ext.Contains(Extension))
                {
                    html = "NULL";
                }
                else if (skipFile)
                {
                    html = "NULL";
                }
                else
                {
                    string[] FilesTypes = { "audio", "video", "image", "octet-stream", "zip", "x-rar-compressed", "xml", "x-shockwave-flash", "x-cabinet", "x-pdb" };
                    int co = Mime.MIMETypesDictionary.Where(obj => "." + obj.Key == Extension.ToLower() && Mime.MatchLikeWord(FilesTypes, obj.Value)).Count();
                    if (co == 0)
                    {
                        using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default))
                        {
                            html = sr.ReadToEnd();
                        }
                    }
                    else
                    {
                        html = "NULL";
                    }

                }
                if (html != null)
                {
                    int relativePathStartsAt = this.docRootDirectory.EndsWith("\\") ? this.docRootDirectory.Length : this.docRootDirectory.Length + 1;
                    string relativePath = path.Substring(relativePathStartsAt);
                    if (Extension == ".html")
                    {
                        doc.Add(new Field("text", ParseHtml(html), Field.Store.YES, Field.Index.ANALYZED));
                    }
                    else if (Extension == ".xml")
                    {

                        doc.Add(new Field("text", ParseXML(html), Field.Store.YES, Field.Index.ANALYZED));
                    }
                    else
                    {
                        doc.Add(new Field("text", (html), Field.Store.YES, Field.Index.ANALYZED));
                    }

                    doc.Add(new Field("path", path, Field.Store.YES, Field.Index.NOT_ANALYZED));
                    doc.Add(new Field("title", FileName.Replace(Extension, ""), Field.Store.YES, Field.Index.ANALYZED));
                    doc.Add(new Field("Extension", Extension, Field.Store.YES, Field.Index.ANALYZED));

                    IEnumerable<string> subwords = path.Split('\\').Where(x => x.Length > 0).Select(x => x.Trim());
                    int index = 2;//index is the index location of the project name in the path-2 in order to get name of each individual support project
                    string word = subwords.ElementAt<string>(index);
                    if (!word.Equals(null))
                        doc.Add(new Field("Project", word, Field.Store.YES, Field.Index.NOT_ANALYZED));

                    if (Extension == ".docx" || Extension == ".doc" || Extension == ".pdf")
                    {
                        doc.Add(new Field("EXTPRP", "Doc", Field.Store.YES, Field.Index.NOT_ANALYZED));
                    }
                    else if (Extension == ".txt" || Extension == ".cs" || Extension == ".xml" || Extension == ".css" || Extension == ".aspx" || Extension == ".htm" || Extension == ".js")
                    {
                        doc.Add(new Field("EXTPRP", "Code", Field.Store.YES, Field.Index.NOT_ANALYZED));
                    }
                    else if (Extension == ".png" || Extension == ".jpg" || Extension == ".jpeg" || Extension == ".bmp" || Extension == ".gif")
                    {
                        doc.Add(new Field("EXTPRP", "Images", Field.Store.YES, Field.Index.NOT_ANALYZED));
                    }
                    else
                    {
                        doc.Add(new Field("EXTPRP", "Other", Field.Store.YES, Field.Index.NOT_ANALYZED));
                    }
                   // Console.WriteLine(FileName);
                    writer.AddDocument(doc);

                }
            }
            catch (Exception m)
            {
                MyException mobj = new MyException(m.Message);
            }
        }

        /// <summary>
        /// Very simple, inefficient, and memory consuming HTML parser.
        /// </summary>
        /// <param name="html">HTML document</param>
        /// <returns>Plain text.</returns>
        private static string ParseHtml(string html)
        {
            string temp = Regex.Replace(html, "<[^>]*>", "");
            return temp.Replace(" ", " ");
        }
        private static string ParseXML(string html)
        {
            string temp = Regex.Replace(html, "\"", "");
            return temp.Replace(" ", " ");
        }
        /// <summary>
        /// Finds a title of HTML file. Doesn't work if the title spans two or more lines.
        /// </summary>
        /// <param name="html">HTML document.</param>
        /// <returns>Title string.</returns>
        private static string GetTitle(string html)
        {
            Match m = Regex.Match(html, "<title>(.*)</title>");
            if (m.Groups.Count == 2)
                return m.Groups[1].Value;
            return "(unknown)";
        }

        /// <summary>
        /// Optimizes and save the index.
        /// </summary>
        public void Close()
        {
            try
            {
                writer.Optimize();
                writer.Dispose();
            }
            catch(Exception m)
            {
                MyException mobj = new MyException(m.Message);
            }
        }
    }
}


text:
(function() {
	var all = document.getElementsByTagName('*');
	var thisTag = all[all.length - 1];
	var magic = document.createElement('div');
	magic.appendChild(document.createTextNode('(test3.js running)'));
	thisTag.parentNode.insertBefore(magic, thisTag);
	magic.style.fontSize = '10px';
})();


text:
<resources>
    <string name="app_name">TinkerDemo</string>
</resources>


text:
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";

$customer = Balanced\Customer::get("/customers/CU3SSJgvA5Z69kt05MusbPeE");
$cusotmer->email = 'email@newdomain.com';
$customer->meta = array(
    "shipping-preference" => "ground",
);
$customer->save();

?>


text:
#nullable disable
using PasPasPas.Globals.Types;

namespace PasPasPas.Runtime.Values.Other {

    /// <summary>
    ///     operator result
    /// </summary>
    internal class OperatorInvocationResult1 : Signature1, IOperatorInvocationResult {

        /// <summary>
        ///     create a new operator invocation result
        /// </summary>
        /// <param name="kind"></param>
        /// <param name="returnType"></param>
        /// <param name="parameter"></param>
        public OperatorInvocationResult1(OperatorKind kind, ITypeSymbol returnType, ITypeSymbol parameter) : base(returnType, parameter)
            => Kind = kind;

        /// <summary>
        ///     operator kind
        /// </summary>
        public OperatorKind Kind { get; }

        /// <summary>
        ///     type definition
        /// </summary>
        public ITypeDefinition TypeDefinition
            => ReturnType.TypeDefinition;

        /// <summary>
        ///     operator result
        /// </summary>
        public SymbolTypeKind SymbolKind
            => SymbolTypeKind.OperatorResult;
    }
}


text:
int main(int argc, char const* argv[])
{
   std::string line;
   std::ifstream file(argv[1]);
   while(getline(file, line))
   {
       if(!line.empty())
       {
           std::stringstream stream(line);
           std::string buffer;
           getline(stream, buffer, ';');
           std::set<int> numbers;
           while(getline(stream, buffer, ','))
           {
               bool inserted = numbers.insert(std::stoi(buffer)).second;
               if (!inserted)
               {
                   std::cout << buffer << std::endl;
                   break;
               }
           }

       }
   }
   return 0;
}


text:
<form action="http://poweredsites.org/search" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="partner-pub-7813579351223443:n0cpxcrbxn3" />
    <input type="hidden" name="cof" value="FORID:10" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="22" />
    <input type="submit" name="sa" value="GO" />
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>


text:
"""Container for all required classes."""

# __init__.py
#
# Created by Thomas Nelson <tn90ca@gmail.com>
# Created..........................2015-01-25
# Modified.........................2015-01-25
#
# This module was developed for use in the Bugs project.
#
# Copyright (C) 2015 Thomas Nelson

__all__ = ["dna", "brain", "bug", "food", "world"]


text:
@interface ViewController ()
@property (assign) NSMutableDictionary *zombie;
@end

#define POLY_COUNT (100 * 10000)

@implementation ViewController

- (IBAction) startPolyLazy:(id) sender
{
    double result = 0.0;
    for (NSUInteger i = 0; i < POLY_COUNT; i++) {
        for (double x = -8.0; x <= 8.0; x += 2.0) {
            result += PolyLazy(x);
        }
    }
    NSLog(@"%.2f", result);
}

- (void) setZombieName:(NSString *)name
{
    [self.zombie setObject:name forKey:@"name"];
}

#if 1
- (IBAction) zombie:(id) sender
{
    @autoreleasepool {
        self.zombie = [NSMutableDictionary dictionary];
    }
    [self setZombieName:@"Z"];
}
#else
- (IBAction) zombie:(id) sender
{
    self.zombie = [NSMutableDictionary dictionary];
    [self performSelector:@selector (setZombieName:) withObject:@"Z" afterDelay:0.0];
}
#endif

#if 0
- (IBAction) spike:(id) sender
{
    double start = CFAbsoluteTimeGetCurrent();

    @autoreleasepool {
        NSError *error = nil;
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Big" ofType:@"tsv"];
        NSString *fileContent = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&error];

        NSArray *lines = [fileContent componentsSeparatedByString:@"\r"];
        NSLog(@"-- lines count: %@", @([lines count]));

        for (NSString *eachLine in lines) {
            NSArray *values = [eachLine componentsSeparatedByString:@"\t"];
            for (NSString *eachValue in values) {
                if ([eachValue length]> 1) {

                }
            }
        }
    }
    double duration = CFAbsoluteTimeGetCurrent() - start;
    NSLog (@"%.3f", duration);
}
#else
- (IBAction) spike:(id) sender
{
    double start = CFAbsoluteTimeGetCurrent();
    @autoreleasepool {
        NSError *error = nil;
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Big" ofType:@"tsv"];
        NSString *fileContent = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&error];

        NSArray *lines = [fileContent componentsSeparatedByString:@"\r"];
        NSLog(@"-- lines count: %@", @([lines count]));

        for (NSString *eachLine in lines) {
            @autoreleasepool {
                NSArray *values = [eachLine componentsSeparatedByString:@"\t"];
                for (NSString *eachValue in values) {
                    if ([eachValue length]> 1) {

                    }
                }
            }
        }
    }
    double duration = CFAbsoluteTimeGetCurrent() - start;
    NSLog (@"%.3f", duration);
}
#endif

@end


text:
#include "postgres.h"

#include "access/htup.h"
#include "access/xlogutils.h"
#include "storage/bufpage.h"
#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/fsm_internals.h"
#include "storage/lmgr.h"
#include "storage/lwlock.h"
#include "storage/smgr.h"
#include "utils/rel.h"
#include "utils/inval.h"
#include "miscadmin.h"

/*
 * We use just one byte to store the amount of free space on a page, so we
 * divide the amount of free space a page can have into 256 different
 * categories. The highest category, 255, represents a page with at least
 * MaxFSMRequestSize bytes of free space, and the second highest category
 * represents the range from 254 * FSM_CAT_STEP, inclusive, to
 * MaxFSMRequestSize, exclusive.
 *
 * MaxFSMRequestSize depends on the architecture and BLCKSZ, but assuming
 * default 8k BLCKSZ, and that MaxFSMRequestSize is 24 bytes, the categories
 * look like this
 *
 *
 * Range	 Category
 * 0	- 31   0
 * 32	- 63   1
 * ...	  ...  ...
 * 8096 - 8127 253
 * 8128 - 8163 254
 * 8164 - 8192 255
 *
 * The reason that MaxFSMRequestSize is special is that if MaxFSMRequestSize
 * isn't equal to a range boundary, a page with exactly MaxFSMRequestSize
 * bytes of free space wouldn't satisfy a request for MaxFSMRequestSize
 * bytes. If there isn't more than MaxFSMRequestSize bytes of free space on a
 * completely empty page, that would mean that we could never satisfy a
 * request of exactly MaxFSMRequestSize bytes.
 */
#define FSM_CATEGORIES	256
#define FSM_CAT_STEP	(BLCKSZ / FSM_CATEGORIES)
#define MaxFSMRequestSize	MaxHeapTupleSize

/*
 * Depth of the on-disk tree. We need to be able to address 2^32-1 blocks,
 * and 1626 is the smallest number that satisfies X^3 >= 2^32-1. Likewise,
 * 216 is the smallest number that satisfies X^4 >= 2^32-1. In practice,
 * this means that 4096 bytes is the smallest BLCKSZ that we can get away
 * with a 3-level tree, and 512 is the smallest we support.
 */
#define FSM_TREE_DEPTH	((SlotsPerFSMPage >= 1626) ? 3 : 4)

#define FSM_ROOT_LEVEL	(FSM_TREE_DEPTH - 1)
#define FSM_BOTTOM_LEVEL 0

/*
 * The internal FSM routines work on a logical addressing scheme. Each
 * level of the tree can be thought of as a separately addressable file.
 */
typedef struct
{
	int			level;			/* level */
	int			logpageno;		/* page number within the level */
} FSMAddress;

/* Address of the root page. */
static const FSMAddress FSM_ROOT_ADDRESS = {FSM_ROOT_LEVEL, 0};

/* functions to navigate the tree */
static FSMAddress fsm_get_child(FSMAddress parent, uint16 slot);
static FSMAddress fsm_get_parent(FSMAddress child, uint16 *slot);
static FSMAddress fsm_get_location(BlockNumber heapblk, uint16 *slot);
static BlockNumber fsm_get_heap_blk(FSMAddress addr, uint16 slot);
static BlockNumber fsm_logical_to_physical(FSMAddress addr);

static Buffer fsm_readbuf(Relation rel, FSMAddress addr, bool extend);
static void fsm_extend(Relation rel, BlockNumber fsm_nblocks);

/* functions to convert amount of free space to a FSM category */
static uint8 fsm_space_avail_to_cat(Size avail);
static uint8 fsm_space_needed_to_cat(Size needed);
static Size fsm_space_cat_to_avail(uint8 cat);

/* workhorse functions for various operations */
static int fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot,
				   uint8 newValue, uint8 minValue);
static BlockNumber fsm_search(Relation rel, uint8 min_cat);
static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof);

/******** Public API ********/

/*
 * GetPageWithFreeSpace - try to find a page in the given relation with
 *		at least the specified amount of free space.
 *
 * If successful, return the block number; if not, return InvalidBlockNumber.
 *
 * The caller must be prepared for the possibility that the returned page
 * will turn out to have too little space available by the time the caller
 * gets a lock on it.  In that case, the caller should report the actual
 * amount of free space available on that page and then try again (see
 * RecordAndGetPageWithFreeSpace).	If InvalidBlockNumber is returned,
 * extend the relation.
 */
BlockNumber
GetPageWithFreeSpace(Relation rel, Size spaceNeeded)
{
	uint8		min_cat = fsm_space_needed_to_cat(spaceNeeded);

	return fsm_search(rel, min_cat);
}

/*
 * RecordAndGetPageWithFreeSpace - update info about a page and try again.
 *
 * We provide this combo form to save some locking overhead, compared to
 * separate RecordPageWithFreeSpace + GetPageWithFreeSpace calls. There's
 * also some effort to return a page close to the old page; if there's a
 * page with enough free space on the same FSM page where the old one page
 * is located, it is preferred.
 */
BlockNumber
RecordAndGetPageWithFreeSpace(Relation rel, BlockNumber oldPage,
							  Size oldSpaceAvail, Size spaceNeeded)
{
	int			old_cat = fsm_space_avail_to_cat(oldSpaceAvail);
	int			search_cat = fsm_space_needed_to_cat(spaceNeeded);
	FSMAddress	addr;
	uint16		slot;
	int			search_slot;

	/* Get the location of the FSM byte representing the heap block */
	addr = fsm_get_location(oldPage, &slot);

	search_slot = fsm_set_and_search(rel, addr, slot, old_cat, search_cat);

	/*
	 * If fsm_set_and_search found a suitable new block, return that.
	 * Otherwise, search as usual.
	 */
	if (search_slot != -1)
		return fsm_get_heap_blk(addr, search_slot);
	else
		return fsm_search(rel, search_cat);
}

/*
 * RecordPageWithFreeSpace - update info about a page.
 *
 * Note that if the new spaceAvail value is higher than the old value stored
 * in the FSM, the space might not become visible to searchers until the next
 * FreeSpaceMapVacuum call, which updates the upper level pages.
 */
void
RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, Size spaceAvail)
{
	int			new_cat = fsm_space_avail_to_cat(spaceAvail);
	FSMAddress	addr;
	uint16		slot;

	/* Get the location of the FSM byte representing the heap block */
	addr = fsm_get_location(heapBlk, &slot);

	fsm_set_and_search(rel, addr, slot, new_cat, 0);
}

/*
 * XLogRecordPageWithFreeSpace - like RecordPageWithFreeSpace, for use in
 *		WAL replay
 */
void
XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
							Size spaceAvail)
{
	int			new_cat = fsm_space_avail_to_cat(spaceAvail);
	FSMAddress	addr;
	uint16		slot;
	BlockNumber blkno;
	Buffer		buf;
	Page		page;

	/* Get the location of the FSM byte representing the heap block */
	addr = fsm_get_location(heapBlk, &slot);
	blkno = fsm_logical_to_physical(addr);

	/* If the page doesn't exist already, extend */
	buf = XLogReadBufferExtended(rnode, FSM_FORKNUM, blkno, RBM_ZERO_ON_ERROR);
	LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);

	page = BufferGetPage(buf);
	if (PageIsNew(page))
		PageInit(page, BLCKSZ, 0);

	if (fsm_set_avail(page, slot, new_cat))
		/* GPDB_84_MERGE_FIXME: upstream calls MarkBufferDirtyHint instead.
		 * Backport commit 20723ce80 to fix. */
		MarkBufferDirty(buf);
	UnlockReleaseBuffer(buf);
}

/*
 * GetRecordedFreePage - return the amount of free space on a particular page,
 *		according to the FSM.
 */
Size
GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk)
{
	FSMAddress	addr;
	uint16		slot;
	Buffer		buf;
	uint8		cat;

	/* Get the location of the FSM byte representing the heap block */
	addr = fsm_get_location(heapBlk, &slot);

	buf = fsm_readbuf(rel, addr, false);
	if (!BufferIsValid(buf))
		return 0;
	cat = fsm_get_avail(BufferGetPage(buf), slot);
	ReleaseBuffer(buf);

	return fsm_space_cat_to_avail(cat);
}

/*
 * FreeSpaceMapTruncateRel - adjust for truncation of a relation.
 *
 * The caller must hold AccessExclusiveLock on the relation, to ensure
 * that other backends receive the relcache invalidation event that this
 * function sends, before accessing the FSM again.
 *
 * nblocks is the new size of the heap.
 */
void
FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
{
	BlockNumber new_nfsmblocks;
	FSMAddress	first_removed_address;
	uint16		first_removed_slot;
	Buffer		buf;

	RelationOpenSmgr(rel);

	/*
	 * If no FSM has been created yet for this relation, there's nothing to
	 * truncate.
	 */
	if (!smgrexists(rel->rd_smgr, FSM_FORKNUM))
		return;

	/* Get the location in the FSM of the first removed heap block */
	first_removed_address = fsm_get_location(nblocks, &first_removed_slot);

	/*
	 * Zero out the tail of the last remaining FSM page. If the slot
	 * representing the first removed heap block is at a page boundary, as the
	 * first slot on the FSM page that first_removed_address points to, we can
	 * just truncate that page altogether.
	 */
	if (first_removed_slot > 0)
	{
		buf = fsm_readbuf(rel, first_removed_address, false);
		if (!BufferIsValid(buf))
			return;				/* nothing to do; the FSM was already smaller */
		LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
		fsm_truncate_avail(BufferGetPage(buf), first_removed_slot);
		/* GPDB_84_MERGE_FIXME: upstream calls MarkBufferDirtyHint instead.
		 * Backport commit 20723ce80 to fix. */
		MarkBufferDirty(buf);
		UnlockReleaseBuffer(buf);

		new_nfsmblocks = fsm_logical_to_physical(first_removed_address) + 1;
	}
	else
	{
		new_nfsmblocks = fsm_logical_to_physical(first_removed_address);
		if (smgrnblocks(rel->rd_smgr, FSM_FORKNUM) <= new_nfsmblocks)
			return;				/* nothing to do; the FSM was already smaller */
	}

	/* Truncate the unused FSM pages */
	smgrtruncate(rel->rd_smgr, FSM_FORKNUM, new_nfsmblocks, rel->rd_istemp);

	/*
	 * Need to invalidate the relcache entry, because rd_fsm_nblocks seen by
	 * other backends is no longer valid.
	 */
	if (!InRecovery)
		CacheInvalidateRelcache(rel);

	rel->rd_fsm_nblocks = new_nfsmblocks;
}

/*
 * FreeSpaceMapVacuum - scan and fix any inconsistencies in the FSM
 */
void
FreeSpaceMapVacuum(Relation rel)
{
	bool		dummy;

	/*
	 * Traverse the tree in depth-first order. The tree is stored physically
	 * in depth-first order, so this should be pretty I/O efficient.
	 */
	fsm_vacuum_page(rel, FSM_ROOT_ADDRESS, &dummy);
}

/******** Internal routines ********/

/*
 * Return category corresponding x bytes of free space
 */
static uint8
fsm_space_avail_to_cat(Size avail)
{
	int			cat;

	Assert(avail < BLCKSZ);

	if (avail >= MaxFSMRequestSize)
		return 255;

	cat = avail / FSM_CAT_STEP;

	/*
	 * The highest category, 255, is reserved for MaxFSMRequestSize bytes or
	 * more.
	 */
	if (cat > 254)
		cat = 254;

	return (uint8) cat;
}

/*
 * Return the lower bound of the range of free space represented by given
 * category.
 */
static Size
fsm_space_cat_to_avail(uint8 cat)
{
	/* The highest category represents exactly MaxFSMRequestSize bytes. */
	if (cat == 255)
		return MaxFSMRequestSize;
	else
		return cat * FSM_CAT_STEP;
}

/*
 * Which category does a page need to have, to accommodate x bytes of data?
 * While fsm_size_to_avail_cat() rounds down, this needs to round up.
 */
static uint8
fsm_space_needed_to_cat(Size needed)
{
	int			cat;

	/* Can't ask for more space than the highest category represents */
	if (needed > MaxFSMRequestSize)
		elog(ERROR, "invalid FSM request size %lu",
			 (unsigned long) needed);

	if (needed == 0)
		return 1;

	cat = (needed + FSM_CAT_STEP - 1) / FSM_CAT_STEP;

	if (cat > 255)
		cat = 255;

	return (uint8) cat;
}

/*
 * Returns the physical block number an FSM page
 */
static BlockNumber
fsm_logical_to_physical(FSMAddress addr)
{
	BlockNumber pages;
	int			leafno;
	int			l;

	/*
	 * Calculate the logical page number of the first leaf page below the
	 * given page.
	 */
	leafno = addr.logpageno;
	for (l = 0; l < addr.level; l++)
		leafno *= SlotsPerFSMPage;

	/* Count upper level nodes required to address the leaf page */
	pages = 0;
	for (l = 0; l < FSM_TREE_DEPTH; l++)
	{
		pages += leafno + 1;
		leafno /= SlotsPerFSMPage;
	}

	/*
	 * If the page we were asked for wasn't at the bottom level, subtract the
	 * additional lower level pages we counted above.
	 */
	pages -= addr.level;

	/* Turn the page count into 0-based block number */
	return pages - 1;
}

/*
 * Return the FSM location corresponding to given heap block.
 */
static FSMAddress
fsm_get_location(BlockNumber heapblk, uint16 *slot)
{
	FSMAddress	addr;

	addr.level = FSM_BOTTOM_LEVEL;
	addr.logpageno = heapblk / SlotsPerFSMPage;
	*slot = heapblk % SlotsPerFSMPage;

	return addr;
}

/*
 * Return the heap block number corresponding to given location in the FSM.
 */
static BlockNumber
fsm_get_heap_blk(FSMAddress addr, uint16 slot)
{
	Assert(addr.level == FSM_BOTTOM_LEVEL);
	return ((unsigned int) addr.logpageno) * SlotsPerFSMPage + slot;
}

/*
 * Given a logical address of a child page, get the logical page number of
 * the parent, and the slot within the parent corresponding to the child.
 */
static FSMAddress
fsm_get_parent(FSMAddress child, uint16 *slot)
{
	FSMAddress	parent;

	Assert(child.level < FSM_ROOT_LEVEL);

	parent.level = child.level + 1;
	parent.logpageno = child.logpageno / SlotsPerFSMPage;
	*slot = child.logpageno % SlotsPerFSMPage;

	return parent;
}

/*
 * Given a logical address of a parent page, and a slot number get the
 * logical address of the corresponding child page.
 */
static FSMAddress
fsm_get_child(FSMAddress parent, uint16 slot)
{
	FSMAddress	child;

	Assert(parent.level > FSM_BOTTOM_LEVEL);

	child.level = parent.level - 1;
	child.logpageno = parent.logpageno * SlotsPerFSMPage + slot;

	return child;
}

/*
 * Read a FSM page.
 *
 * If the page doesn't exist, InvalidBuffer is returned, or if 'extend' is
 * true, the FSM file is extended.
 */
static Buffer
fsm_readbuf(Relation rel, FSMAddress addr, bool extend)
{
	BlockNumber blkno = fsm_logical_to_physical(addr);
	Buffer		buf;

	RelationOpenSmgr(rel);

	/* If we haven't cached the size of the FSM yet, check it first */
	if (rel->rd_fsm_nblocks == InvalidBlockNumber)
	{
		if (smgrexists(rel->rd_smgr, FSM_FORKNUM))
			rel->rd_fsm_nblocks = smgrnblocks(rel->rd_smgr, FSM_FORKNUM);
		else
			rel->rd_fsm_nblocks = 0;
	}

	/* Handle requests beyond EOF */
	if (blkno >= rel->rd_fsm_nblocks)
	{
		if (extend)
			fsm_extend(rel, blkno + 1);
		else
			return InvalidBuffer;
	}

	/*
	 * Use ZERO_ON_ERROR mode, and initialize the page if necessary. The FSM
	 * information is not accurate anyway, so it's better to clear corrupt
	 * pages than error out. Since the FSM changes are not WAL-logged, the
	 * so-called torn page problem on crash can lead to pages with corrupt
	 * headers, for example.
	 */
	buf = ReadBufferExtended(rel, FSM_FORKNUM, blkno, RBM_ZERO_ON_ERROR, NULL);
	if (PageIsNew(BufferGetPage(buf)))
		PageInit(BufferGetPage(buf), BLCKSZ, 0);
	return buf;
}

/*
 * Ensure that the FSM fork is at least fsm_nblocks long, extending
 * it if necessary with empty pages. And by empty, I mean pages filled
 * with zeros, meaning there's no free space.
 */
static void
fsm_extend(Relation rel, BlockNumber fsm_nblocks)
{
	BlockNumber fsm_nblocks_now;
	Page		pg;

	pg = (Page) palloc(BLCKSZ);
	PageInit(pg, BLCKSZ, 0);

	/*
	 * We use the relation extension lock to lock out other backends trying to
	 * extend the FSM at the same time. It also locks out extension of the
	 * main fork, unnecessarily, but extending the FSM happens seldom enough
	 * that it doesn't seem worthwhile to have a separate lock tag type for
	 * it.
	 *
	 * Note that another backend might have extended or created the relation
	 * before we get the lock.
	 */
	LockRelationForExtension(rel, ExclusiveLock);

	/* Create the FSM file first if it doesn't exist */
	if ((rel->rd_fsm_nblocks == 0 || rel->rd_fsm_nblocks == InvalidBlockNumber)
		&& !smgrexists(rel->rd_smgr, FSM_FORKNUM))
	{
		smgrcreate(rel->rd_smgr, FSM_FORKNUM, false);
		fsm_nblocks_now = 0;
	}
	else
		fsm_nblocks_now = smgrnblocks(rel->rd_smgr, FSM_FORKNUM);

	while (fsm_nblocks_now < fsm_nblocks)
	{
		PageSetChecksumInplace(pg, fsm_nblocks_now);

		smgrextend(rel->rd_smgr, FSM_FORKNUM, fsm_nblocks_now,
				   (char *) pg, rel->rd_istemp);
		fsm_nblocks_now++;
	}

	UnlockRelationForExtension(rel, ExclusiveLock);

	pfree(pg);

	/* Update the relcache with the up-to-date size */
	if (!InRecovery)
		CacheInvalidateRelcache(rel);
	rel->rd_fsm_nblocks = fsm_nblocks_now;
}

/*
 * Set value in given FSM page and slot.
 *
 * If minValue > 0, the updated page is also searched for a page with at
 * least minValue of free space. If one is found, its slot number is
 * returned, -1 otherwise.
 */
static int
fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot,
				   uint8 newValue, uint8 minValue)
{
	Buffer		buf;
	Page		page;
	int			newslot = -1;

	buf = fsm_readbuf(rel, addr, true);
	LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);

	page = BufferGetPage(buf);

	if (fsm_set_avail(page, slot, newValue))
		/* GPDB_84_MERGE_FIXME: upstream calls MarkBufferDirtyHint instead.
		 * Backport commit 20723ce80 to fix. */
		MarkBufferDirty(buf);

	if (minValue != 0)
	{
		/* Search while we still hold the lock */
		newslot = fsm_search_avail(buf, minValue,
								   addr.level == FSM_BOTTOM_LEVEL,
								   true);
	}

	UnlockReleaseBuffer(buf);

	return newslot;
}

/*
 * Search the tree for a heap page with at least min_cat of free space
 */
static BlockNumber
fsm_search(Relation rel, uint8 min_cat)
{
	int			restarts = 0;
	FSMAddress	addr = FSM_ROOT_ADDRESS;

	for (;;)
	{
		int			slot;
		Buffer		buf;
		uint8		max_avail = 0;

		/* Read the FSM page. */
		buf = fsm_readbuf(rel, addr, false);

		/* Search within the page */
		if (BufferIsValid(buf))
		{
			LockBuffer(buf, BUFFER_LOCK_SHARE);
			slot = fsm_search_avail(buf, min_cat,
									(addr.level == FSM_BOTTOM_LEVEL),
									false);
			if (slot == -1)
				max_avail = fsm_get_max_avail(BufferGetPage(buf));
			UnlockReleaseBuffer(buf);
		}
		else
			slot = -1;

		if (slot != -1)
		{
			/*
			 * Descend the tree, or return the found block if we're at the
			 * bottom.
			 */
			if (addr.level == FSM_BOTTOM_LEVEL)
				return fsm_get_heap_blk(addr, slot);

			addr = fsm_get_child(addr, slot);
		}
		else if (addr.level == FSM_ROOT_LEVEL)
		{
			/*
			 * At the root, failure means there's no page with enough free
			 * space in the FSM. Give up.
			 */
			return InvalidBlockNumber;
		}
		else
		{
			uint16		parentslot;
			FSMAddress	parent;

			/*
			 * At lower level, failure can happen if the value in the upper-
			 * level node didn't reflect the value on the lower page. Update
			 * the upper node, to avoid falling into the same trap again, and
			 * start over.
			 *
			 * There's a race condition here, if another backend updates this
			 * page right after we release it, and gets the lock on the parent
			 * page before us. We'll then update the parent page with the now
			 * stale information we had. It's OK, because it should happen
			 * rarely, and will be fixed by the next vacuum.
			 */
			parent = fsm_get_parent(addr, &parentslot);
			fsm_set_and_search(rel, parent, parentslot, max_avail, 0);

			/*
			 * If the upper pages are badly out of date, we might need to loop
			 * quite a few times, updating them as we go. Any inconsistencies
			 * should eventually be corrected and the loop should end. Looping
			 * indefinitely is nevertheless scary, so provide an emergency
			 * valve.
			 */
			if (restarts++ > 10000)
				return InvalidBlockNumber;

			/* Start search all over from the root */
			addr = FSM_ROOT_ADDRESS;
		}
	}
}

/*
 * Recursive guts of FreeSpaceMapVacuum
 */
static uint8
fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof_p)
{
	Buffer		buf;
	Page		page;
	uint8		max_avail;

	/* Read the page if it exists, or return EOF */
	buf = fsm_readbuf(rel, addr, false);
	if (!BufferIsValid(buf))
	{
		*eof_p = true;
		return 0;
	}
	else
		*eof_p = false;

	page = BufferGetPage(buf);

	/*
	 * Recurse into children, and fix the information stored about them at
	 * this level.
	 */
	if (addr.level > FSM_BOTTOM_LEVEL)
	{
		int			slot;
		bool		eof = false;

		for (slot = 0; slot < SlotsPerFSMPage; slot++)
		{
			int			child_avail;

			/* After we hit end-of-file, just clear the rest of the slots */
			if (!eof)
				child_avail = fsm_vacuum_page(rel, fsm_get_child(addr, slot), &eof);
			else
				child_avail = 0;

			/* Update information about the child */
			if (fsm_get_avail(page, slot) != child_avail)
			{
				LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
				fsm_set_avail(BufferGetPage(buf), slot, child_avail);
				/* GPDB_84_MERGE_FIXME: upstream calls MarkBufferDirtyHint instead.
				 * Backport commit 20723ce80 to fix. */
				MarkBufferDirty(buf);
				LockBuffer(buf, BUFFER_LOCK_UNLOCK);
			}
		}
	}

	max_avail = fsm_get_max_avail(BufferGetPage(buf));

	/*
	 * Reset the next slot pointer. This encourages the use of low-numbered
	 * pages, increasing the chances that a later vacuum can truncate the
	 * relation.
	 */
	((FSMPage) PageGetContents(page))->fp_next_slot = 0;

	ReleaseBuffer(buf);

	return max_avail;
}


text:
using System.Collections.Generic;
using System.Dynamic;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Controllers;
using Frapid.ApplicationState.Cache;
using Frapid.ApplicationState.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Frapid.Account.DataAccess;
using Frapid.DataAccess;
using Frapid.DataAccess.Models;
using Frapid.Framework;
using Frapid.Framework.Extensions;
using Frapid.WebApi;

namespace Frapid.Account.Api
{
    /// <summary>
    ///     Provides a direct HTTP access to perform various tasks such as adding, editing, and removing Roles.
    /// </summary>
    [RoutePrefix("api/v1.0/account/role")]
    public class RoleController : FrapidApiController
    {
        /// <summary>
        ///     The Role repository.
        /// </summary>
        private IRoleRepository RoleRepository;

        public RoleController()
        {
        }

        public RoleController(IRoleRepository repository)
        {
            this.RoleRepository = repository;
        }

        protected override void Initialize(HttpControllerContext context)
        {
            base.Initialize(context);

            if (this.RoleRepository == null)
            {
                this.RoleRepository = new Frapid.Account.DataAccess.Role
                {
                    _Catalog = this.MetaUser.Catalog,
                    _LoginId = this.MetaUser.LoginId,
                    _UserId = this.MetaUser.UserId
                };
            }
        }

        /// <summary>
        ///     Creates meta information of "role" entity.
        /// </summary>
        /// <returns>Returns the "role" meta information to perform CRUD operation.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("meta")]
        [Route("~/api/account/role/meta")]
        [RestAuthorize]
        public EntityView GetEntityView()
        {
            return new EntityView
            {
                PrimaryKey = "role_id",
                Columns = new List<EntityColumn>()
                {
                        new EntityColumn
                        {
                                ColumnName = "role_id",
                                PropertyName = "RoleId",
                                DataType = "int",
                                DbDataType = "int4",
                                IsNullable = false,
                                IsPrimaryKey = true,
                                IsSerial = false,
                                Value = "",
                                MaxLength = 0
                        },
                        new EntityColumn
                        {
                                ColumnName = "role_name",
                                PropertyName = "RoleName",
                                DataType = "string",
                                DbDataType = "varchar",
                                IsNullable = false,
                                IsPrimaryKey = false,
                                IsSerial = false,
                                Value = "",
                                MaxLength = 100
                        },
                        new EntityColumn
                        {
                                ColumnName = "is_administrator",
                                PropertyName = "IsAdministrator",
                                DataType = "bool",
                                DbDataType = "bool",
                                IsNullable = false,
                                IsPrimaryKey = false,
                                IsSerial = false,
                                Value = "",
                                MaxLength = 0
                        },
                        new EntityColumn
                        {
                                ColumnName = "audit_user_id",
                                PropertyName = "AuditUserId",
                                DataType = "int",
                                DbDataType = "int4",
                                IsNullable = true,
                                IsPrimaryKey = false,
                                IsSerial = false,
                                Value = "",
                                MaxLength = 0
                        },
                        new EntityColumn
                        {
                                ColumnName = "audit_ts",
                                PropertyName = "AuditTs",
                                DataType = "DateTime",
                                DbDataType = "timestamptz",
                                IsNullable = true,
                                IsPrimaryKey = false,
                                IsSerial = false,
                                Value = "",
                                MaxLength = 0
                        }
                }
            };
        }

        /// <summary>
        ///     Counts the number of roles.
        /// </summary>
        /// <returns>Returns the count of the roles.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("count")]
        [Route("~/api/account/role/count")]
        [RestAuthorize]
        public long Count()
        {
            try
            {
                return this.RoleRepository.Count();
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Returns all collection of role.
        /// </summary>
        /// <returns></returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("all")]
        [Route("~/api/account/role/all")]
        [RestAuthorize]
        public IEnumerable<Frapid.Account.Entities.Role> GetAll()
        {
            try
            {
                return this.RoleRepository.GetAll();
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Returns collection of role for export.
        /// </summary>
        /// <returns></returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("export")]
        [Route("~/api/account/role/export")]
        [RestAuthorize]
        public IEnumerable<dynamic> Export()
        {
            try
            {
                return this.RoleRepository.Export();
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Returns an instance of role.
        /// </summary>
        /// <param name="roleId">Enter RoleId to search for.</param>
        /// <returns></returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("{roleId}")]
        [Route("~/api/account/role/{roleId}")]
        [RestAuthorize]
        public Frapid.Account.Entities.Role Get(int roleId)
        {
            try
            {
                return this.RoleRepository.Get(roleId);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        [AcceptVerbs("GET", "HEAD")]
        [Route("get")]
        [Route("~/api/account/role/get")]
        [RestAuthorize]
        public IEnumerable<Frapid.Account.Entities.Role> Get([FromUri] int[] roleIds)
        {
            try
            {
                return this.RoleRepository.Get(roleIds);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Returns the first instance of role.
        /// </summary>
        /// <returns></returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("first")]
        [Route("~/api/account/role/first")]
        [RestAuthorize]
        public Frapid.Account.Entities.Role GetFirst()
        {
            try
            {
                return this.RoleRepository.GetFirst();
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Returns the previous instance of role.
        /// </summary>
        /// <param name="roleId">Enter RoleId to search for.</param>
        /// <returns></returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("previous/{roleId}")]
        [Route("~/api/account/role/previous/{roleId}")]
        [RestAuthorize]
        public Frapid.Account.Entities.Role GetPrevious(int roleId)
        {
            try
            {
                return this.RoleRepository.GetPrevious(roleId);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Returns the next instance of role.
        /// </summary>
        /// <param name="roleId">Enter RoleId to search for.</param>
        /// <returns></returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("next/{roleId}")]
        [Route("~/api/account/role/next/{roleId}")]
        [RestAuthorize]
        public Frapid.Account.Entities.Role GetNext(int roleId)
        {
            try
            {
                return this.RoleRepository.GetNext(roleId);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Returns the last instance of role.
        /// </summary>
        /// <returns></returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("last")]
        [Route("~/api/account/role/last")]
        [RestAuthorize]
        public Frapid.Account.Entities.Role GetLast()
        {
            try
            {
                return this.RoleRepository.GetLast();
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Creates a paginated collection containing 10 roles on each page, sorted by the property RoleId.
        /// </summary>
        /// <returns>Returns the first page from the collection.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("")]
        [Route("~/api/account/role")]
        [RestAuthorize]
        public IEnumerable<Frapid.Account.Entities.Role> GetPaginatedResult()
        {
            try
            {
                return this.RoleRepository.GetPaginatedResult();
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Creates a paginated collection containing 10 roles on each page, sorted by the property RoleId.
        /// </summary>
        /// <param name="pageNumber">Enter the page number to produce the resultset.</param>
        /// <returns>Returns the requested page from the collection.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("page/{pageNumber}")]
        [Route("~/api/account/role/page/{pageNumber}")]
        [RestAuthorize]
        public IEnumerable<Frapid.Account.Entities.Role> GetPaginatedResult(long pageNumber)
        {
            try
            {
                return this.RoleRepository.GetPaginatedResult(pageNumber);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Counts the number of roles using the supplied filter(s).
        /// </summary>
        /// <param name="filters">The list of filter conditions.</param>
        /// <returns>Returns the count of filtered roles.</returns>
        [AcceptVerbs("POST")]
        [Route("count-where")]
        [Route("~/api/account/role/count-where")]
        [RestAuthorize]
        public long CountWhere([FromBody]JArray filters)
        {
            try
            {
                List<Frapid.DataAccess.Models.Filter> f = filters.ToObject<List<Frapid.DataAccess.Models.Filter>>(JsonHelper.GetJsonSerializer());
                return this.RoleRepository.CountWhere(f);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Creates a filtered and paginated collection containing 10 roles on each page, sorted by the property RoleId.
        /// </summary>
        /// <param name="pageNumber">Enter the page number to produce the resultset. If you provide a negative number, the result will not be paginated.</param>
        /// <param name="filters">The list of filter conditions.</param>
        /// <returns>Returns the requested page from the collection using the supplied filters.</returns>
        [AcceptVerbs("POST")]
        [Route("get-where/{pageNumber}")]
        [Route("~/api/account/role/get-where/{pageNumber}")]
        [RestAuthorize]
        public IEnumerable<Frapid.Account.Entities.Role> GetWhere(long pageNumber, [FromBody]JArray filters)
        {
            try
            {
                List<Frapid.DataAccess.Models.Filter> f = filters.ToObject<List<Frapid.DataAccess.Models.Filter>>(JsonHelper.GetJsonSerializer());
                return this.RoleRepository.GetWhere(pageNumber, f);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Counts the number of roles using the supplied filter name.
        /// </summary>
        /// <param name="filterName">The named filter.</param>
        /// <returns>Returns the count of filtered roles.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("count-filtered/{filterName}")]
        [Route("~/api/account/role/count-filtered/{filterName}")]
        [RestAuthorize]
        public long CountFiltered(string filterName)
        {
            try
            {
                return this.RoleRepository.CountFiltered(filterName);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Creates a filtered and paginated collection containing 10 roles on each page, sorted by the property RoleId.
        /// </summary>
        /// <param name="pageNumber">Enter the page number to produce the resultset. If you provide a negative number, the result will not be paginated.</param>
        /// <param name="filterName">The named filter.</param>
        /// <returns>Returns the requested page from the collection using the supplied filters.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("get-filtered/{pageNumber}/{filterName}")]
        [Route("~/api/account/role/get-filtered/{pageNumber}/{filterName}")]
        [RestAuthorize]
        public IEnumerable<Frapid.Account.Entities.Role> GetFiltered(long pageNumber, string filterName)
        {
            try
            {
                return this.RoleRepository.GetFiltered(pageNumber, filterName);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Displayfield is a lightweight key/value collection of roles.
        /// </summary>
        /// <returns>Returns an enumerable key/value collection of roles.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("display-fields")]
        [Route("~/api/account/role/display-fields")]
        [RestAuthorize]
        public IEnumerable<Frapid.DataAccess.Models.DisplayField> GetDisplayFields()
        {
            try
            {
                return this.RoleRepository.GetDisplayFields();
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     A custom field is a user defined field for roles.
        /// </summary>
        /// <returns>Returns an enumerable custom field collection of roles.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("custom-fields")]
        [Route("~/api/account/role/custom-fields")]
        [RestAuthorize]
        public IEnumerable<Frapid.DataAccess.Models.CustomField> GetCustomFields()
        {
            try
            {
                return this.RoleRepository.GetCustomFields(null);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     A custom field is a user defined field for roles.
        /// </summary>
        /// <returns>Returns an enumerable custom field collection of roles.</returns>
        [AcceptVerbs("GET", "HEAD")]
        [Route("custom-fields/{resourceId}")]
        [Route("~/api/account/role/custom-fields/{resourceId}")]
        [RestAuthorize]
        public IEnumerable<Frapid.DataAccess.Models.CustomField> GetCustomFields(string resourceId)
        {
            try
            {
                return this.RoleRepository.GetCustomFields(resourceId);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Adds or edits your instance of Role class.
        /// </summary>
        /// <param name="role">Your instance of roles class to add or edit.</param>
        [AcceptVerbs("POST")]
        [Route("add-or-edit")]
        [Route("~/api/account/role/add-or-edit")]
        [RestAuthorize]
        public object AddOrEdit([FromBody]Newtonsoft.Json.Linq.JArray form)
        {
            dynamic role = form[0].ToObject<ExpandoObject>(JsonHelper.GetJsonSerializer());
            List<Frapid.DataAccess.Models.CustomField> customFields = form[1].ToObject<List<Frapid.DataAccess.Models.CustomField>>(JsonHelper.GetJsonSerializer());

            if (role == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.MethodNotAllowed));
            }

            try
            {
                return this.RoleRepository.AddOrEdit(role, customFields);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Adds your instance of Role class.
        /// </summary>
        /// <param name="role">Your instance of roles class to add.</param>
        [AcceptVerbs("POST")]
        [Route("add/{role}")]
        [Route("~/api/account/role/add/{role}")]
        [RestAuthorize]
        public void Add(Frapid.Account.Entities.Role role)
        {
            if (role == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.MethodNotAllowed));
            }

            try
            {
                this.RoleRepository.Add(role);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Edits existing record with your instance of Role class.
        /// </summary>
        /// <param name="role">Your instance of Role class to edit.</param>
        /// <param name="roleId">Enter the value for RoleId in order to find and edit the existing record.</param>
        [AcceptVerbs("PUT")]
        [Route("edit/{roleId}")]
        [Route("~/api/account/role/edit/{roleId}")]
        [RestAuthorize]
        public void Edit(int roleId, [FromBody] Frapid.Account.Entities.Role role)
        {
            if (role == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.MethodNotAllowed));
            }

            try
            {
                this.RoleRepository.Update(role, roleId);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        private List<ExpandoObject> ParseCollection(JArray collection)
        {
            return JsonConvert.DeserializeObject<List<ExpandoObject>>(collection.ToString(), JsonHelper.GetJsonSerializerSettings());
        }

        /// <summary>
        ///     Adds or edits multiple instances of Role class.
        /// </summary>
        /// <param name="collection">Your collection of Role class to bulk import.</param>
        /// <returns>Returns list of imported roleIds.</returns>
        /// <exception cref="DataAccessException">Thrown when your any Role class in the collection is invalid or malformed.</exception>
        [AcceptVerbs("POST")]
        [Route("bulk-import")]
        [Route("~/api/account/role/bulk-import")]
        [RestAuthorize]
        public List<object> BulkImport([FromBody]JArray collection)
        {
            List<ExpandoObject> roleCollection = this.ParseCollection(collection);

            if (roleCollection == null || roleCollection.Count.Equals(0))
            {
                return null;
            }

            try
            {
                return this.RoleRepository.BulkImport(roleCollection);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

        /// <summary>
        ///     Deletes an existing instance of Role class via RoleId.
        /// </summary>
        /// <param name="roleId">Enter the value for RoleId in order to find and delete the existing record.</param>
        [AcceptVerbs("DELETE")]
        [Route("delete/{roleId}")]
        [Route("~/api/account/role/delete/{roleId}")]
        [RestAuthorize]
        public void Delete(int roleId)
        {
            try
            {
                this.RoleRepository.Delete(roleId);
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }

    }
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W29199_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans470.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">
Fommow Tops ——___
Whiting Oil and Gas Corp. Tarpon Fed 44-19—1RH
490 FSL & 465 FEL SESE l9-T153N-R96W McKenzie County, North Dakota

Tarpon Fed 44-19-1RH Tarpon Fed 44-19-1RH Tarpon Fed 44-19-1 RH -
KB 2199' KB 2199' KB 2199' Sam - Ie Tos W__%fi_e o s V  Hmwm

FORMATION

Charles Base of Last Salt Mission Canyon
Loaepoae False Bakken
Upper Bakken Middle Bakken
Middle Bakken Target

...._.

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">11

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans59.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sheets
{
    class Program
    {
        static void Main(string[] args)
        {
            int input = int.Parse(Console.ReadLine());
            string strinnumber = Convert.ToString(input, 2).PadLeft(11, '0');
            for (int i = 0; i < 11; i++)
            {
                if (strinnumber[i] == '0')
                {
                    Console.WriteLine("A"+i);
                }
            }
        }
    }
}