text:
using System;
using System.IO;
using System.Linq;
using System.Text;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;

namespace LibGit2Sharp.Tests
{
    public class ObjectDatabaseFixture : BaseFixture
    {
        [Theory]
        [InlineData("8496071c1b46c854b31185ea97743be6a8774479", true)]
        [InlineData("1385f264afb75a56a5bec74243be9b367ba4ca08", true)]
        [InlineData("ce08fe4884650f067bd5703b6a59a8b3b3c99a09", false)]
        [InlineData("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", false)]
        public void CanTellIfObjectsExists(string sha, bool shouldExists)
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                var oid = new ObjectId(sha);

                Assert.Equal(shouldExists, repo.ObjectDatabase.Contains(oid));
            }
        }

        [Fact]
        public void CanCreateABlobFromAFileInTheWorkingDirectory()
        {
            string path = InitNewRepository();
            using (var repo = new Repository(path))
            {
                Assert.Equal(FileStatus.Nonexistent, repo.Index.RetrieveStatus("hello.txt"));

                File.AppendAllText(Path.Combine(repo.Info.WorkingDirectory, "hello.txt"), "I'm a new file\n");

                Blob blob = repo.ObjectDatabase.CreateBlob("hello.txt");
                Assert.NotNull(blob);
                Assert.Equal("dc53d4c6b8684c21b0b57db29da4a2afea011565", blob.Sha);

                /* The file is unknown from the Index nor the Head ... */
                Assert.Equal(FileStatus.Untracked, repo.Index.RetrieveStatus("hello.txt"));

                /* ...however, it's indeed stored in the repository. */
                var fetchedBlob = repo.Lookup<Blob>(blob.Id);
                Assert.Equal(blob, fetchedBlob);
            }
        }

        [Fact]
        public void CanCreateABlobIntoTheDatabaseOfABareRepository()
        {
            string path = InitNewRepository();

            SelfCleaningDirectory directory = BuildSelfCleaningDirectory();

            string filepath = Touch(directory.RootedDirectoryPath, "hello.txt", "I'm a new file\n");

            using (var repo = new Repository(path))
            {
                /*
                 * $ echo "I'm a new file" | git hash-object --stdin
                 * dc53d4c6b8684c21b0b57db29da4a2afea011565
                 */
                Assert.Null(repo.Lookup<Blob>("dc53d4c6b8684c21b0b57db29da4a2afea011565"));

                Blob blob = repo.ObjectDatabase.CreateBlob(filepath);

                Assert.NotNull(blob);
                Assert.Equal("dc53d4c6b8684c21b0b57db29da4a2afea011565", blob.Sha);
                Assert.Equal("I'm a new file\n", blob.GetContentText());

                var fetchedBlob = repo.Lookup<Blob>(blob.Id);
                Assert.Equal(blob, fetchedBlob);
            }
        }

        [Theory]
        [InlineData("321cbdf08803c744082332332838df6bd160f8f9", null)]
        [InlineData("321cbdf08803c744082332332838df6bd160f8f9", "dummy.data")]
        [InlineData("e9671e138a780833cb689753570fd10a55be84fb", "dummy.txt")]
        [InlineData("e9671e138a780833cb689753570fd10a55be84fb", "dummy.guess")]
        public void CanCreateABlobFromAStream(string expectedSha, string hintPath)
        {
            string path = InitNewRepository();

            var sb = new StringBuilder();
            for (int i = 0; i < 6; i++)
            {
                sb.Append("libgit2\n\r\n");
            }

            using (var repo = new Repository(path))
            {
                CreateAttributesFiles(Path.Combine(repo.Info.Path, "info"), "attributes");

                using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString())))
                {
                    Blob blob = repo.ObjectDatabase.CreateBlob(stream, hintPath);
                    Assert.Equal(expectedSha, blob.Sha);
                }
            }
        }

        Stream PrepareMemoryStream(int contentSize)
        {
            var sb = new StringBuilder();
            for (int i = 0; i < contentSize; i++)
            {
                sb.Append(i % 10);
            }

            return new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString()));
        }

        [Theory]
        [InlineData(34, 8)]
        [InlineData(7584, 5879)]
        [InlineData(7854, 1247)]
        [InlineData(8192, 4096)]
        [InlineData(8192, 4095)]
        [InlineData(8192, 4097)]
        public void CanCreateABlobFromAStreamWithANumberOfBytesToConsume(int contentSize, int numberOfBytesToConsume)
        {
            string path = InitNewRepository();

            using (var repo = new Repository(path))
            {
                using (var stream = PrepareMemoryStream(contentSize))
                {
                    Blob blob = repo.ObjectDatabase.CreateBlob(stream, numberOfBytesToConsume: numberOfBytesToConsume);
                    Assert.Equal(numberOfBytesToConsume, blob.Size);
                }
            }
        }

        [Theory]
        [InlineData(16, 32, null)]
        [InlineData(7854, 9785, null)]
        [InlineData(16, 32, "binary.bin")]
        [InlineData(7854, 9785, "binary.bin")]
        public void CreatingABlobFromTooShortAStreamThrows(int contentSize, int numberOfBytesToConsume, string hintpath)
        {
            string path = InitNewRepository();

            using (var repo = new Repository(path))
            {
                using (var stream = PrepareMemoryStream(contentSize))
                {
                    Assert.Throws<EndOfStreamException>(() => repo.ObjectDatabase.CreateBlob(stream, hintpath, numberOfBytesToConsume));
                }
            }
        }

        [Fact]
        public void CreatingABlobFromANonReadableStreamThrows()
        {
            string path = InitNewRepository();

            using (var repo = new Repository(path))
            using (var stream = new FileStream(
                Path.Combine(repo.Info.WorkingDirectory, "file.txt"),
                FileMode.CreateNew, FileAccess.Write))
            {
                Assert.Throws<ArgumentException>(() => repo.ObjectDatabase.CreateBlob(stream));
            }
        }

        private static void CreateAttributesFiles(string where, string filename)
        {
            const string attributes = "* text=auto\n*.txt text\n*.data binary\n";

            Touch(where, filename, attributes);
        }

        [Theory]
        [InlineData("README")]
        [InlineData("README AS WELL")]
        [InlineData("2/README AS WELL")]
        [InlineData("1/README AS WELL")]
        [InlineData("1")]
        public void CanCreateATreeByAlteringAnExistingOne(string targetPath)
        {
            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                var blob = repo.Lookup<Blob>(new ObjectId("a8233120f6ad708f843d861ce2b7228ec4e3dec6"));

                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree)
                    .Add(targetPath, blob, Mode.NonExecutableFile);

                Tree tree = repo.ObjectDatabase.CreateTree(td);
                Assert.NotNull(tree);
            }
        }

        [Fact]
        public void CanCreateATreeByRemovingEntriesFromExistingOne()
        {
            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree)
                    .Remove("branch_file.txt")
                    .Remove("1/branch_file.txt");

                Tree tree = repo.ObjectDatabase.CreateTree(td);
                Assert.NotNull(tree);

                Assert.Null(tree["branch_file.txt"]);
                Assert.Null(tree["1/branch_file.txt"]);
                Assert.Null(tree["1"]);

                Assert.Equal("814889a078c031f61ed08ab5fa863aea9314344d", tree.Sha);
            }
        }

        [Fact]
        public void RemovingANonExistingEntryFromATreeDefinitionHasNoSideEffect()
        {
            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                Tree head = repo.Head.Tip.Tree;

                TreeDefinition td = TreeDefinition.From(head)
                    .Remove("123")
                    .Remove("nope")
                    .Remove("not/here")
                    .Remove("neither/in/here")
                    .Remove("README/is/a-Blob/not-a-Tree");

                Tree tree = repo.ObjectDatabase.CreateTree(td);
                Assert.NotNull(tree);

                Assert.Equal(head, tree);
            }
        }

        [Fact]
        public void CanCreateAnEmptyTree()
        {
            string path = InitNewRepository();
            using (var repo = new Repository(path))
            {
                var td = new TreeDefinition();

                Tree tree = repo.ObjectDatabase.CreateTree(td);
                Assert.NotNull(tree);
                Assert.Equal("4b825dc642cb6eb9a060e54bf8d69288fbee4904", tree.Sha);
            }
        }

        [Fact]
        public void CanReplaceAnExistingTreeWithAnotherPersitedTree()
        {
            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.Equal(TreeEntryTargetType.Tree, td["1"].TargetType);

                TreeDefinition newTd = new TreeDefinition()
                    .Add("new/one", repo.Lookup<Blob>("a823312"), Mode.NonExecutableFile)
                    .Add("new/two", repo.Lookup<Blob>("a71586c"), Mode.NonExecutableFile)
                    .Add("new/tree", repo.Lookup<Tree>("7f76480"));

                repo.ObjectDatabase.CreateTree(newTd);

                td.Add("1", newTd["new"]);
                Assert.Equal(TreeEntryTargetType.Tree, td["1/tree"].TargetType);
            }
        }

        [Fact]
        public void CanCreateATreeContainingABlobFromAFileInTheWorkingDirectory()
        {
            string path = CloneStandardTestRepo();
            using (var repo = new Repository(path))
            {
                Assert.Equal(FileStatus.Nonexistent, repo.Index.RetrieveStatus("hello.txt"));
                File.AppendAllText(Path.Combine(repo.Info.WorkingDirectory, "hello.txt"), "I'm a new file\n");

                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree)
                    .Add("1/new file", "hello.txt", Mode.NonExecutableFile);

                TreeEntryDefinition ted = td["1/new file"];
                Assert.NotNull(ted);
                Assert.Equal(ObjectId.Zero, ted.TargetId);

                td.Add("1/2/another new file", ted);

                Tree tree = repo.ObjectDatabase.CreateTree(td);

                TreeEntry te = tree["1/new file"];
                Assert.NotNull(te.Target);
                Assert.Equal("dc53d4c6b8684c21b0b57db29da4a2afea011565", te.Target.Sha);
                Assert.Equal("dc53d4c6b8684c21b0b57db29da4a2afea011565", td["1/new file"].TargetId.Sha);

                te = tree["1/2/another new file"];
                Assert.NotNull(te.Target);
                Assert.Equal("dc53d4c6b8684c21b0b57db29da4a2afea011565", te.Target.Sha);
                Assert.Equal("dc53d4c6b8684c21b0b57db29da4a2afea011565", td["1/2/another new file"].TargetId.Sha);
            }
        }

        [Fact]
        public void CanCreateATreeContainingAGitLinkFromAnUntrackedSubmoduleInTheWorkingDirectory()
        {
            string path = CloneSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                const string submodulePath = "sm_added_and_uncommited";

                var submoduleBefore = repo.Submodules[submodulePath];
                Assert.NotNull(submoduleBefore);
                Assert.Null(submoduleBefore.HeadCommitId);

                var objectId = (ObjectId)"480095882d281ed676fe5b863569520e54a7d5c0";

                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree)
                                                  .AddGitLink(submodulePath, objectId);

                TreeEntryDefinition ted = td[submodulePath];
                Assert.NotNull(ted);
                Assert.Equal(Mode.GitLink, ted.Mode);
                Assert.Equal(objectId, ted.TargetId);
                Assert.Equal(TreeEntryTargetType.GitLink, ted.TargetType);

                Tree tree = repo.ObjectDatabase.CreateTree(td);

                TreeEntry te = tree[submodulePath];
                Assert.NotNull(te.Target);
                Assert.IsType<GitLink>(te.Target);
                Assert.Equal(objectId, te.Target.Id);

                var commitWithSubmodule = repo.ObjectDatabase.CreateCommit(Constants.Signature, Constants.Signature, "Submodule!",
                                                                           tree, new[] { repo.Head.Tip }, false);
                repo.Reset(ResetMode.Soft, commitWithSubmodule);

                var submodule = repo.Submodules[submodulePath];
                Assert.NotNull(submodule);
                Assert.Equal(submodulePath, submodule.Name);
                Assert.Equal(submodulePath, submodule.Path);
                Assert.Equal(objectId, submodule.HeadCommitId);
            }
        }

        [Fact]
        public void CannotCreateATreeContainingABlobFromARelativePathAgainstABareRepository()
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                var td = new TreeDefinition()
                    .Add("1/new file", "hello.txt", Mode.NonExecutableFile);

                Assert.Throws<InvalidOperationException>(() => repo.ObjectDatabase.CreateTree(td));
            }
        }

        [Fact]
        public void CreatingATreeFromIndexWithUnmergedEntriesThrows()
        {
            using (var repo = new Repository(MergedTestRepoWorkingDirPath))
            {
                Assert.False(repo.Index.IsFullyMerged);

                Assert.Throws<UnmergedIndexEntriesException>(
                    () => repo.ObjectDatabase.CreateTree(repo.Index));
            }
        }

        [Fact]
        public void CanCreateATreeFromIndex()
        {
            string path = CloneStandardTestRepo();

            using (var repo = new Repository(path))
            {
                const string expectedIndexTreeSha = "0fe0fd1943a1b63ecca36fa6bbe9bbe045f791a4";

                // The tree representing the index is not in the db.
                Assert.Null(repo.Lookup(expectedIndexTreeSha));

                var tree = repo.ObjectDatabase.CreateTree(repo.Index);
                Assert.NotNull(tree);
                Assert.Equal(expectedIndexTreeSha, tree.Id.Sha);

                // The tree representing the index is now in the db.
                tree = repo.Lookup<Tree>(expectedIndexTreeSha);
                Assert.NotNull(tree);
            }
        }

        [Fact]
        public void CanCreateACommit()
        {
            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                Branch head = repo.Head;

                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                td.Add("1/2/readme", td["README"]);

                Tree tree = repo.ObjectDatabase.CreateTree(td);

                Commit commit = repo.ObjectDatabase.CreateCommit(Constants.Signature, Constants.Signature, "Ü message", tree, new[] { repo.Head.Tip }, true);

                Branch newHead = repo.Head;

                Assert.Equal(head, newHead);
                Assert.Equal(commit, repo.Lookup<Commit>(commit.Sha));
                Assert.Equal("Ü message\n", commit.Message);
            }
        }

        [Fact]
        public void CanCreateABinaryBlobFromAStream()
        {
            var binaryContent = new byte[] { 0, 1, 2, 3, 4, 5 };

            string path = InitNewRepository();
            using (var repo = new Repository(path))
            {
                using (var stream = new MemoryStream(binaryContent))
                {
                    Blob blob = repo.ObjectDatabase.CreateBlob(stream);
                    Assert.Equal(6, blob.Size);
                    Assert.Equal(true, blob.IsBinary);
                }
            }
        }

        [Fact]
        public void CanCreateATagAnnotationPointingToAGitObject()
        {
            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                var blob = repo.Head.Tip["README"].Target as Blob;
                Assert.NotNull(blob);

                TagAnnotation tag = repo.ObjectDatabase.CreateTagAnnotation(
                    "nice_blob",
                    blob,
                    Constants.Signature,
                    "I can point at blobs, too!");

                Assert.NotNull(tag);

                // The TagAnnotation is not pointed at by any reference...
                Assert.Null(repo.Tags["nice_blob"]);

                // ...but exists in the odb.
                var fetched = repo.Lookup<TagAnnotation>(tag.Id);
                Assert.Equal(tag, fetched);
            }
        }

        [Fact]
        public void CanEnumerateTheGitObjectsFromBareRepository()
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                int count = 0;

                foreach (var obj in repo.ObjectDatabase)
                {
                    Assert.NotNull(obj);
                    count++;
                }

                Assert.True(count >= 1683);
            }
        }

        [Theory]
        [InlineData("\0Leading zero")]
        [InlineData("Trailing zero\0")]
        [InlineData("Zero \0inside")]
        [InlineData("\0")]
        [InlineData("\0\0\0")]
        public void CreatingACommitWithMessageContainingZeroByteThrows(string message)
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                Assert.Throws<ArgumentException>(() => repo.ObjectDatabase.CreateCommit(
                    Constants.Signature, Constants.Signature, message, repo.Head.Tip.Tree, Enumerable.Empty<Commit>(), false));
            }
        }

        [Theory]
        [InlineData("\0Leading zero")]
        [InlineData("Trailing zero\0")]
        [InlineData("Zero \0inside")]
        [InlineData("\0")]
        [InlineData("\0\0\0")]
        public void CreatingATagAnnotationWithNameOrMessageContainingZeroByteThrows(string input)
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                Assert.Throws<ArgumentException>(() => repo.ObjectDatabase.CreateTagAnnotation(
                    input, repo.Head.Tip, Constants.Signature, "message"));
                Assert.Throws<ArgumentException>(() => repo.ObjectDatabase.CreateTagAnnotation(
                    "name", repo.Head.Tip, Constants.Signature, input));
            }
        }

        [Fact]
        public void CreatingATagAnnotationWithBadParametersThrows()
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                Assert.Throws<ArgumentNullException>(() => repo.ObjectDatabase.CreateTagAnnotation(
                    null, repo.Head.Tip, Constants.Signature, "message"));
                Assert.Throws<ArgumentException>(() => repo.ObjectDatabase.CreateTagAnnotation(
                    string.Empty, repo.Head.Tip, Constants.Signature, "message"));
                Assert.Throws<ArgumentNullException>(() => repo.ObjectDatabase.CreateTagAnnotation(
                    "name", null, Constants.Signature, "message"));
                Assert.Throws<ArgumentNullException>(() => repo.ObjectDatabase.CreateTagAnnotation(
                    "name", repo.Head.Tip, null, "message"));
                Assert.Throws<ArgumentNullException>(() => repo.ObjectDatabase.CreateTagAnnotation(
                    "name", repo.Head.Tip, Constants.Signature, null));
            }
        }

        [Fact]
        public void CanCreateATagAnnotationWithAnEmptyMessage()
        {
            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                var tagAnnotation = repo.ObjectDatabase.CreateTagAnnotation(
                    "name", repo.Head.Tip, Constants.Signature, string.Empty);

                Assert.Equal(string.Empty, tagAnnotation.Message);
            }
        }

        [Theory]
        [InlineData("c47800c", "9fd738e", "5b5b025", 1, 2)]
        [InlineData("9fd738e", "c47800c", "5b5b025", 2, 1)]
        public void CanCalculateHistoryDivergence(
            string sinceSha, string untilSha,
            string expectedAncestorSha, int? expectedAheadBy, int? expectedBehindBy)
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                var since = repo.Lookup<Commit>(sinceSha);
                var until = repo.Lookup<Commit>(untilSha);

                HistoryDivergence div = repo.ObjectDatabase.CalculateHistoryDivergence(since, until);

                Assert.Equal(expectedAheadBy, div.AheadBy);
                Assert.Equal(expectedBehindBy, div.BehindBy);
                Assert.Equal(expectedAncestorSha, div.CommonAncestor.Id.ToString(7));
            }
        }

        [Theory]
        [InlineData("c47800c", "41bc8c6907", 3, 2)]
        public void CanCalculateHistoryDivergenceWhenNoAncestorIsShared(
            string sinceSha, string untilSha,
            int? expectedAheadBy, int? expectedBehindBy)
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                var since = repo.Lookup<Commit>(sinceSha);
                var until = repo.Lookup<Commit>(untilSha);

                HistoryDivergence div = repo.ObjectDatabase.CalculateHistoryDivergence(since, until);

                Assert.Equal(expectedAheadBy, div.AheadBy);
                Assert.Equal(expectedBehindBy, div.BehindBy);
                Assert.Null(div.CommonAncestor);
            }
        }

        [Fact]
        public void CalculatingHistoryDivergenceWithBadParamsThrows()
        {
            using (var repo = new Repository(BareTestRepoPath))
            {
                Assert.Throws<ArgumentNullException>(
                    () => repo.ObjectDatabase.CalculateHistoryDivergence(repo.Head.Tip, null));
                Assert.Throws<ArgumentNullException>(
                    () => repo.ObjectDatabase.CalculateHistoryDivergence(null, repo.Head.Tip));
            }
        }

        [Fact]
        public void CanShortenObjectIdentifier()
        {
            /*
             * $ echo "aabqhq" | git hash-object -t blob --stdin
             * dea509d0b3cb8ee0650f6ca210bc83f4678851ba
             *
             * $ echo "aaazvc" | git hash-object -t blob --stdin
             * dea509d097ce692e167dfc6a48a7a280cc5e877e
             */

            string path = CloneBareTestRepo();
            using (var repo = new Repository(path))
            {
                repo.Config.Set("core.abbrev", 4);

                Blob blob1 = CreateBlob(repo, "aabqhq\n");
                Assert.Equal("dea509d0b3cb8ee0650f6ca210bc83f4678851ba", blob1.Sha);

                Assert.Equal("dea5", repo.ObjectDatabase.ShortenObjectId(blob1));
                Assert.Equal("dea509d0b3cb", repo.ObjectDatabase.ShortenObjectId(blob1, 12));
                Assert.Equal("dea509d0b3cb8ee0650f6ca210bc83f4678851b", repo.ObjectDatabase.ShortenObjectId(blob1, 39));

                Blob blob2 = CreateBlob(repo, "aaazvc\n");
                Assert.Equal("dea509d09", repo.ObjectDatabase.ShortenObjectId(blob2));
                Assert.Equal("dea509d09", repo.ObjectDatabase.ShortenObjectId(blob2, 4));
                Assert.Equal("dea509d0b", repo.ObjectDatabase.ShortenObjectId(blob1));
                Assert.Equal("dea509d0b", repo.ObjectDatabase.ShortenObjectId(blob1, 7));

                Assert.Equal("dea509d0b3cb", repo.ObjectDatabase.ShortenObjectId(blob1, 12));
                Assert.Equal("dea509d097ce", repo.ObjectDatabase.ShortenObjectId(blob2, 12));
            }
        }

        private static Blob CreateBlob(Repository repo, string content)
        {
            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(content)))
            {
                return repo.ObjectDatabase.CreateBlob(stream);
            }
        }
    }
}
/* This is extra311 */


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.genesis.hamlet.ui.mmessages.MMessagesFragment">

    <!--
    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/messagesSwipeRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
        android:id="@+id/messageRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:layout_above="@+id/linearLayout"/>

    </android.support.v4.widget.SwipeRefreshLayout>
    -->

    <android.support.v7.widget.RecyclerView
        android:id="@+id/messageRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:layout_above="@+id/linearLayout"/>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:id="@+id/linearLayout">

        <ImageView
            android:id="@+id/addMessageImageView"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            app:srcCompat="@drawable/ic_add"/>

        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:id="@+id/messageEditText"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"/>

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ic_send"
            android:enabled="false"
            android:id="@+id/sendButton"
            android:layout_gravity="bottom"/>

    </LinearLayout>

    <!--
    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:visibility="gone" />
        -->

</RelativeLayout>

redpajama_set_name: RedPajamaGithub


text:
============
PDF Decanter
============

This is a simple program optimized for PDF-based presentations.  I
mostly use it in conjunction with LaTeX-beamer_, but actually the
source of the PDF is arbitrary (e.g. one may export slides as PDF from
impress or the like, too).

I wrote this mainly for the following reasons:

1. I am using the ``\pause``-feature of LaTeX-beamer_, which lets
   stuff appear one-by-one.  This works by generating multiple PDF pages
   per slide, i.e. each content frame is sub-divided into multiple
   animation frames.  Common PDF readers will display ridiculous page
   numbers like "35 of 245" for a 20 minute presentation; I wanted
   PDF Decanter to recognize multiple PDF pages that belong together and
   be able to **present an overview of the logical slides**, with
   animation frames batched together.

2. Although I like some(!) animated transitions, I find it highly
   irritating to see the logo of one PDF page leave the screen to the
   left, only to have it appear (on the next page) from the right again.
   PDF Decanter shall recognize and **not animate content that does not
   change**.

3. Although possible, it is a real hassle to embed videos in PDF
   files.  (And presentation then only works with – *yuck* – Adobe
   Acrobat Reader on Windows or OS X, while I normally use Linux.)  I
   figured that if I wrote my own software, I could make it as easy as
   possible to **embed videos or other (dynamic) custom content**.

I have much more in mind than what is already implemented, but the
current version should already work well for many presentations.

Other interesting features:

* Overview mode displays already seen slides differently from unseen
  slides.

* In the presence of a PDF outline (e.g. using sectioning with
  LaTeX-beamer), the overview will separate sections visually.

* Hyperlinks within the presentation are supported.

The name "PDF Decanter" stands for "PDF decomposer for animated
transitions whose expedience rocks".  (I am not too happy with the
last part, but otherwise it more or less conveys the gist of the
software.  If you have a better suggestion, please tell me.)  ;-)

Usage
=====

Start PDF Decanter like this::

  <path_to_pdfdecanter>/pdf_decanter.py mypresentation.pdf

This will render the PDF into images (requiring the ``pdftoppm``_
commandline program that usually comes with the ``poppler-utils``
package) and start the presentation.  The rendering process takes a
while, so the result will be cached.

The following keys are available in **presentation mode** (fullscreen slide view):

======================== ==============
Space, Right, PgDown     Next slide
Backspace, Left, PgUp    Previous slide
Home                     First Slide
Tab                      Show overview
======================== ==============

The following keybindings are **always** available (i.e. in both modes):

============== ===================================================
0-9 + Enter    go to slide number #
F, L           jump to [F]irst / [L]ast frame state of current slide
Shift-F        Enter/leave [F]ullscreen mode
Shift-Q        [Q]uit
(Shift-P       Debugging: Toggle navigation visibility)
============== ===================================================

In the **overview mode**, these are the keybindings:

================= =================================================
Enter, Tab, Space Back to presentation mode
Cursor keys       Move yellow slide cursor
Home              First Slide
Shift-U           [U]ncover all slides
Shift-R           [R]eset all slides to covered state (and go home)
================= =================================================

Using the mouse or touchpad is also possible and mostly
self-explaining.  It is worth noting that in presentation mode, all
three mouse buttons (if available) are bound; normal left clicks
advance frames, and middle button clicks go back (if available).
Using the right mouse button, the overview can be brought up.

Bugs and Limitations
====================

I am aware of a lot of bugs and limitations, and I will try to make
this more transparent by filing `issues at GitHub
<https://github.com/hmeine/pdfdecanter/issues>`_.  I tried to get to
a working state and publish this as soon as possible, which means that
right now:

* Presentations with non-white background may not work as well.

Unfinished / planned features:

* Opacity animations should be recognized (leading to smaller file
  sizes and potentially better transition animations).

* Elements overlapping header/footer should be supported and not lead
  to new slides.

* Such elements could get a different transition than fade-in
  (e.g. zoom-in or the like).

* Frame repeations after many pages (e.g. repeated outline slides)
  should also be recognized.  (Again, this could lead to smaller files
  and better transitions between these slides.)

* Zooming (e.g. to the original / increased resolution of embedded
  figures)

* The slide numbers should (optionally) be displayed somewhere in
  order to make the "jump to slide" feature more useful.

.. _LaTeX-beamer: https://bitbucket.org/rivanvx/beamer/overview
.. _pdftoppm: http://poppler.freedesktop.org/


text:
import {RoutedSinglePageApp} from "helpers/spa_base";
import {PluggableScmsPage} from "views/pages/pluggable_scms";

export class PluggableScmsSPA extends RoutedSinglePageApp {
  constructor() {
    super({
            "/":                 PluggableScmsPage,
            "/:name":            PluggableScmsPage,
            "/:name/:operation": PluggableScmsPage
          });
  }
}

//tslint:disable-next-line
new PluggableScmsSPA();


text:
namespace content {
class RenderFrameHost;
}

namespace gfx {
class Image;
}

namespace extensions {
class ExtensionActionRunner;
class Extension;

// Per-tab extension helper. Also handles non-extension apps.
class TabHelper : public content::WebContentsObserver,
                  public ExtensionFunctionDispatcher::Delegate,
                  public ExtensionRegistryObserver,
                  public content::WebContentsUserData<TabHelper> {
 public:
  ~TabHelper() override;

  // Sets the extension denoting this as an app. If |extension| is non-null this
  // tab becomes an app-tab. WebContents does not listen for unload events for
  // the extension. It's up to consumers of WebContents to do that.
  //
  // NOTE: this should only be manipulated before the tab is added to a browser.
  // TODO(sky): resolve if this is the right way to identify an app tab. If it
  // is, than this should be passed in the constructor.
  void SetExtensionApp(const Extension* extension);

  // Convenience for setting the app extension by id. This does nothing if
  // |extension_app_id| is empty, or an extension can't be found given the
  // specified id.
  void SetExtensionAppById(const ExtensionId& extension_app_id);

  // Returns true if an app extension has been set.
  bool is_app() const { return extension_app_ != nullptr; }

  // Return ExtensionId for extension app.
  // If an app extension has not been set, returns empty id.
  ExtensionId GetExtensionAppId() const;

  // If an app extension has been explicitly set for this WebContents its icon
  // is returned.
  //
  // NOTE: the returned icon is larger than 16x16 (its size is
  // extension_misc::EXTENSION_ICON_SMALLISH).
  SkBitmap* GetExtensionAppIcon();

  ScriptExecutor* script_executor() {
    return script_executor_.get();
  }

  ExtensionActionRunner* extension_action_runner() {
    return extension_action_runner_.get();
  }

  ActiveTabPermissionGranter* active_tab_permission_granter() {
    return active_tab_permission_granter_.get();
  }

 private:
  // Utility function to invoke member functions on all relevant
  // ContentRulesRegistries.
  template <class Func>
  void InvokeForContentRulesRegistries(const Func& func);

  explicit TabHelper(content::WebContents* web_contents);

  friend class content::WebContentsUserData<TabHelper>;

  // content::WebContentsObserver overrides.
  void RenderFrameCreated(content::RenderFrameHost* host) override;
  void DidFinishNavigation(
      content::NavigationHandle* navigation_handle) override;
  bool OnMessageReceived(const IPC::Message& message,
                         content::RenderFrameHost* sender) override;
  void DidCloneToNewWebContents(
      content::WebContents* old_web_contents,
      content::WebContents* new_web_contents) override;

  // ExtensionFunctionDispatcher::Delegate overrides.
  WindowController* GetExtensionWindowController() const override;
  content::WebContents* GetAssociatedWebContents() const override;

  // ExtensionRegistryObserver:
  void OnExtensionUnloaded(content::BrowserContext* browser_context,
                           const Extension* extension,
                           UnloadedExtensionReason reason) override;

  // Message handlers.
  void OnGetAppInstallState(content::RenderFrameHost* host,
                            const GURL& requestor_url,
                            int return_route_id,
                            int callback_id);
  void OnContentScriptsExecuting(content::RenderFrameHost* host,
                                 const ExecutingScriptsMap& extension_ids,
                                 const GURL& on_url);

  // App extensions related methods:

  // Resets app_icon_ and if |extension| is non-null uses ImageLoader to load
  // the extension's image asynchronously.
  void UpdateExtensionAppIcon(const Extension* extension);

  const Extension* GetExtension(const ExtensionId& extension_app_id);

  void OnImageLoaded(const gfx::Image& image);

  // Sends our tab ID to |render_frame_host|.
  void SetTabId(content::RenderFrameHost* render_frame_host);

  Profile* profile_;

  // If non-null this tab is an app tab and this is the extension the tab was
  // created for.
  const Extension* extension_app_;

  // Icon for extension_app_ (if non-null) or a manually-set icon for
  // non-extension apps.
  SkBitmap extension_app_icon_;

  std::unique_ptr<ScriptExecutor> script_executor_;

  std::unique_ptr<ExtensionActionRunner> extension_action_runner_;

  declarative_net_request::WebContentsHelper declarative_net_request_helper_;

  std::unique_ptr<ActiveTabPermissionGranter> active_tab_permission_granter_;

  ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
      registry_observer_{this};

  // Vend weak pointers that can be invalidated to stop in-progress loads.
  base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_{this};

  // Generic weak ptr factory for posting callbacks.
  base::WeakPtrFactory<TabHelper> weak_ptr_factory_{this};

  WEB_CONTENTS_USER_DATA_KEY_DECL();

  DISALLOW_COPY_AND_ASSIGN(TabHelper);
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_TAB_HELPER_H_


text:
package spatial.transform

import argon.core._
import argon.emul._
import argon.nodes._
import argon.util._
import argon.transform.ForwardTransformer
import spatial.aliases.spatialConfig
import spatial.lang._
import spatial.metadata._
import spatial.nodes._
import spatial.utils._

case class RewriteTransformer(var IR: State) extends ForwardTransformer{
  override val name = "Rewrite Transformer"

  private case object RemovedParallel { override def toString = "\"Parallel was removed\"" }

  override def transform[T:Type](lhs: Sym[T], rhs: Op[T])(implicit ctx: SrcCtx) = rhs match {
    // Change a write from a mux with the register or some other value to an enabled register write
    case RegWrite(Mirrored(reg), Mirrored(data), Mirrored(en)) if !spatialConfig.enablePIR => data match {
      case Op( Mux(sel, Op(e@RegRead(`reg`)), b) ) =>
        val lhs2 = Reg.write(reg, b, Bit.and(en, Bit.not(sel)))(e.mT,e.bT,ctx,state)
        dbg(c"Rewrote ${str(lhs)}")
        dbg(c"  to ${str(lhs2)}")
        transferMetadata(lhs, lhs2)
        lhs2.asInstanceOf[Exp[T]]

      case Op( Mux(sel, a, Op(e @ RegRead(`reg`))) ) =>
        val lhs2 = Reg.write(reg, a, Bit.and(en, sel))(e.mT,e.bT,ctx,state)
        dbg(c"Rewrote ${str(lhs)}")
        dbg(c"  to ${str(lhs2)}")
        transferMetadata(lhs, lhs2)
        lhs2.asInstanceOf[Exp[T]]

      case _ => super.transform(lhs, rhs)
    }

    case ParallelPipe(en,func) if spatialConfig.removeParallelNodes =>
      func.inline // TODO: Need to account for enables here?
      constant(typ[T])(RemovedParallel)

    case op @ FixMod(x, Literal(y)) if isPow2(y) =>
      def selectMod[S:BOOL,I:INT,F:INT](x: Exp[FixPt[S,I,F]], y: Double): Exp[FixPt[S,I,F]] = {
        val data = BitOps.dataAsBitVector(wrap(x))
        val range = (log2(y.toDouble)-1).toInt :: 0  //Range.alloc(None, FixPt.int32(log2(y.toDouble) - 1),None,None)
        val selected = data.apply(range)
        implicit val vT = VectorN.typeFromLen[Bit](selected.width)
        BitOps.bitVectorAsData[FixPt[S,I,F]](selected, enWarn = false).s
      }
      selectMod(f(x), y.toDouble)(op.mS,op.mI,op.mF).asInstanceOf[Exp[T]]

    case _ => super.transform(lhs, rhs)
  }
}


text:
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

import { AuthService } from '../core/auth.service';

@Component({
  selector: 'app-nav',
  templateUrl: './nav.component.html',
  styleUrls: ['./nav.component.scss']
})
export class NavComponent implements OnInit {

  constructor(private auth: AuthService, private router: Router) { }

  ngOnInit() {
  }

  isLoggedIn() {
    return this.auth.isLoggedIn();
  }

  logout() {
    this.auth.logout().subscribe(() => {
      this.router.navigate(['/']);
    });
  }

  getUserId() {
    return this.auth.getUserId();
  }

}


text:
//
//  YXYMyScene.m
//  Physics
//
//  Created by 杨萧玉 on 14-4-9.
//  Copyright (c) 2014年 杨萧玉. All rights reserved.
//
#define huntRadius 50
#import "PlayFieldScene.h"

@implementation PlayFieldScene
@synthesize hunter;
//@synthesize debugOverlay;
-(id)initWithSize:(CGSize)size {
    if (self = [super initWithSize:size]) {
        /* Setup your scene here */
//        self.debugOverlay = [SKNode node];
//        [self addChild:self.debugOverlay];
        self.scaleMode = SKSceneScaleModeAspectFit;
//        self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:self.frame];
        self.backgroundColor = [SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];

        hunter = [[SKSpriteNode alloc] initWithTexture:[SKTexture textureWithImage:[UIImage imageNamed:@"Spaceship"]] color:[UIColor clearColor] size:CGSizeMake(huntRadius, huntRadius)];
        hunter.position=CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
        hunter.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:hunter.size];
        hunter.physicsBody.affectedByGravity = NO;
        hunter.physicsBody.dynamic = YES;
//        hunter.physicsBody.mass = 1;

        [self addChild:hunter];
        SKEmitterNode * fire = [self newSmokeEmitter];
        fire.position = CGPointMake(0, -hunter.size.height/2);
        [hunter addChild:fire];
//        SKAction *pulseRed = [SKAction sequence:@[
//                                                  [SKAction colorizeWithColor:[SKColor redColor] colorBlendFactor:1.0 duration:0.15],
//                                                  [SKAction waitForDuration:0.1],
//                                                  [SKAction colorizeWithColorBlendFactor:0.0 duration:0.15]]];
//
//        [hunter runAction:[SKAction repeatActionForever:pulseRed]];
        SKAction * makeForce = [SKAction runBlock:^{
            [hunter.physicsBody applyForce:CGVectorMake(10, 10)];
        }];
        [hunter runAction:makeForce];
        SKAction * makeRocks = [SKAction sequence:@[
                                                    [SKAction performSelector:@selector(addRock) onTarget:self],
                                                    [SKAction waitForDuration:0.10 withRange:0.15]
                                                    ]];
//        [self runAction:[SKAction repeatActionForever:makeRocks]];
    }
    return self;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    /* Called when a touch begins */

}

-(void)update:(CFTimeInterval)currentTime {
    /* Called before each frame is rendered */
//    [self.debugOverlay removeFromParent];
//    [self.debugOverlay removeAllChildren];
}

static inline CGFloat skRandf() {
    return rand()/(CGFloat)RAND_MAX;
}

static inline CGFloat skRand(CGFloat low, CGFloat high) {
    return skRandf()*(high - low) + low;
}

- (void)addRock
{
    SKSpriteNode *rock = [[SKSpriteNode alloc] initWithColor:[SKColor brownColor] size:CGSizeMake(8,8)];
    rock.position = CGPointMake(skRand(0, self.size.width),self.size.height-50);
    rock.name = @"rock";
    rock.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:rock.size];
    rock.physicsBody.usesPreciseCollisionDetection = YES;
//    rock.physicsBody.velocity = CGVectorMake(skRand(-500, 500), skRand(-500, 500));
//    [rock.physicsBody applyImpulse:CGVectorMake(10, 10)];
    rock.physicsBody.density = 5;
    rock.physicsBody.affectedByGravity = NO;
//    [rock.physicsBody applyTorque:500];
    [self addChild:rock];

}

- (SKEmitterNode *) newSmokeEmitter
{
    NSString *smokePath = [[NSBundle mainBundle] pathForResource:@"MyFire" ofType:@"sks"];
    SKEmitterNode *smoke = [NSKeyedUnarchiver unarchiveObjectWithFile:smokePath];
    return smoke;
}

-(void) didSimulatePhysics{
    [self enumerateChildNodesWithName:@"rock" usingBlock:^(SKNode *node, BOOL *stop){
        if (node.position.y <0)
            [node removeFromParent];
    }];
//    [self addChild:self.debugOverlay];
//    // add code to create and add debugging images to the debug node.
//    // This example displays a gravity vector.
//    SKShapeNode *gravityLine = [[SKShapeNode alloc] init];
//    gravityLine.position = CGPointMake (200,200);
//
//    CGMutablePathRef path = CGPathCreateMutable();
//    CGPathMoveToPoint(path, NULL, 0.0, 0.0);
//    CGPathAddLineToPoint(path, 0, self.physicsWorld.gravity.dx*10, self.physicsWorld.gravity.dy*10);
//    CGPathCloseSubpath(path);
//    gravityLine.path = path;
//    CGPathRelease(path);
//
//    [self.debugOverlay addChild: gravityLine];
}
@end


text:
A small ruby Gem to notify about server errors.

## Usage
How to use my plugin.

## Installation
Add this line to your application's Gemfile:

```ruby
gem 'holmes'
```

And then execute:
```bash
$ bundle
```

Or install it yourself as:
```bash
$ gem install holmes
```

## Contributing
Contribution directions go here.

## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syll. fung. (Abellini) 5: 1028 (1887)

#### Original name
Agaricus perplexus Peck

### Remarks
null


text:
#ifndef __GST_FREI0R_H__
#define __GST_FREI0R_H__

#include <gst/gst.h>

#include "frei0r.h"

G_BEGIN_DECLS

typedef struct _GstFrei0rFuncTable GstFrei0rFuncTable;
typedef struct _GstFrei0rProperty GstFrei0rProperty;
typedef struct _GstFrei0rPropertyValue GstFrei0rPropertyValue;

struct _GstFrei0rPropertyValue {
  union {
    f0r_param_bool b;
    f0r_param_double d;
    f0r_param_string *s;
    f0r_param_position_t position;
    f0r_param_color_t color;
  } data;
};

struct _GstFrei0rProperty {
  guint prop_id;
  guint n_prop_ids;

  gint prop_idx;
  f0r_param_info_t info;

  GstFrei0rPropertyValue default_value;
};

struct _GstFrei0rFuncTable {
  int (*init) (void);
  void (*deinit) (void);

  f0r_instance_t (*construct) (unsigned int width, unsigned int height);
  void (*destruct) (f0r_instance_t instance);

  void (*get_plugin_info) (f0r_plugin_info_t* info);
  void (*get_param_info) (f0r_param_info_t* info, int param_index);

  void (*set_param_value) (f0r_instance_t instance,
			   f0r_param_t param, int param_index);
  void (*get_param_value) (f0r_instance_t instance,
			   f0r_param_t param, int param_index);

  void (*update) (f0r_instance_t instance,
		  double time, const guint32* inframe, guint32* outframe);
  void (*update2) (f0r_instance_t instance,
		   double time,
		   const guint32* inframe1,
		   const guint32* inframe2,
		   const guint32* inframe3,
		   guint32* outframe);
};

typedef enum {
  GST_FREI0R_PLUGIN_REGISTER_RETURN_OK,
  GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED,
  GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED
} GstFrei0rPluginRegisterReturn;

void gst_frei0r_klass_install_properties (GObjectClass *gobject_class, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties);

f0r_instance_t * gst_frei0r_instance_construct (GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, gint width, gint height);

GstFrei0rPropertyValue * gst_frei0r_property_cache_init (GstFrei0rProperty *properties, gint n_properties);
void gst_frei0r_property_cache_free (GstFrei0rProperty *properties, GstFrei0rPropertyValue *property_cache, gint n_properties);

GstCaps * gst_frei0r_caps_from_color_model (gint color_model);
gboolean gst_frei0r_get_property (f0r_instance_t *instance, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, guint prop_id, GValue *value);
gboolean gst_frei0r_set_property (f0r_instance_t *instance, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, guint prop_id, const GValue *value);

G_END_DECLS

#endif /* __GST_FREI0R_H__ */


text:
<?php

/**
 * @group filters
 */
class LoggerFilterLevelRangeTest extends PHPUnit_Framework_TestCase {

	public function testDecide() {
		$filter = new LoggerFilterLevelRange();
		$filter->setAcceptOnMatch("true");
		$filter->setLevelMin(LoggerLevel::getLevelWarn());
		$filter->setLevelMax(LoggerLevel::getLevelError());

		$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
		$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
		$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");

		$result = $filter->decide($eventError);
		self::assertEquals($result, LoggerFilter::ACCEPT);

		$result = $filter->decide($eventDebug);
		self::assertEquals($result, LoggerFilter::DENY);

		$result = $filter->decide($eventWarn);
		self::assertEquals($result, LoggerFilter::ACCEPT);
    }

    public function testDecideAcceptFalse() {
		$filter = new LoggerFilterLevelRange();
		$filter->setAcceptOnMatch("false");
		$filter->setLevelMin(LoggerLevel::getLevelWarn());
		$filter->setLevelMax(LoggerLevel::getLevelError());

		$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
		$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
		$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");

		$result = $filter->decide($eventError);
		self::assertEquals($result, LoggerFilter::NEUTRAL);

		$result = $filter->decide($eventDebug);
		self::assertEquals($result, LoggerFilter::DENY);

		$result = $filter->decide($eventWarn);
		self::assertEquals($result, LoggerFilter::NEUTRAL);
    }
 }


text:
<?php
class TM_Core_Block_Adminhtml_Support_Edit_Form_Element_Theard_Content extends Mage_Adminhtml_Block_Widget
{
    /**
     *
     * @var TM_Helpmate_Model_Ticket
     */
    protected $_ticket;

    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('tmcore/ticket/edit/form/element/theard/content.phtml');

        $this->_ticket = Mage::registry('tmcore_support');
    }

    /**
     *
     * @return TM_Helpmate_Model_Ticket
     */
    public function getTicket()
    {
        return $this->_ticket;
    }

    /**
     *
     * @return array()
     */
    public function getTheards()
    {
        return $this->getTicket()->getTheards();
    }

    /**
     *
     * @param array $theard
     * @return string
     */
    public function getTheardOwnerTitle(array $theard)
    {
//        Zend_Debug::dump($theard);
        if (empty($theard['user_name'])) {
            return 'Your said';
        }

        return $this->helper('helpmate')->__('%s said (admin)', $theard['user_name']);
    }

    /**
     *
     * @param array $theard
     * @return string
     */
    public function getTheardCreatedAt(array $theard, $dateType = 'date', $format = 'medium')
    {
        if (!isset($theard['created_at'])) {
            return '';
        }
        if ('date' === $dateType) {
            return $this->helper('core')->formatDate($theard['created_at'], $format);
        }
        return $this->helper('core')->formatTime($theard['created_at'], $format);
    }

    /**
     *
     * @param array $theard
     * @return string
     */
    public function getTheardModifiedAt(array $theard, $dateType = 'date', $format = 'medium')
    {
        if (!isset($theard['created_at'])) {
            return '';
        }
        if ('date' === $dateType) {
            return $this->helper('core')->formatDate($theard['modified_at'], $format);
        }
        return $this->helper('core')->formatTime($theard['modified_at'], $format);
    }

    /**
     *
     * @param array $theard
     * @return string
     */
    public function getTheardStatus(array $theard)
    {
        $collection = $this->getTicket()->getStatuses();
        $item = $collection->getItemById($theard['status']);
        return $item ? $item->getName() : '';
    }

    /**
     *
     * @param array $theard
     * @return string
     */
    public function getTheardDepartment(array $theard)
    {
        $collection = $this->getTicket()->getDepartmets();
        $item = $collection->getItemById($theard['department_id']);
        return $item ? $item->getName() : '';
    }

    public function getTheardPriority(array $theard)
    {
        $collection = $this->getTicket()->getPriorities();
        $item = $collection->getItemById($theard['priority']);
        return $item ? $item->getName() : '';
    }

    public function getTheardText(array $theard)
    {
        if (empty($theard['text'])) {
            return '';
        }

//        if ($isSecure) {
//            return Mage::helper('purify')->purify(nl2br($theard['text']));
//        }

        $content = $theard['text'];

        // text/html convert pseudo text/palin
        $tags = array (
            0 => '~<h[123][^>]+>~si',
            1 => '~<h[456][^>]+>~si',
            2 => '~
]+>~si',
            3 => '~
]+>~si',
            4 => '~
]+>~si',
            5 => '~
]+>~si',
            6 => '~
]+>~si',
            7 => '~
]+>~si',
        );
        $content = preg_replace($tags, "\n", $content);
        $content = preg_replace('~</t(d|h)>\s*<t(d|h)[^>]+>~si', ' - ', $content);
        $content = preg_replace('~<[^>]+>~s', '', $content);
        // reducing spaces
        $content = preg_replace('~ +~s', ' ', $content);
        $content = preg_replace('~^\s+~m', '', $content);
        $content = preg_replace('~\s+$~m', '', $content);
        // reducing newlines
        $content = preg_replace('~\n+~s', "\n", $content);

        $_content = '';
        $isOld = false;
        $content = wordwrap($content, 170, "\n");
        foreach (explode("\n", $content) as $_line) {
            $_isOld = ('>' === $_line[0]) ? true : false;
            if ($_isOld && !$isOld) {
                $isOld = true;
                $_content .= '' . $this->escapeHtml($_line) . "
";
                continue;
            }
            if (!$_isOld && $isOld) {
                $isOld = false;
                $_content .= "
\n";
            }
            $_content .= $this->escapeHtml($_line) . "\n";
        }
//        $content = $this->escapeHtml($content, array('div', 'span', 'hr'));
        return "
" .
            "" .
                $_content .
            '' .
        '
';
    }

    public function getTheardFileUrl(array $theard)
    {
        $path = Mage::getBaseUrl('media') . 'helpmate' . DS;
        $files = array_filter(explode(';', $theard['file']));

        foreach ($files as &$file) {
            $file = $path . $file;
        }

        return $files;
    }
}


text:
package com.geeksonsecurity.malwaredemo.domain;

public enum OverlayType {

    // Uses WindowManager.AddView
    VIEW("View Injection"),
    // Start a dedicated activity for the overlay
    ACTIVITY("Activity Injection");

    private String _name;

    OverlayType(String name) {
        _name = name;
    }

    @Override
    public String toString() {
        return _name;
    }

}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class set_position : MonoBehaviour {
	public Rigidbody rb;
	public UDP_Recieve reciever;
	rTransform newer;
	float newTime = 0;
	rTransform older;
	float oldTime;
	void Start(){
		newer = new rTransform ();
		older = new rTransform ();
		pushPosition ();
		pushPosition ();
		oldTime = 0;
	}
	// Update is called once per frame
	void FixedUpdate () {
		//print (reciever.isReady ());
		if (reciever.isReady ()) {
			print ("Ready");
			orientation pos = reciever.getOrientation ();
			rb.position = new Vector3 (pos.xPos, rb.position.y, pos.yPos);
			rb.rotation = Quaternion.Euler (0,pos.angle, 0);
			pushPosition ();
			rb.velocity = calcVelocity ();
		}
	}

	void pushPosition(){
		print ("Pushed position: " + rb.position);
		older.position = newer.position;
		older.rotation = newer.rotation;
		oldTime = newTime;
		newer.position = rb.position;
		newer.rotation = rb.rotation.eulerAngles;
		newTime = Time.time;
	}
	Vector3 calcVelocity(){
		Vector3 displacement = newer.position - older.position;
		print ("Old: " + older.position + ", New: " + newer.position);
		float deltaT = newTime - oldTime;
		print ("DT: " + deltaT);
		print ("calculated velocity: " + displacement / deltaT);
		return displacement / deltaT;
	}
}


text:
package iso20022

// Card security code (CSC) associated with the card performing the transaction.
type CardSecurityInformation1 struct {

	// Card security code (CSC) management associated with the transaction.
	CSCManagement *CSCManagement1Code `xml:"CSCMgmt"`

	// Card security code (CSC).
	CSCValue *Min3Max4NumericText `xml:"CSCVal,omitempty"`
}

func (c *CardSecurityInformation1) SetCSCManagement(value string) {
	c.CSCManagement = (*CSCManagement1Code)(&value)
}

func (c *CardSecurityInformation1) SetCSCValue(value string) {
	c.CSCValue = (*Min3Max4NumericText)(&value)
}


text:
require "strategies/strategy"
require "sources/tgz_source"
require "player"
require "frame"

module TRecs
  class TrecsFileStrategy < Strategy
    attr_reader :input_file
    attr_reader :frames
    attr_reader :from
    attr_reader :to
    attr_reader :speed
    attr_reader :timestamps

    def initialize(options={})
      @input_file = options.fetch(:input_file)

      source = TRecs::TgzSource.new(trecs_backend: input_file)
      @frames = get_frames(source)

      @from = options.fetch(:from) { 0 }
      @from = (@from || 0).to_i

      @to = options.fetch(:to) { nil }
      @to = @to.to_i if @to

      @speed = options.fetch(:speed) { 1.0 }
      @speed = @speed.to_f
    end

    def perform
      timestamps.each do |time|
        frame = frames[time]
        current_time(((time-from)/speed.to_f).to_i)
        current_content(frame)
        current_format(frame.format)
        save_frame if current_content
      end
    end

    private

    def timestamps
      @timestamps ||= frames.keys.sort

      @timestamps = @timestamps.select { |time| time > from }
      @timestamps.unshift(from)

      if to && to > 0
        @timestamps = @timestamps.select { |time| time < to }
        @timestamps.push(to)
      end
      @timestamps
    end

    def get_frames(source)
      frames = {}
      source.read do
        json_string = source.read_entry("frames.json") || "{}"
        parsed_json = JSON.parse(json_string, symbolize_names: true)
        parsed_json.each do |time, value|
          frames[Integer(time.to_s)] = Frame(value)
        end
      end
      frames
    end
  end
end


text:
Low* examples
=============

For the most recent examples, see ``kremlib/LowStar.Lib.*`` where many
"reference" data structures are now being added, including a linked list that's
actually ready for general use in your programs. See also
``test/Wireguard.fst`` for an example of a complex data structure that keeps
pointers to individual cells of a linked list.

For some easier, smaller examples, see the list below. LinkedList4 is a
simplified, earlier version of the reference ``LowStar.Lib.LinkedList``.

.. toctree::
   LinkedList4
   RingBuffer
   ExampleMemCpy


text:
package actions;

import com.avaje.ebean.Ebean;
import models.User;
import play.mvc.Action;
import play.mvc.Http;
import play.mvc.Result;
import utils.StringUtils;

/**
 * @author Steve Chaloner (steve@objectify.be)
 */
public class CurrentUser extends Action.Simple
{
    @Override
    public Result call(Http.Context ctx) throws Throwable
    {
        accessUser(ctx);
        return delegate.call(ctx);
    }

    private static User accessUser(Http.Context ctx)
    {
        User user = (User)ctx.args.get("user");
        if (user == null)
        {
            String userName = ctx.session().get("userName");
            if (!StringUtils.isEmpty(userName))
            {
                user = User.findByUserName(userName);
                if (user != null)
                {
                    ctx.args.put("user",
                                 user);
                }
            }
        }

        return user;
    }

    public static User currentUser()
    {
        return currentUser(Http.Context.current());
    }

    public static User currentUser(Http.Context context)
    {
        return accessUser(context);
    }
}


text:
<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Repositories\ArticleRepository;
use App\Repositories\CalendarRepository;
use App\Repositories\ContactRepository;
use App\Repositories\DonationRepository;
use App\Repositories\UserRepository;
use Illuminate\View\View;
use Mollie\Laravel\Facades\Mollie;

class DashboardController extends Controller
{
    private $userRepository;        /** @var UserRepository     $userRepository     Variable for the database abstraction layer */
    private $contactRepository;     /** @var ContactRepository  $contactRepository  Variable for the database abstraction layer */
    private $calendarRepository;    /** @var CalendarRepository $calendarRepository Variable for the database abstraction layer */
    private $articleRepository;     /** @var ArticleRepository  $articleRepository  Variable for the database abstraction layer */

    /**
     * DashboardController constructor
     *
     * @param  UserRepository      $userRepository     Abstraction class for the users between database and controller
     * @param  ArticleRepository   $articleRepository  Abstraction class for the articles between database and controller
     * @param  ContactRepository   $contactRepository  Abstraction class for the contacts between database and controller
     * @param  CalendarRepository  $calendarRepository Abstraction class for the events between database and controller
     * @return void
     */
    public function __construct(
        UserRepository $userRepository,
        ArticleRepository $articleRepository,
        ContactRepository $contactRepository,
        CalendarRepository $calendarRepository
    ) {
        $this->middleware(['auth', 'role:admin', 'forbid-banned-user']);

        // Database layers
        $this->userRepository     = $userRepository;
        $this->articleRepository  = $articleRepository;
        $this->contactRepository  = $contactRepository;
        $this->calendarRepository = $calendarRepository;
    }

    /**
     * The dashboard page for the application.
     *
     * @param  DonationRepository $donationRepository Abstraction class for the donations.
     * @return View
     */
    public function index(DonationRepository $donationRepository): View
    {
        return view('admin.dashboard', [
            'widgetCounters' => [ // Database record counters for the dashboard widgets
                'users'          => $this->userRepository->entity()->count(),
                'news'           => $this->articleRepository->entity()->count(),
                'contacts'       => $this->contactRepository->entity()->count(),
                'events'         => $this->calendarRepository->entity()->count(),
                'recentPayments' => $donationRepository->getDonations(),
            ]
        ]);
    }
}


text:
package com.linkedin.thirdeye.datasource.cache;

import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListenableFutureTask;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.cache.CacheLoader;
import com.linkedin.thirdeye.datalayer.bao.DatasetConfigManager;
import com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO;
import com.linkedin.thirdeye.datasource.ThirdEyeDataSource;

public class DatasetMaxDataTimeCacheLoader extends CacheLoader<String, Long> {

  private static final Logger LOGGER = LoggerFactory.getLogger(DatasetMaxDataTimeCacheLoader.class);

  private final QueryCache queryCache;
  private DatasetConfigManager datasetConfigDAO;

  private final ExecutorService reloadExecutor = Executors.newSingleThreadExecutor();

  public DatasetMaxDataTimeCacheLoader(QueryCache queryCache, DatasetConfigManager datasetConfigDAO) {
    this.queryCache = queryCache;
    this.datasetConfigDAO = datasetConfigDAO;
  }

  /**
   * Fetches the max date time in millis for this dataset from the right data source
   * {@inheritDoc}
   * @see com.google.common.cache.CacheLoader#load(java.lang.Object)
   */
  @Override
  public Long load(String dataset) throws Exception {
    LOGGER.debug("Loading maxDataTime cache {}", dataset);
    long maxTime = 0;
    DatasetConfigDTO datasetConfig = datasetConfigDAO.findByDataset(dataset);
    String dataSourceName = datasetConfig.getDataSource();
    try {
      ThirdEyeDataSource dataSource = queryCache.getDataSource(dataSourceName);
      if (dataSource == null) {
       LOGGER.warn("dataSource [{}] found null in the query cache", dataSourceName);
      } else {
        maxTime = dataSource.getMaxDataTime(dataset);
      }
    } catch (Exception e) {
      LOGGER.error("Exception in getting max date time for {} from data source {}", dataset, dataSourceName, e);
    }
    if (maxTime <= 0) {
      maxTime = System.currentTimeMillis();
    }
    return maxTime;
  }

  @Override
  public ListenableFuture<Long> reload(final String dataset, Long preMaxDataTime) {
    ListenableFutureTask<Long> reloadTask = ListenableFutureTask.create(new Callable<Long>() {
      @Override public Long call() throws Exception {
        return DatasetMaxDataTimeCacheLoader.this.load(dataset);
      }
    });
    reloadExecutor.execute(reloadTask);
    LOGGER.info("Passively refreshing max data time of collection: {}", dataset);
    return reloadTask;
  }

}


text:
const interpolate = require('./interpolate')
const readDir = require('./readDir')
const fs = require('fs')

module.exports = function ({src, dest, currentKey, opts}, done) {
  if (opts.parsePackage) {
    let pkg = fs.readFileSync(src + '/package.json')
    pkg = pkg.toString()
    pkg = interpolate(pkg, opts.sandbox)
    pkg = JSON.parse(pkg)
    opts.pkg = pkg
  }

  return readDir({src, dest, currentKey, opts}, function () {
    if (opts.parsePackage) {
      let pkg = JSON.stringify(opts.pkg, null, 2)
      return fs.writeFile(dest + '/package.json', pkg, function (err) {
        if (err != null) {
          throw new Error(err)
        }
        return done()
      })
    } else {
      return done()
    }
  })
}


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

import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.webcore.packaging.PackageManagementService;
import org.jetbrains.annotations.NotNull;

/**
 * @author yole
 */
public abstract class PyPackageManagers implements Disposable {
  @NotNull
  public static PyPackageManagers getInstance() {
    return ApplicationManager.getApplication().getService(PyPackageManagers.class);
  }

  @NotNull
  public abstract PyPackageManager forSdk(@NotNull Sdk sdk);

  public abstract PackageManagementService getManagementService(Project project, Sdk sdk);

  public abstract void clearCache(@NotNull final Sdk sdk);

  @Override
  public void dispose() {
  }
}


text:
package edu.ucsb.cs.sort.maxw;

import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Partitioner;

import edu.ucsb.cs.types.IdFeatureWeightArrayWritable;

/**
 * The class partitions keys into ranges and distribute each range to a reducer,
 * such that range i < range j goes to reducer m < reducer n.
 *
 * @param <FloatWritable>
 *            length
 * @param <IdFeatureWeightArrayWritable>
 *            document
 */

@SuppressWarnings("deprecation")
public class MaxwRangePartitioner implements
		Partitioner<FloatWritable, IdFeatureWeightArrayWritable> {

	private float maxDocLength;

	public int getPartition(FloatWritable key, IdFeatureWeightArrayWritable value,
			int numReduceTasks) {
		float range = maxDocLength / numReduceTasks;
		int reduceNo = (int) (key.get() / range);
		if (reduceNo >= numReduceTasks)
			return (numReduceTasks - 1);
		else
			return reduceNo;
	}

	public void configure(JobConf job) {
		maxDocLength = job.getFloat("max.doc.length", 500);
	}
}


text:
package com.banno.plantuml

import org.specs2.mutable.Specification
import java.io.File

import net.sourceforge.plantuml.FileFormat

class SeqDiagramGeneratorSpec extends Specification {

  val pngFileName = "output.png"
  test(pngFileName)
  val svgFileName = "output.svg"
  test(svgFileName)
  val txtFileName = "output.utxt"
  test(txtFileName)

  def test(fileName: String) = {
    s"Should be able to generate a $fileName" in {
      val output = new File(fileName)
      val src = """@startuml
                  |Bob -> Alice : hello
                  |@enduml""".stripMargin

      val desc = PlantUMLPlugin.renderDiagramToFile(src, output, FileFormat.UTXT)
      desc must not(beNull)
    }
    step {
      printDiagram(fileName)
      cleanUp(fileName)
    }
  }

  def cleanUp(name: String) = {
    val output = new File(name)
    output.exists() must beTrue
    output.delete()
  }

  def printDiagram(fileName: String) = {
    if(fileName.endsWith("txt")) {
      val source = scala.io.Source.fromFile(fileName)
      try println(source.mkString) finally source.close()
    }
  }
}


text:
namespace GameScope
{

    // Well known palette color indices (except for GFX_PALETTE_UI)
    enum
    {
        PaletteColorBlack       = 0,
        PaletteColorDarkGreen   = 149,
        PaletteColorLtGray      = 232,
        PaletteColorOrange      = 224,
        PaletteColorWhite       = 246,
        PaletteColorNPC         = 247,
        PaletteColorGray        = 248,
        PaletteColorGreen       = 250,
        PaletteColorYellow      = 251,
        PaletteColorTransparent = 255
    };

    // Palette indices
    extern const eGfxPalette gGamePlayerPalette[MAX_PLAYERS];

    // Ui palette colors
    enum
    {
        //UiPaletteColorBlack = 0
    };

    // Note:
    // First 7 color entries of GFX_PALETTE_UI palette is reserved for ui text colors
}


text:
University of Iowa Alumni Association App

### Content

* Iowa Alumni Magazine
* Iowa Insider
* UIAA Events
* UIAA Member Benefits
* UIAA Member Card
* Clubs and GameWatch
* Contact Us


text:
@interface NewRecordTableViewController : UITableViewController <MKMapViewDelegate, CLLocationManagerDelegate>

typedef NS_ENUM(NSInteger, RecordType) {
    kPOI,
    kBuilding,
    kZone
};

@property (weak, nonatomic) IBOutlet UITextField *recordTitleTextField;
@property (weak, nonatomic) IBOutlet SZTextView *recordNotesTextView;
@property (weak, nonatomic) IBOutlet UILabel *recordTypeLabel;
@property (retain, nonatomic) CLLocationManager *locationManager;
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (weak, nonatomic) IBOutlet UILabel *validPictureLabel;

@property (weak, nonatomic) NSString *cartopartyId;
@property RecordType recordType;
@property FDTakeController *takeController;

- (IBAction)takePhotoOrChooseFromLibrary:(id)sender;

@end


text:
require 'TeamCityBuildFinder'
require_relative 'mock_json_request'

describe TeamCityBuildFinder::BuildRepository do

  options = {
      :json_request => MockJsonRequest.new
  }

  buildRepository = TeamCityBuildFinder::BuildRepository.new(options)

  describe 'get_builds_for_branch' do

    it 'should return a hash with a build field that is an array' do
      builds = buildRepository.get_builds_for_branch('some name that does not matter')
      builds['build'].kind_of?(Array).should eql(true)
    end

  end

  describe 'get_uri_to_teamcity_branch' do

    it 'should return the correct url with branch name' do
      tc_url = buildRepository.get_uri_to_teamcity_branch('branch')

      tc_url.should eql('http://teamcity.hq.daptiv.com/httpAuth/app/rest/builds?locator=branch:branch')
    end
  end

end


text:
/*
    Colorbox Core Style:
    The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxWrapper {max-width:none;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}

/*
    User Style:
    Change the following styles to modify the appearance of Colorbox.  They are
    ordered & tabbed in a way that represents the nesting of the generated HTML.
*/
#cboxOverlay{background:#fff;}
#colorbox{outline:0;}
    #cboxContent{background:#fff; overflow:hidden;}
        .cboxIframe{background:#fff;}
        #cboxError{padding:50px; border:1px solid #ccc;}
        #cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;}
        #cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;}
        #cboxLoadingOverlay{background:#fff url(images/loading.gif) no-repeat 5px 5px;}

        /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
        #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }

        /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
        #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}

        #cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;}
        #cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
        #cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
        #cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}


text:
@interface PodsDummy_Pods_PearsonDictionary : NSObject
@end
@implementation PodsDummy_Pods_PearsonDictionary
@end


text:
<?php

/**
 * This class provides methods to detect various archive or compression types.
 *
 * The archive formats that can be detected are:
 * - tar ( v7, ustar, pax, gnu )
 * - zip
 *
 * The compression types that can be detected are:
 * - gzip
 * - bzip2
 *
 * @package Archive
 * @version 1.4.1
 * @access private
 */
class ezcArchiveFileType
{
    /**
     * Returns the archive type of the given file.
     *
     * @param string $fileName  Absolute or relative path to the file.
     *
     * @return int    Possible values are: {@link ezcArchive::ZIP},
     *               {@link ezcArchive::TAR}, {@link ezcArchive::TAR_V7}, {@link ezcArchive::TAR_USTAR},
     *               {@link ezcArchive::TAR_PAX}, {@link ezcArchive::TAR_GNU}.
     */
    public static function detect( $fileName )
    {
        $fp = fopen( $fileName, "r" );
        if ( $fp === false )
        {
            return false;
        }

        $data = fread( $fp, 512 );
        fclose( $fp );

        if ( self::isGzip( $data ) )
        {
            return ezcArchive::GZIP;
        }

        if ( self::isBzip2( $data ) )
        {
            return ezcArchive::BZIP2;
        }

        if ( self::isZip( $data ) )
        {
            return ezcArchive::ZIP;
        }

        // Order is important.
        if ( self::isPaxTar( $data ) )
        {
            return ezcArchive::TAR_PAX;
        }

        if ( self::isV7Tar( $data ) )
        {
            return ezcArchive::TAR_V7;
        }

        if ( self::isUstarTar( $data ) )
        {
            return ezcArchive::TAR_USTAR;
        }

        if ( self::isGnuTar( $data ) )
        {
            return ezcArchive::TAR_GNU;
        }

        return false;
    }

    /**
     * Checks if the provided $data matches the known signature of a Bzip2 archive.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
    public static function isBzip2( $data )
    {
        if ( ord( $data[0] ) == 0x42 && ord( $data[1] ) == 0x5a )
        {
            return true;
        }
        return false;
    }

    /**
     * Checks if the provided $data matches the known signature of a Gzip archive.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
    public static function isGzip( $data )
    {
        $h = unpack( "Cid1/Cid2", $data[0] . $data[1] );
        if ( $h["id1"] == 0x1f && $h["id2"] == 0x8b )
        {
            return true;
        }

        return false;
    }

    /**
     * Checks if the provided $data matches the known signature of a Zip archive.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
    public static function isZip( $data )
    {
        if ( $data[0] . $data[1] == pack( "v",  0x4b50 ) )
        {
            return true;
        }

        return false;
    }

    /**
     * Checks if the provided $data matches the known signature of a V7 tar archive.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
     public static function isV7Tar( $data )
     {
        if ( strcmp( substr( $data, 257, 5 ), "\0\0\0\0\0" ) == 0 && strcmp( substr( $data, 263, 2 ), "\0\0" ) == 0 )
        {
            if ( self::tarContainsFileName( $data ) )
            {
                return true;
            }
        }

        return false;
     }

    /**
     * Checks if the provided $data matches the known signature of a USTar archive.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
    public static function isUstarTar( $data )
    {
        if ( strcmp( substr( $data, 257, 5 ), "ustar" ) == 0 && strcmp( substr( $data, 263, 2 ), "00" ) == 0 )
        {
            if ( self::tarContainsFileName( $data ) )
            {
                return true;
            }
        }

        return false;
    }

    /**
     * Checks if the provided $data matches the known signature of a PAX tar archive.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
    public static function isPaxTar( $data )
    {
        if ( strcmp( substr( $data, 257, 5 ), "ustar" ) == 0 && strcmp( substr( $data, 263, 2 ), "00" ) == 0 )
        {
            $type = substr( $data, 156, 1 );
            if ( $type == "x" || $type == "g" )
            {
                if ( self::tarContainsFileName( $data ) )
                {
                    return true;
                }
            }
        }

        return false;
    }

    /**
     * Checks if the provided $data matches the known signature of a GNU tar archive.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
    public static function isGnuTar( $data )
    {
        if ( strcmp( substr( $data, 257, 5 ), "ustar" ) == 0 && strcmp( substr( $data, 263, 2 ), " \0" ) == 0 )
        {
            if ( self::tarContainsFileName( $data ) )
            {
                return true;
            }
        }

        return false;
    }

    /**
     * Checks if the provided $data contains a file name.
     *
     * The $data string parameter must contain the first block of data from a file. It will be
     *                     matched against the known signature for this archive type.
     *
     * @param string $data
     * @return bool
     */
    public static function tarContainsFileName( $data )
    {
        return $data[0] != "\0";
    }
}
?>