text:
// AForge Vision Library
// AForge.NET framework
// http://www.aforgenet.com/framework/
//
// Copyright © AForge.NET, 2005-2011
// contacts@aforgenet.com
//

namespace AForge.Vision.Motion
{
    using System;
    using System.Drawing.Imaging;

    using AForge.Imaging;
    using AForge.Imaging.Filters;

    ///
    /// Motion detector based on two continues frames difference.
    ///
    ///
    /// <remarks><para>The class implements the simplest motion detection algorithm, which is
    /// based on difference of two continues frames. The <see cref="MotionFrame">difference frame</see>
    /// is thresholded and the <see cref="MotionLevel">amount of difference pixels</see> is calculated.
    /// To suppress stand-alone noisy pixels erosion morphological operator may be applied, which
    /// is controlled by <see cref="SuppressNoise"/> property.</para>
    ///
    /// <para>Although the class may be used on its own to perform motion detection, it is preferred
    /// to use it in conjunction with <see cref="MotionDetector"/> class, which provides additional
    /// features and allows to use moton post processing algorithms.</para>
    ///
    /// <para>Sample usage:</para>
    ///
    /// // create motion detector
    /// MotionDetector detector = new MotionDetector(
    ///     new TwoFramesDifferenceDetector( ),
    ///     new MotionAreaHighlighting( ) );
    ///
    /// // continuously feed video frames to motion detector
    /// while ( ... )
    /// {
    ///     // process new video frame and check motion level
    ///     if ( detector.ProcessFrame( videoFrame ) > 0.02 )
    ///     {
    ///         // ring alarm or do somethng else
    ///     }
    /// }
    ///
    /// </remarks>
    ///
    /// <seealso cref="MotionDetector"/>
    ///
    public class TwoFramesDifferenceDetector : IMotionDetector
    {
        // frame's dimension
        private int width;
        private int height;
        private int frameSize;

        // previous frame of video stream
        private UnmanagedImage previousFrame;
        // current frame of video sream
        private UnmanagedImage motionFrame;
        // temporary buffer used for suppressing noise
        private UnmanagedImage tempFrame;
        // number of pixels changed in the new frame of video stream
        private int pixelsChanged;

        // suppress noise
        private bool suppressNoise = true;

        // threshold values
        private int differenceThreshold    =  15;
        private int differenceThresholdNeg = -15;

        // binary erosion filter
        private BinaryErosion3x3 erosionFilter = new BinaryErosion3x3( );

        // dummy object to lock for synchronization
        private object sync = new object( );

        ///
        /// Difference threshold value, [1, 255].
        ///
        ///
        /// <remarks><para>The value specifies the amount off difference between pixels, which is treated
        /// as motion pixel.</para>
        ///
        /// <para>Default value is set to 15.</para>
        /// </remarks>
        ///
        public int DifferenceThreshold
        {
            get { return differenceThreshold; }
            set
            {
                lock ( sync )
                {
                    differenceThreshold = Math.Max( 1, Math.Min( 255, value ) );
                    differenceThresholdNeg = -differenceThreshold;
                }
            }
        }

        ///
        /// Motion level value, [0, 1].
        ///
        ///
        /// <remarks><para>Amount of changes in the last processed frame. For example, if value of
        /// this property equals to 0.1, then it means that last processed frame has 10% difference
        /// with previous frame.</para>
        /// </remarks>
        ///
        public float MotionLevel
        {
            get
            {
                lock ( sync )
                {
                    return (float) pixelsChanged / ( width * height );
                }
            }
        }

        ///
        /// Motion frame containing detected areas of motion.
        ///
        ///
        /// <remarks><para>Motion frame is a grayscale image, which shows areas of detected motion.
        /// All black pixels in the motion frame correspond to areas, where no motion is
        /// detected. But white pixels correspond to areas, where motion is detected.</para>
        ///
        /// <para><note>The property is set to <see langword="null"/> after processing of the first
        /// video frame by the algorithm.</note></para>
        /// </remarks>
        ///
        public UnmanagedImage MotionFrame
        {
            get
            {
                lock ( sync )
                {
                    return motionFrame;
                }
            }
        }

        ///
        /// Suppress noise in video frames or not.
        ///
        ///
        /// <remarks><para>The value specifies if additional filtering should be
        /// done to suppress standalone noisy pixels by applying 3x3 erosion image processing
        /// filter.</para>
        ///
        /// <para>Default value is set to <see langword="true"/>.</para>
        ///
        /// <para><note>Turning the value on leads to more processing time of video frame.</note></para>
        /// </remarks>
        ///
        public bool SuppressNoise
        {
            get { return suppressNoise; }
            set
            {
                lock ( sync )
                {
                    suppressNoise = value;

                    // allocate temporary frame if required
                    if ( ( suppressNoise ) && ( tempFrame == null ) && ( motionFrame != null ) )
                    {
                        tempFrame = UnmanagedImage.Create( width, height, PixelFormat.Format8bppIndexed );
                    }

                    // check if temporary frame is not required
                    if ( ( !suppressNoise ) && ( tempFrame != null ) )
                    {
                        tempFrame.Dispose( );
                        tempFrame = null;
                    }
                }
            }
        }

        ///
        /// Initializes a new instance of the <see cref="TwoFramesDifferenceDetector"/> class.
        ///
        ///
        public TwoFramesDifferenceDetector( ) { }

        ///
        /// Initializes a new instance of the <see cref="TwoFramesDifferenceDetector"/> class.
        ///
        ///
        /// <param name="suppressNoise">Suppress noise in video frames or not (see <see cref="SuppressNoise"/> property).</param>
        ///
        public TwoFramesDifferenceDetector( bool suppressNoise )
        {
            this.suppressNoise = suppressNoise;
        }

        ///
        /// Process new video frame.
        ///
        ///
        /// <param name="videoFrame">Video frame to process (detect motion in).</param>
        ///
        /// <remarks><para>Processes new frame from video source and detects motion in it.</para>
        ///
        /// <para>Check <see cref="MotionLevel"/> property to get information about amount of motion
        /// (changes) in the processed frame.</para>
        /// </remarks>
        ///
        public unsafe void ProcessFrame( UnmanagedImage videoFrame )
        {
            lock ( sync )
            {
                // check previous frame
                if ( previousFrame == null )
                {
                    // save image dimension
                    width = videoFrame.Width;
                    height = videoFrame.Height;

                    // alocate memory for previous and current frames
                    previousFrame = UnmanagedImage.Create( width, height, PixelFormat.Format8bppIndexed );
                    motionFrame = UnmanagedImage.Create( width, height, PixelFormat.Format8bppIndexed );

                    frameSize = motionFrame.Stride * height;

                    // temporary buffer
                    if ( suppressNoise )
                    {
                        tempFrame = UnmanagedImage.Create( width, height, PixelFormat.Format8bppIndexed );
                    }

                    // convert source frame to grayscale
                    Tools.ConvertToGrayscale( videoFrame, previousFrame );

                    return;
                }

                // check image dimension
                if ( ( videoFrame.Width != width ) || ( videoFrame.Height != height ) )
                    return;

                // convert current image to grayscale
                Tools.ConvertToGrayscale( videoFrame, motionFrame );

                // pointers to previous and current frames
                byte* prevFrame = (byte*) previousFrame.ImageData.ToPointer( );
                byte* currFrame = (byte*) motionFrame.ImageData.ToPointer( );
                // difference value
                int diff;

                // 1 - get difference between frames
                // 2 - threshold the difference
                // 3 - copy current frame to previous frame
                for ( int i = 0; i < frameSize; i++, prevFrame++, currFrame++ )
                {
                    // difference
                    diff = (int) *currFrame - (int) *prevFrame;
                    // copy current frame to previous
                    *prevFrame = *currFrame;
                    // treshold
                    *currFrame = ( ( diff >= differenceThreshold ) || ( diff <= differenceThresholdNeg ) ) ? (byte) 255 : (byte) 0;
                }

                if ( suppressNoise )
                {
                    // suppress noise and calculate motion amount
                    AForge.SystemTools.CopyUnmanagedMemory( tempFrame.ImageData, motionFrame.ImageData, frameSize );
                    erosionFilter.Apply( tempFrame, motionFrame );
                }

                // calculate amount of motion pixels
                pixelsChanged = 0;
                byte* motion = (byte*) motionFrame.ImageData.ToPointer( );

                for ( int i = 0; i < frameSize; i++, motion++ )
                {
                    pixelsChanged += ( *motion & 1 );
                }
            }
        }

        ///
        /// Reset motion detector to initial state.
        ///
        ///
        /// <remarks><para>Resets internal state and variables of motion detection algorithm.
        /// Usually this is required to be done before processing new video source, but
        /// may be also done at any time to restart motion detection algorithm.</para>
        /// </remarks>
        ///
        public void Reset( )
        {
            lock ( sync )
            {
                if ( previousFrame != null )
                {
                    previousFrame.Dispose( );
                    previousFrame = null;
                }

                if ( motionFrame != null )
                {
                    motionFrame.Dispose( );
                    motionFrame = null;
                }

                if ( tempFrame != null )
                {
                    tempFrame.Dispose( );
                    tempFrame = null;
                }
            }
        }
    }
}


text:
<!DOCTYPE html>

     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width">
     <title>Almost There Man</title>
     <link rel="stylesheet" href="css/reset.css">
     <link rel="stylesheet" href="css/main.css">

        On procrastination

        Procrastination is a sneaky beast.
        Or perhaps it is conspicuous, but like Medusa, we dare not look at it.
        Whatever the nature of the beast truly is, we must remember that it is, in fact, a beast.
        We do not realize until we are too far gone that we are not supposed to be reading about the postulations of Marcus Aurelius, we are supposed to be compiling data for a marketing proposal.

        Procrastination is that beast that makes us feel good. With this beast at our side, we may meander through the forest, admiring every tree even though we are supposed to meet someone at the lake 5 miles away.
        Those that don't procrastinate sprint through life, a method more efficient than most humans could hope to master but also one that most humans don't desire to have.
        Like the devil, offering Eve the knowledge of the world, procrastination teaches us that ants communicate through their vomit, turtles breathe through their butts and that pigs can't look up into the sky.

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using Hudl.FFmpeg.Command;
using Hudl.FFmpeg.Enums;
using Hudl.FFmpeg.Filters;
using Hudl.FFmpeg.Filters.BaseTypes;
using Hudl.FFmpeg.Resources;
using Hudl.FFmpeg.Resources.BaseTypes;
using Hudl.FFmpeg.Resources.Interfaces;
using Hudl.FFmpeg.Settings;
using Hudl.FFmpeg.Settings.BaseTypes;
using Hudl.FFmpeg.Sugar;
using Xunit;
using CommandFactory = Hudl.FFmpeg.Command.CommandFactory;

namespace Hudl.FFmpeg.Tests.Command
{
    public class CommandTests
    {
        private const string AssetPath = "c:/source/apples.mp4";
        private static readonly SettingsCollection CommandSettingsO = SettingsCollection.ForOutput(new OverwriteOutput());

        public CommandTests()
        {
            Assets.Utilities.SetGlobalAssets();
        }

        [Fact]
        public void Command_AddInput_Verify()
        {
            var command = CommandHelper.CreateCommand();

            Assert.Throws<ArgumentException>(() => command.AddInput(string.Empty));

            command.AddInput(Assets.Utilities.GetVideoFile());

            Assert.True(command.Inputs.Count == 1);
        }

        [Fact]
        public void Command_WithInput_Verify()
        {
            var command = CommandHelper.CreateCommand();

            Assert.Throws<ArgumentException>(() => command.WithInput<VideoStream>(string.Empty));

            command.WithInput<VideoStream>(Assets.Utilities.GetVideoFile());

            Assert.True(command.Inputs.Count == 1);
        }

        [Fact]
        public void Command_Select_Verify()
        {
            var command = CommandHelper.CreateCommand()
                                       .AddInput(Assets.Utilities.GetVideoFile())
                                       .AddInput(Assets.Utilities.GetVideoFile());

            Assert.Throws<IndexOutOfRangeException>(() => command.Select<VideoStream>(5));

            command.Select(1);

            command.Select(0);

            var stage = command.Select(0)
                               .Select(1);

            Assert.True(stage.StreamIdentifiers.Count == 2);
        }

        [Fact]
        public void Command_StreamIdentifier_Verify()
        {
            var command = CommandHelper.CreateCommand();

            command.AddInput(Assets.Utilities.GetVideoFile());

            Assert.Throws<IndexOutOfRangeException>(() => command.StreamIdentifier(-1));

            Assert.Throws<IndexOutOfRangeException>(() => command.StreamIdentifier(1));

            command.StreamIdentifier(0);
        }

        [Fact]
        public void Command_ResourceManager_Verify()
        {
            var command = CommandHelper.CreateCommand();

            Assert.Throws<ArgumentNullException>(() => command.InputManager.Add(null));

            Assert.Throws<ArgumentException>(() => command.InputManager.AddRange(null));

            Assert.Throws<ArgumentNullException>(() => command.InputManager.Insert(0, null));

            command.InputManager.Add(CommandInput.Create(Resource.From(Assets.Utilities.GetVideoFile())));

            var assetsList = new List<IContainer>
                {
                    Resource.From(Assets.Utilities.GetVideoFile()),
                    Resource.From(Assets.Utilities.GetVideoFile())
                };
            var commandList = new List<CommandInput>
                {
                    CommandInput.Create(assetsList[0]),
                    CommandInput.Create(assetsList[1])
                };

            command.InputManager.AddRange(commandList);

            command.InputManager.Insert(0, CommandInput.Create(Resource.From(Assets.Utilities.GetVideoFile())));

            Assert.True(command.Inputs.Count == 4);
        }

        [Fact]
        public void Command_OutputManager_Verify()
        {
            var command = CommandHelper.CreateCommand();

            Assert.Throws<ArgumentNullException>(() => command.OutputManager.Add(null));

            Assert.Throws<ArgumentException>(() => command.OutputManager.AddRange(null));

            command.OutputManager.Add(CommandOutput.Create(Resource.From(AssetPath)));

            var assetsList = new List<IContainer>
                {
                    Resource.From(AssetPath),
                    Resource.From(AssetPath)
                };
            var commandList = new List<CommandOutput>
                {
                    CommandOutput.Create(assetsList[0]),
                    CommandOutput.Create(assetsList[1])
                };

            command.OutputManager.AddRange(commandList);

            Assert.True(command.Outputs.Count == 3);
        }

        [Fact]
        public void Command_FilterWithNoStream()
        {
            var command = CommandHelper.CreateCommand();

            var filterchain = Filterchain.FilterTo<AudioStream>(new AEvalSrc {Expression = "0"});

            CommandStage stage = null;
            stage = command.Filter(filterchain);

            Assert.True(stage.StreamIdentifiers.Count == 1);
        }

        [Fact]
        public void Command_FilterchainManager_Verify()
        {
            var command = CommandHelper.CreateCommand();

            command.AddInput(Assets.Utilities.GetVideoFile())
                   .AddInput(Assets.Utilities.GetVideoFile())
                   .AddInput(Assets.Utilities.GetVideoFile())
                   .AddInput(Assets.Utilities.GetVideoFile());

            var streamId1 = command.StreamIdentifier(0);
            var streamId2 = command.StreamIdentifier(1);
            var streamId3 = command.StreamIdentifier(2);
            var streamId4 = command.StreamIdentifier(3);

            var filterchain = Filterchain.FilterTo<VideoStream>(new Trim(1, 2, VideoUnitType.Seconds));
            var filterchain2 = Filterchain.FilterTo<AudioStream>(new AEvalSrc());

            Assert.Throws<ArgumentNullException>(() => command.FilterchainManager.Add(null));

            Assert.Throws<InvalidOperationException>(() => command.FilterchainManager.Add(filterchain, null));

            Assert.Throws<ArgumentNullException>(() => command.FilterchainManager.AddToEach(null));

            Assert.Throws<ArgumentException>(() => command.FilterchainManager.AddToEach(filterchain, null));

            command.FilterchainManager.Add(filterchain2, null);

            command.FilterchainManager.Add(filterchain, streamId1);

            command.FilterchainManager.AddToEach(filterchain, streamId2, streamId3, streamId4);

            Assert.True(command.Filtergraph.Count == 5);
        }

        [Fact]
        public void Command_RenderWith_Verify()
        {
            var command = CommandHelper.CreateCommand();

            command.AddInput(Assets.Utilities.GetVideoFile());

            command.ExecuteWith<TestCommandProcessor, FFmpegCommandBuilder>(null);
        }

        [Fact]
        public void Command_PreRenderAction_Verify()
        {
            var command = CommandHelper.CreateCommand();

            var beforeRenderExecuted = false;

            var stage = command.WithInput<VideoStream>(Assets.Utilities.GetVideoFile())
                               .BeforeRender((c, f, b) =>
                                   {
                                       beforeRenderExecuted = true;
                                   });

            stage.Command.ExecuteWith<TestCommandProcessor, FFmpegCommandBuilder>(null);

            Assert.True(beforeRenderExecuted);
        }

        [Fact]
        public void Command_PostRenderAction_Verify()
        {
            var command = CommandHelper.CreateCommand();

            var afterRenderExecuted = false;

            var stage = command.WithInput<VideoStream>(Assets.Utilities.GetVideoFile())
                               .AfterRender((c, f, b) =>
                                   {
                                       afterRenderExecuted = true;
                                   });

            stage.Command.ExecuteWith<TestCommandProcessor, FFmpegCommandBuilder>(null);

            Assert.True(afterRenderExecuted);
        }

        [Fact]
        public void Command_WithInputVsAddInput_Verify()
        {
            var command = CommandHelper.CreateCommand();

            Assert.Throws<ArgumentException>(() => command.AddInput(string.Empty));
            Assert.Throws<ArgumentException>(() => command.WithInput<VideoStream>(string.Empty));

            var stage = CommandStage.Create(command);

            stage = command.AddInput(Assets.Utilities.GetVideoFile())
                            .WithInput<VideoStream>(Assets.Utilities.GetVideoFile());

            Assert.True(command.Inputs.Count == 2);
            Assert.True(stage.StreamIdentifiers.Count == 1);
        }

        private static class CommandHelper
        {
            public static FFmpegCommand CreateCommand()
            {
                var factory = CommandFactory.Create();

                return factory.CreateOutputCommand();
            }

        }
    }
}


text:
//
//  Generated by the J2ObjC translator.  DO NOT EDIT!
//  source: android/libcore/luni/src/main/java/javax/xml/parsers/SAXParserFactory.java
//

#include "../../../J2ObjC_header.h"

#pragma push_macro("INCLUDE_ALL_JavaxXmlParsersSAXParserFactory")
#ifdef RESTRICT_JavaxXmlParsersSAXParserFactory
#define INCLUDE_ALL_JavaxXmlParsersSAXParserFactory 0
#else
#define INCLUDE_ALL_JavaxXmlParsersSAXParserFactory 1
#endif
#undef RESTRICT_JavaxXmlParsersSAXParserFactory

#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

#if !defined (JavaxXmlParsersSAXParserFactory_) && (INCLUDE_ALL_JavaxXmlParsersSAXParserFactory || defined(INCLUDE_JavaxXmlParsersSAXParserFactory))
#define JavaxXmlParsersSAXParserFactory_

@class JavaLangClassLoader;
@class JavaxXmlParsersSAXParser;
@class JavaxXmlValidationSchema;

/*!
 @brief Defines a factory API that enables applications to configure and
 obtain a SAX based parser to parse XML documents.
 @author Jeff Suttor
 @version $Revision: 884950 $, $Date: 2009-11-27 10:46:18 -0800 (Fri, 27 Nov 2009) $
 */
@interface JavaxXmlParsersSAXParserFactory : NSObject

#pragma mark Public

/*!
 @brief
Returns the particular property requested for in the underlying
 implementation of org.xml.sax.XMLReader.

 @param name The name of the property to be retrieved.
 @return Value of the requested property.
 @exception ParserConfigurationException if a parser cannot be created which satisfies the requested configuration.
 @exception SAXNotRecognizedException When the underlying XMLReader does not recognize the property name.
 @exception SAXNotSupportedException When the underlying XMLReader recognizes the property name but doesn't support the property.
 - seealso: org.xml.sax.XMLReader#getProperty
 */
- (jboolean)getFeatureWithNSString:(NSString *)name;

/*!
 @brief Gets the Schema object specified through
 the schema) method.
 @throws UnsupportedOperationException
 For backward compatibility, when implementations for
 earlier versions of JAXP is used, this exception will be
 thrown.
 @return the Schema object that was last set through
 the setSchema(Schema) method, or null
 if the method was not invoked since a SAXParserFactory
 is created.
 @since 1.5
 */
- (JavaxXmlValidationSchema *)getSchema;

/*!
 @brief Indicates whether or not the factory is configured to produce
 parsers which are namespace aware.
 @return true if the factory is configured to produce
 parsers which are namespace aware; false otherwise.
 */
- (jboolean)isNamespaceAware;

/*!
 @brief Indicates whether or not the factory is configured to produce
 parsers which validate the XML content during parse.
 @return true if the factory is configured to produce parsers which validate
 the XML content during parse; false otherwise.
 */
- (jboolean)isValidating;

/*!
 @brief
Get state of XInclude processing.

 @return current state of XInclude processing
 @throws UnsupportedOperationException
 For backward compatibility, when implementations for
 earlier versions of JAXP is used, this exception will be
 thrown.
 @since 1.5
 */
- (jboolean)isXIncludeAware;

/*!
 @brief Returns Android's implementation of SAXParserFactory.
 Unlike
 other Java implementations, this method does not consult system
 properties, property files, or the services API.
 @return a new SAXParserFactory.
 @exception FactoryConfigurationError never. Included for API
 compatibility with other Java implementations.
 */
+ (JavaxXmlParsersSAXParserFactory *)newInstance OBJC_METHOD_FAMILY_NONE;

/*!
 @brief Returns an instance of the named implementation of SAXParserFactory.
 @throws FactoryConfigurationError if factoryClassName is not available or cannot be
 instantiated.
 @since 1.6
 */
+ (JavaxXmlParsersSAXParserFactory *)newInstanceWithNSString:(NSString *)factoryClassName
                                     withJavaLangClassLoader:(JavaLangClassLoader *)classLoader OBJC_METHOD_FAMILY_NONE;

/*!
 @brief
Creates a new instance of a SAXParser using the currently
 configured factory parameters.

 @return A new instance of a SAXParser.
 @exception ParserConfigurationException if a parser cannot
 be created which satisfies the requested configuration.
 @exception SAXException for SAX errors.
 */
- (JavaxXmlParsersSAXParser *)newSAXParser OBJC_METHOD_FAMILY_NONE;

/*!
 @brief
Sets the particular feature in the underlying implementation of
 org.xml.sax.XMLReader.
 A list of the core features and properties can be found at
 http://www.saxproject.org/

All implementations are required to support the javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING feature.
 When the feature is

 true: the implementation will limit XML processing to conform to implementation limits.
 Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
 If XML processing is limited for security reasons, it will be reported via a call to the registered
 exception).
 See SAXParser parse methods for handler specification.

 When the feature is false, the implementation will processing XML according to the XML specifications without
 regard to possible implementation limits.

 @param name The name of the feature to be set.
 @param value The value of the feature to be set.
 @exception ParserConfigurationException if a parser cannot
 be created which satisfies the requested configuration.
 @exception SAXNotRecognizedException When the underlying XMLReader does
 not recognize the property name.
 @exception SAXNotSupportedException When the underlying XMLReader
 recognizes the property name but doesn't support the
 property.
 @throws NullPointerException If the name parameter is null.
 - seealso: org.xml.sax.XMLReader#setFeature
 */
- (void)setFeatureWithNSString:(NSString *)name
                   withBoolean:(jboolean)value;

/*!
 @brief Specifies that the parser produced by this code will
 provide support for XML namespaces.
 By default the value of this is set
 to false.
 @param awareness true if the parser produced by this code will
 provide support for XML namespaces; false otherwise.
 */
- (void)setNamespaceAwareWithBoolean:(jboolean)awareness;

/*!
 @brief
Set the Schema to be used by parsers created
 from this factory.

When a Schema is non-null, a parser will use a validator
 created from it to validate documents before it passes information
 down to the application.

When warnings/errors/fatal errors are found by the validator, the parser must
 handle them as if those errors were found by the parser itself.
 In other words, if the user-specified org.xml.sax.ErrorHandler
 is set, it must receive those errors, and if not, they must be
 treated according to the implementation specific
 default error handling rules.

A validator may modify the SAX event stream (for example by
 adding default values that were missing in documents), and a parser
 is responsible to make sure that the application will receive
 those modified event stream.

Initially, null is set as the Schema.

This processing will take effect even if
 the isValidating() method returns false.

It is an error to use
 the http://java.sun.com/xml/jaxp/properties/schemaSource
 property and/or the http://java.sun.com/xml/jaxp/properties/schemaLanguage
 property in conjunction with a non-null Schema object.
 Such configuration will cause a SAXException
 exception when those properties are set on a SAXParser.

Note for implementors

 A parser must be able to work with any Schema
 implementation. However, parsers and schemas are allowed
 to use implementation-specific custom mechanisms
 as long as they yield the result described in the specification.

 @param schema Schema to use, null to remove a schema.
 @throws UnsupportedOperationException
 For backward compatibility, when implementations for
 earlier versions of JAXP is used, this exception will be
 thrown.
 @since 1.5
 */
- (void)setSchemaWithJavaxXmlValidationSchema:(JavaxXmlValidationSchema *)schema;

/*!
 @brief Specifies that the parser produced by this code will
 validate documents as they are parsed.
 By default the value of this is
 set to false.

 Note that "the validation" here means
 a validating
 parser as defined in the XML recommendation.
 In other words, it essentially just controls the DTD validation.
 (except the legacy two properties defined in JAXP 1.2.
 See here for more details.)

 To use modern schema languages such as W3C XML Schema or
 RELAX NG instead of DTD, you can configure your parser to be
 a non-validating parser by leaving the setValidating(boolean)
 method <tt>false</tt>, then use the setSchema(Schema)
 method to associate a schema to a parser.

 @param validating true if the parser produced by this code will
 validate documents as they are parsed; false otherwise.
 */
- (void)setValidatingWithBoolean:(jboolean)validating;

/*!
 @brief
Set state of XInclude processing.

If XInclude markup is found in the document instance, should it be
 processed as specified in
 XML Inclusions (XInclude) Version 1.0.

XInclude processing defaults to false.

 @param state Set XInclude processing to true or
 false
 @throws UnsupportedOperationException
 For backward compatibility, when implementations for
 earlier versions of JAXP is used, this exception will be
 thrown.
 @since 1.5
 */
- (void)setXIncludeAwareWithBoolean:(jboolean)state;

#pragma mark Protected

/*!
 @brief
Protected constructor to force use of newInstance().

 */
- (instancetype)init;

@end

J2OBJC_EMPTY_STATIC_INIT(JavaxXmlParsersSAXParserFactory)

FOUNDATION_EXPORT void JavaxXmlParsersSAXParserFactory_init(JavaxXmlParsersSAXParserFactory *self);

FOUNDATION_EXPORT JavaxXmlParsersSAXParserFactory *JavaxXmlParsersSAXParserFactory_newInstance();

FOUNDATION_EXPORT JavaxXmlParsersSAXParserFactory *JavaxXmlParsersSAXParserFactory_newInstanceWithNSString_withJavaLangClassLoader_(NSString *factoryClassName, JavaLangClassLoader *classLoader);

J2OBJC_TYPE_LITERAL_HEADER(JavaxXmlParsersSAXParserFactory)

#endif

#pragma clang diagnostic pop
#pragma pop_macro("INCLUDE_ALL_JavaxXmlParsersSAXParserFactory")


text:
package schema

import "testing"

func TestEmptyApp(t *testing.T) {
	imj := `
		{
		    "acKind": "ImageManifest",
		    "acVersion": "0.2.0",
		    "name": "example.com/test"
		}
		`

	var im ImageManifest

	err := im.UnmarshalJSON([]byte(imj))
	if err != nil {
		t.Errorf("unexpected error: %v", err)
	}

	// Marshal and Unmarshal to verify that no "app": {} is generated on
	// Marshal and converted to empty struct on Unmarshal
	buf, err := im.MarshalJSON()
	if err != nil {
		t.Errorf("unexpected error: %v", err)
	}

	err = im.UnmarshalJSON(buf)
	if err != nil {
		t.Errorf("unexpected error: %v", err)
	}
}


text:
/*
 * Copyright (c) 2008 The Khronos Group Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

/** @file OMX_Index.h - OpenMax IL version 1.1.2
 *  The OMX_Index header file contains the definitions for both applications
 *  and components .
 */

#ifndef OMX_Index_h
#define OMX_Index_h

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/* Each OMX header must include all required header files to allow the
 *  header to compile without errors.  The includes below are required
 *  for this header file to compile successfully
 */
#include <OMX_Types.h>

/** The OMX_INDEXTYPE enumeration is used to select a structure when either
 *  getting or setting parameters and/or configuration data.  Each entry in
 *  this enumeration maps to an OMX specified structure.  When the
 *  OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
 *  are used, the second parameter will always be an entry from this enumeration
 *  and the third entry will be the structure shown in the comments for the entry.
 *  For example, if the application is initializing a cropping function, the
 *  OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter
 *  and would send a pointer to an initialized OMX_RECTTYPE structure as the
 *  third parameter.
 *
 *  The enumeration entries named with the OMX_Config prefix are sent using
 *  the OMX_SetConfig command and the enumeration entries named with the
 *  OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
 */
typedef enum OMX_INDEXTYPE {

    OMX_IndexComponentStartUnused = 0x01000000,
    OMX_IndexParamPriorityMgmt,             /**< reference: OMX_PRIORITYMGMTTYPE */
    OMX_IndexParamAudioInit,                /**< reference: OMX_PORT_PARAM_TYPE */
    OMX_IndexParamImageInit,                /**< reference: OMX_PORT_PARAM_TYPE */
    OMX_IndexParamVideoInit,                /**< reference: OMX_PORT_PARAM_TYPE */
    OMX_IndexParamOtherInit,                /**< reference: OMX_PORT_PARAM_TYPE */
    OMX_IndexParamNumAvailableStreams,      /**< reference: OMX_PARAM_U32TYPE */
    OMX_IndexParamActiveStream,             /**< reference: OMX_PARAM_U32TYPE */
    OMX_IndexParamSuspensionPolicy,         /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
    OMX_IndexParamComponentSuspended,       /**< reference: OMX_PARAM_SUSPENSIONTYPE */
    OMX_IndexConfigCapturing,               /**< reference: OMX_CONFIG_BOOLEANTYPE */
    OMX_IndexConfigCaptureMode,             /**< reference: OMX_CONFIG_CAPTUREMODETYPE */
    OMX_IndexAutoPauseAfterCapture,         /**< reference: OMX_CONFIG_BOOLEANTYPE */
    OMX_IndexParamContentURI,               /**< reference: OMX_PARAM_CONTENTURITYPE */
    OMX_IndexParamCustomContentPipe,        /**< reference: OMX_PARAM_CONTENTPIPETYPE */
    OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
    OMX_IndexConfigMetadataItemCount,       /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
    OMX_IndexConfigContainerNodeCount,      /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
    OMX_IndexConfigMetadataItem,            /**< reference: OMX_CONFIG_METADATAITEMTYPE */
    OMX_IndexConfigCounterNodeID,           /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
    OMX_IndexParamMetadataFilterType,       /**< reference: OMX_PARAM_METADATAFILTERTYPE */
    OMX_IndexParamMetadataKeyFilter,        /**< reference: OMX_PARAM_METADATAFILTERTYPE */
    OMX_IndexConfigPriorityMgmt,            /**< reference: OMX_PRIORITYMGMTTYPE */
    OMX_IndexParamStandardComponentRole,    /**< reference: OMX_PARAM_COMPONENTROLETYPE */

    OMX_IndexPortStartUnused = 0x02000000,
    OMX_IndexParamPortDefinition,           /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
    OMX_IndexParamCompBufferSupplier,       /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */
    OMX_IndexReservedStartUnused = 0x03000000,

    /* Audio parameters and configurations */
    OMX_IndexAudioStartUnused = 0x04000000,
    OMX_IndexParamAudioPortFormat,          /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
    OMX_IndexParamAudioPcm,                 /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
    OMX_IndexParamAudioAac,                 /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
    OMX_IndexParamAudioRa,                  /**< reference: OMX_AUDIO_PARAM_RATYPE */
    OMX_IndexParamAudioMp3,                 /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
    OMX_IndexParamAudioAdpcm,               /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
    OMX_IndexParamAudioG723,                /**< reference: OMX_AUDIO_PARAM_G723TYPE */
    OMX_IndexParamAudioG729,                /**< reference: OMX_AUDIO_PARAM_G729TYPE */
    OMX_IndexParamAudioAmr,                 /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
    OMX_IndexParamAudioWma,                 /**< reference: OMX_AUDIO_PARAM_WMATYPE */
    OMX_IndexParamAudioSbc,                 /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
    OMX_IndexParamAudioMidi,                /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
    OMX_IndexParamAudioGsm_FR,              /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */
    OMX_IndexParamAudioMidiLoadUserSound,   /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
    OMX_IndexParamAudioG726,                /**< reference: OMX_AUDIO_PARAM_G726TYPE */
    OMX_IndexParamAudioGsm_EFR,             /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
    OMX_IndexParamAudioGsm_HR,              /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
    OMX_IndexParamAudioPdc_FR,              /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
    OMX_IndexParamAudioPdc_EFR,             /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
    OMX_IndexParamAudioPdc_HR,              /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
    OMX_IndexParamAudioTdma_FR,             /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
    OMX_IndexParamAudioTdma_EFR,            /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
    OMX_IndexParamAudioQcelp8,              /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
    OMX_IndexParamAudioQcelp13,             /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
    OMX_IndexParamAudioEvrc,                /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
    OMX_IndexParamAudioSmv,                 /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
    OMX_IndexParamAudioVorbis,              /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
    OMX_IndexParamAudioFlac,                /**< reference: OMX_AUDIO_PARAM_FLACTYPE */

    OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
    OMX_IndexConfigAudioMidiControl,        /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
    OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
    OMX_IndexConfigAudioMidiStatus,         /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
    OMX_IndexConfigAudioMidiMetaEvent,      /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
    OMX_IndexConfigAudioMidiMetaEventData,  /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
    OMX_IndexConfigAudioVolume,             /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
    OMX_IndexConfigAudioBalance,            /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
    OMX_IndexConfigAudioChannelMute,        /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
    OMX_IndexConfigAudioMute,               /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
    OMX_IndexConfigAudioLoudness,           /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
    OMX_IndexConfigAudioEchoCancelation,    /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
    OMX_IndexConfigAudioNoiseReduction,     /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
    OMX_IndexConfigAudioBass,               /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
    OMX_IndexConfigAudioTreble,             /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
    OMX_IndexConfigAudioStereoWidening,     /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
    OMX_IndexConfigAudioChorus,             /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
    OMX_IndexConfigAudioEqualizer,          /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
    OMX_IndexConfigAudioReverberation,      /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
    OMX_IndexConfigAudioChannelVolume,      /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */

    /* Image specific parameters and configurations */
    OMX_IndexImageStartUnused = 0x05000000,
    OMX_IndexParamImagePortFormat,          /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
    OMX_IndexParamFlashControl,             /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
    OMX_IndexConfigFocusControl,            /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
    OMX_IndexParamQFactor,                  /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */
    OMX_IndexParamQuantizationTable,        /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
    OMX_IndexParamHuffmanTable,             /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
    OMX_IndexConfigFlashControl,            /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */

    /* Video specific parameters and configurations */
    OMX_IndexVideoStartUnused = 0x06000000,
    OMX_IndexParamVideoPortFormat,          /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
    OMX_IndexParamVideoQuantization,        /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */
    OMX_IndexParamVideoFastUpdate,          /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
    OMX_IndexParamVideoBitrate,             /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
    OMX_IndexParamVideoMotionVector,        /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
    OMX_IndexParamVideoIntraRefresh,        /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
    OMX_IndexParamVideoErrorCorrection,     /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
    OMX_IndexParamVideoVBSMC,               /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */
    OMX_IndexParamVideoMpeg2,               /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */
    OMX_IndexParamVideoMpeg4,               /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */
    OMX_IndexParamVideoWmv,                 /**< reference: OMX_VIDEO_PARAM_WMVTYPE */
    OMX_IndexParamVideoRv,                  /**< reference: OMX_VIDEO_PARAM_RVTYPE */
    OMX_IndexParamVideoAvc,                 /**< reference: OMX_VIDEO_PARAM_AVCTYPE */
    OMX_IndexParamVideoH263,                /**< reference: OMX_VIDEO_PARAM_H263TYPE */
    OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
    OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
    OMX_IndexConfigVideoBitrate,            /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
    OMX_IndexConfigVideoFramerate,          /**< reference: OMX_CONFIG_FRAMERATETYPE */
    OMX_IndexConfigVideoIntraVOPRefresh,    /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
    OMX_IndexConfigVideoIntraMBRefresh,     /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
    OMX_IndexConfigVideoMBErrorReporting,   /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
    OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
    OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
    OMX_IndexParamVideoSliceFMO,            /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
    OMX_IndexConfigVideoAVCIntraPeriod,     /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
    OMX_IndexConfigVideoNalSize,            /**< reference: OMX_VIDEO_CONFIG_NALSIZE */

    /* Image & Video common Configurations */
    OMX_IndexCommonStartUnused = 0x07000000,
    OMX_IndexParamCommonDeblocking,         /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
    OMX_IndexParamCommonSensorMode,         /**< reference: OMX_PARAM_SENSORMODETYPE */
    OMX_IndexParamCommonInterleave,         /**< reference: OMX_PARAM_INTERLEAVETYPE */
    OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
    OMX_IndexConfigCommonScale,             /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
    OMX_IndexConfigCommonImageFilter,       /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
    OMX_IndexConfigCommonColorEnhancement,  /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
    OMX_IndexConfigCommonColorKey,          /**< reference: OMX_CONFIG_COLORKEYTYPE */
    OMX_IndexConfigCommonColorBlend,        /**< reference: OMX_CONFIG_COLORBLENDTYPE */
    OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */
    OMX_IndexConfigCommonRotate,            /**< reference: OMX_CONFIG_ROTATIONTYPE */
    OMX_IndexConfigCommonMirror,            /**< reference: OMX_CONFIG_MIRRORTYPE */
    OMX_IndexConfigCommonOutputPosition,    /**< reference: OMX_CONFIG_POINTTYPE */
    OMX_IndexConfigCommonInputCrop,         /**< reference: OMX_CONFIG_RECTTYPE */
    OMX_IndexConfigCommonOutputCrop,        /**< reference: OMX_CONFIG_RECTTYPE */
    OMX_IndexConfigCommonDigitalZoom,       /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
    OMX_IndexConfigCommonOpticalZoom,       /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
    OMX_IndexConfigCommonWhiteBalance,      /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
    OMX_IndexConfigCommonExposure,          /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
    OMX_IndexConfigCommonContrast,          /**< reference: OMX_CONFIG_CONTRASTTYPE */
    OMX_IndexConfigCommonBrightness,        /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */
    OMX_IndexConfigCommonBacklight,         /**< reference: OMX_CONFIG_BACKLIGHTTYPE */
    OMX_IndexConfigCommonGamma,             /**< reference: OMX_CONFIG_GAMMATYPE */
    OMX_IndexConfigCommonSaturation,        /**< reference: OMX_CONFIG_SATURATIONTYPE */
    OMX_IndexConfigCommonLightness,         /**< reference: OMX_CONFIG_LIGHTNESSTYPE */
    OMX_IndexConfigCommonExclusionRect,     /**< reference: OMX_CONFIG_RECTTYPE */
    OMX_IndexConfigCommonDithering,         /**< reference: OMX_CONFIG_DITHERTYPE */
    OMX_IndexConfigCommonPlaneBlend,        /**< reference: OMX_CONFIG_PLANEBLENDTYPE */
    OMX_IndexConfigCommonExposureValue,     /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
    OMX_IndexConfigCommonOutputSize,        /**< reference: OMX_FRAMESIZETYPE */
    OMX_IndexParamCommonExtraQuantData,     /**< reference: OMX_OTHER_EXTRADATATYPE */
    OMX_IndexConfigCommonFocusRegion,       /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */
    OMX_IndexConfigCommonFocusStatus,       /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */
    OMX_IndexConfigCommonTransitionEffect,  /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */

    /* Reserved Configuration range */
    OMX_IndexOtherStartUnused = 0x08000000,
    OMX_IndexParamOtherPortFormat,          /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
    OMX_IndexConfigOtherPower,              /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
    OMX_IndexConfigOtherStats,              /**< reference: OMX_OTHER_CONFIG_STATSTYPE */

    /* Reserved Time range */
    OMX_IndexTimeStartUnused = 0x09000000,
    OMX_IndexConfigTimeScale,               /**< reference: OMX_TIME_CONFIG_SCALETYPE */
    OMX_IndexConfigTimeClockState,          /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
    OMX_IndexConfigTimeActiveRefClock,      /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
    OMX_IndexConfigTimeCurrentMediaTime,    /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
    OMX_IndexConfigTimeCurrentWallTime,     /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
    OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
    OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
    OMX_IndexConfigTimeMediaTimeRequest,    /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
    OMX_IndexConfigTimeClientStartTime,     /**<reference:  OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
    OMX_IndexConfigTimePosition,            /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
    OMX_IndexConfigTimeSeekMode,            /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */

    OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
    /* Vendor specific area */
    OMX_IndexVendorStartUnused = 0x7F000000,
    /* Vendor specific structures should be in the range of 0x7F000000
       to 0x7FFFFFFE.  This range is not broken out by vendor, so
       private indexes are not guaranteed unique and therefore should
       only be sent to the appropriate component. */

    OMX_IndexMax = 0x7FFFFFFF

} OMX_INDEXTYPE;

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif
/* File EOF */


text:
#region License and Copyright

#endregion

using System.ComponentModel;
using System.Windows.Forms.Design;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Drawing;
using System;
using Guifreaks.Common;
using System.Collections;
using Guifreaks.Navisuite;

namespace Guifreaks.Design
{
   [ToolboxItemFilterAttribute("System.Windows.Forms", ToolboxItemFilterType.Custom)]
   public class NaviBarDesigner : ParentControlDesigner
   {
      #region Fields

      NaviBar designingControl;
      ISelectionService selectionService;
      IComponentChangeService componentChangeService;
      IDesignerHost host;

      #endregion

      #region Constructor
      #endregion

      #region Properties
      #endregion

      #region Methods

      /// <summary>
      /// Sets the value for a given property
      /// </summary>
      /// <param name="propName">The name of the property</param>
      /// <param name="value">The new value of the property</param>
      private void SetValue(string propName, object value)
      {
         PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(designingControl);
         PropertyDescriptor property = properties.Find(propName, true);
         if (property != null)
         {
            property.SetValue(designingControl, value);
         }
      }

      /// <summary>
      /// Gets the value of a given property
      /// </summary>
      /// <param name="propName">The name of the property</param>
      private object GetValue(string propName)
      {
         PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(designingControl);
         PropertyDescriptor property = properties.Find(propName, true);
         if (property != null)
         {
            return property.GetValue(designingControl);
         }
         else
         {
            return null;
         }
      }

      private void InitializeServices()
      {
         selectionService = GetService(typeof(ISelectionService)) as ISelectionService;
         if (selectionService != null)
         {
            selectionService.SelectionChanged += new System.EventHandler(selectionService_SelectionChanged);
         }

         componentChangeService = GetService(typeof(IComponentChangeService))
            as IComponentChangeService;
         if (componentChangeService != null)
         {
            //componentChangeService.ComponentChanged += new ComponentChangedEventHandler(componentChangeService_ComponentChanged);
         }

         host = (IDesignerHost)GetService(typeof(IDesignerHost));
      }

      private bool HandleClickEvent(int x, int y)
      {
         if (designingControl != null)
         {
            foreach (NaviBand band in designingControl.Bands)
            {
               if ((band.Button != null)
               && (band.Button.Bounds.Contains(x, y)))
               {
                  ArrayList list = new ArrayList();
                  list.Add(band);
                  if (selectionService != null)
                  {
							designingControl.SetActiveBand(
								selectionService.PrimarySelection as NaviBand);
                     selectionService.SetSelectedComponents(list);
                     return true;
                  }
               }
            }
         }
         return false;
      }

      #endregion

      #region Overrides

      public override void Initialize(IComponent component)
      {
         base.Initialize(component);
         designingControl = component as NaviBar;
         InitializeServices();
      }

      public override void InitializeNewComponent(System.Collections.IDictionary defaultValues)
      {
         base.InitializeNewComponent(defaultValues);
      }

      public override DesignerVerbCollection Verbs
      {
         get
         {
            DesignerVerb[] verbs = new DesignerVerb[] {
               new DesignerVerb("Add band..",
                  new EventHandler(AddBandVerbClicked)) };
            return new DesignerVerbCollection(verbs);
         }
      }

      protected override void Dispose(bool disposing)
      {
         base.Dispose(disposing);

         if (selectionService != null)
         {
            selectionService.SelectionChanged -= new System.EventHandler(selectionService_SelectionChanged);
         }
      }

      protected override void WndProc(ref Message m)
      {
         switch (m.Msg)
         {
            case NativeMethods.WM_LBUTTONUP:
               if (!HandleClickEvent(NativeMethods.LoWord(m.LParam),
                  NativeMethods.HiWord(m.LParam)))
               {
                  base.WndProc(ref m);
               }
               break;
            default:
               base.WndProc(ref m);
               break;
         }
      }

      #endregion

      #region Event Handling

      void selectionService_SelectionChanged(object sender, System.EventArgs e)
      {
         if (selectionService.PrimarySelection is NaviBand)
         {
            designingControl.SetActiveBand(
               selectionService.PrimarySelection as NaviBand);
				designingControl.PerformLayout();
         }
      }

      void AddBandVerbClicked(object sender, EventArgs e)
      {
         NaviBand band = host.CreateComponent(typeof(NaviBand)) as NaviBand;
         if (band != null)
         {
            designingControl.Controls.Add(band);
         }
      }

      #endregion
   }
}


text:
/**
 * URL router
 *
 * 2013 (c) Andrey Popp <8mayday@gmail.com>
 */
"use strict";

var toPattern = require('url-pattern');

function Router(routes) {
  this.registered = [];

  if (routes) {
    for (var k in routes) {
      this.addRoute(k, routes[k]);
    }
  }
}

Router.prototype = {

  /**
   * Register a handler for a specified route
   *
   * @param {String} pattern
   * @param {Object} handler
   */
  addRoute: function(pattern, handler) {
    this.registered.push({
      pattern: toPattern(pattern),
      handler: handler
    });
    return this;
  },

  /**
   * Match registered routes against path.
   *
   * @param {String} path
   * @return {Object|undefined}
   */
  match: function(path) {
    for (var i = 0, length = this.registered.length; i < length; i++) {
      var params = this.registered[i].pattern.match(path);
      if (params !== null) {
        return {handler: this.registered[i].handler, params: params};
      }
    }
  }
};

module.exports = function(routes) {
  return new Router(routes);
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>pl.kalisz.kamil</groupId>
    <artifactId>multi-dex-sample</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>multi-dex-sample</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <platform.version>4.1.1.4
        </platform.version>
        <android.plugin.version>4.0.0-SNAPSHOT</android.plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>${android.plugin.version}</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <platform>16</platform>
                    </sdk>
                    <dex>
                        <multi-dex>true</multi-dex>
                        <minimal-main-dex>true</minimal-main-dex>
                        <main-dex-list>${project.basedir}/MainDexList.txt</main-dex-list>
                    </dex>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jarsigner-plugin</artifactId>
                        <version>1.2</version>
                        <executions>
                            <execution>
                                <id>signing</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>package</phase>
                                <inherited>true</inherited>
                                <configuration>
                                    <archiveDirectory></archiveDirectory>
                                    <includes>
                                        <include>target/*.apk</include>
                                    </includes>
                                    <keystore>${project.basedir}/release.jks</keystore>
                                    <storepass>adgjmpadgjmp</storepass>
                                    <keypass>adgjmp</keypass>
                                    <alias>kkalisz</alias>
                                    <arguments>
                                        <argument>-sigalg</argument><argument>MD5withRSA</argument>
                                        <argument>-digestalg</argument><argument>SHA1</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                        <artifactId>android-maven-plugin</artifactId>
                        <inherited>true</inherited>
                        <configuration>
                            <release>true</release>
                            <proguard>
                                <skip>false</skip>
                            </proguard>
                            <sign>
                                <debug>false</debug>
                            </sign>
                            <dex>
                                <multi-dex>true</multi-dex>
                                <minimal-main-dex>true</minimal-main-dex>
                                <main-dex-list>${project.basedir}/MainDexList.txt</main-dex-list>
                            </dex>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>


text:
package org.unitime.timetable.export.solver;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.unitime.timetable.export.ExportHelper;
import org.unitime.timetable.gwt.command.server.GwtRpcImplementation;
import org.unitime.timetable.gwt.shared.CourseTimetablingSolverInterface.NotAssignedClassesFilterRequest;
import org.unitime.timetable.gwt.shared.CourseTimetablingSolverInterface.NotAssignedClassesFilterResponse;
import org.unitime.timetable.gwt.shared.CourseTimetablingSolverInterface.NotAssignedClassesRequest;
import org.unitime.timetable.gwt.shared.CourseTimetablingSolverInterface.NotAssignedClassesResponse;

/**
 * @author Tomas Muller
 */
@Service("org.unitime.timetable.export.Exporter:unassigned-classes.pdf")
public class ExportNotAssignedClassesPDF extends TableExporter {

	@Autowired private ApplicationContext applicationContext;

	@Override
	public String reference() {
		return "unassigned-classes.pdf";
	}

	@Override
	public void export(ExportHelper helper) throws IOException {
		GwtRpcImplementation<NotAssignedClassesFilterRequest, NotAssignedClassesFilterResponse> filterService = (GwtRpcImplementation<NotAssignedClassesFilterRequest, NotAssignedClassesFilterResponse>)applicationContext.getBean(NotAssignedClassesFilterRequest.class.getName());
		NotAssignedClassesFilterResponse filter = filterService.execute(new NotAssignedClassesFilterRequest(), helper.getSessionContext());
		fillInFilter(filter, helper);

		GwtRpcImplementation<NotAssignedClassesRequest, NotAssignedClassesResponse> service = (GwtRpcImplementation<NotAssignedClassesRequest, NotAssignedClassesResponse>)applicationContext.getBean(NotAssignedClassesRequest.class.getName());
		NotAssignedClassesRequest request = new NotAssignedClassesRequest();
		request.setFilter(filter);
		NotAssignedClassesResponse response = service.execute(request, helper.getSessionContext());

		printTablePDF(response, helper);
	}

}


text:
<!-- MarkdownTOC -->

- [Certificate](#certificate)
- [Manually](#manually)
    - [Entitlements](#entitlements)
- [With gon tool](#with-gon-tool)
    - [Signing](#signing)
    - [Notarization](#notarization)

<!-- /MarkdownTOC -->

If you distribute a Mac OS application (*C++, built with CMake*) to another computer, you or rather our users will get the following error on trying to launch it:

![](./unverified-developer.png)

While this can be resolved by removing quarantine attribute:

``` sh
$ xattr /path/to/Some.app
com.apple.quarantine

$ xattr -cr /path/to/Some.app
```

this is not a good UX, and instead it's better to properly [sign and notarize](https://developer.apple.com/news/?id=10032019a) the application.

## Certificate

Go to <https://developer.apple.com/account> and download the/a `Developer ID Application` certificate. If you don't have any yet, add a new one, and make sure that it is exactly of `Developer ID Application` type:

![](./apple-developer-certificates.png)

Follow Apple's instructions on how to create it, as they will be provided going on. When it's done, download and import the certificate into your system keychain (*from which you generated the certificate issuing request*).

The importing needs to be done on all your buildbots too, and since those don't have your keychain, you'll first need to export the certificate and the private key from your keychain into a `.p12` bundle (*and set a password for it, just in case*):

![](./exporting-certificate.png)

Once you have `.p12` bundle, you can import it on a buildbot host like so:

``` sh
$ security import ./buildbot-dev-app.p12 -P HERE-GOES-THE-PASSWORD-YOU-SET-FOR-THE-BUNDLE
```

Check that you have it available now:

``` sh
$ security find-identity -v
  1) 3R25316098208E3PE7B2372C500ADAL442E92PAC "iPhone Distribution: Your Company"
  2) G5PQECV1C0O922L3CFE4K2E3P30E2BF1233E0DDF "Developer ID Application: Your Company (V3VVLOW538)"
     2 valid identities found
```

You might have several ones here, but you'll need to use exactly the one of type `Developer ID Application`.

One more thing you need to do is to allow applications to access this key:

![](./key-access.png)

But despite (*or instead of?*) setting that, you might still need to log-in to the buildbot via VNC and click on `Always allow` in the GUI prompt for the very first time it will try to sign something with this certificate:

![](./keychain-access-prompt.png)

After that it should go to the list of always allowed applications, and perhaps you don't need to switch that "Allow all applications" option:

![](./keychain-codesign.png)

As for the actual signing and notarization, below you will find steps for performing both either manually or with a [gon](https://github.com/mitchellh/gon) tool.

In any case, especially on buildbots, you might need to unlock the keychain (*whichever you're using*), otherwise it will prompt you with GUI dialog:

``` sh
$ security -v unlock-keychain -p KEYCHAIN-PASSWORD "/Library/Keychains/System.keychain"
```

It will automatically lock back after some timeout (*300 seconds by default?*).

## Manually

Why it is important that you choose the right type of the signing certificate. Let's try signing with a wrong type (*"iPhone Distribution"*):

```
$ codesign -s "3R25316098208E3PE7B2372C500ADAL442E92PAC" -f -v --timestamp --options runtime /path/to/install/bin/some.app

/path/to/install/bin/some.app: replacing existing signature
/path/to/install/bin/some.app: signed app bundle with Mach-O thin (x86_64) [com.your-company]
```

Signing happens locally on your machine. Nothing(?) is sent to Apple yet.

Then make a ZIP archive from that application bundle and submit it for notarization:

```
$ xcrun altool --notarize-app --primary-bundle-id com.your-company.some -u "buildbot@your-company.com" -p "BUILDBOT-PASSWORD-HERE" -f ./some.zip --output-format xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>notarization-upload</key>
    <dict>
        <key>RequestUUID</key>
        <string>4b4g5ll4-3bba-42a6-8as1-3l53fddgd54q</string>
    </dict>
    <key>os-version</key>
    <string>11.6.2</string>
    <key>success-message</key>
    <string>No errors uploading 'some.zip'.</string>
    <key>tool-path</key>
    <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
    <key>tool-version</key>
    <string>4.071.1221</string>
</dict>
</plist>
```

This will upload the archive with your application bundle to Apple. Here:

- the `--output-format` can be also `json` or `normal`;
- the `RequestUUID` is how you check the notarization status, because this operation is asynchronous.

To check the status of notarization request:

```
$ xcrun altool --notarization-info 4b4g5ll4-3bba-42a6-8as1-3l53fddgd54q -u "buildbot@your-company.com" -p "BUILDBOT-PASSWORD-HERE" --output-format xml

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>notarization-info</key>
    <dict>
        <key>Date</key>
        <date>2022-01-10T10:23:29Z</date>
        <key>Hash</key>
        <string>115f871e5d43e3eb3lb7a2343lf11893l9611a33d6594ed411027d45l2c26fe4</string>
        <key>LogFileURL</key>
        <string>https://osxapps-ssl.itunes.apple.com/itunes-assets/REPORT-ID-AND-OTHER-THINGS</string>
        <key>RequestUUID</key>
        <string>4b4g5ll4-3bba-42a6-8as1-3l53fddgd54q</string>
        <key>Status</key>
        <string>invalid</string>
        <key>Status Code</key>
        <integer>2</integer>
        <key>Status Message</key>
        <string>Package Invalid</string>
    </dict>
    <key>os-version</key>
    <string>11.6.2</string>
    <key>success-message</key>
    <string>No errors getting notarization info.</string>
    <key>tool-path</key>
    <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>
    <key>tool-version</key>
    <string>4.071.1221</string>
</dict>
</plist>
```

So it is invalid. More details can be found in `LogFileURL` document:

```
{
  "logFormatVersion": 1,
  "jobId": "4b4g5ll4-3bba-42a6-8as1-3l53fddgd54q",
  "status": "Invalid",
  "statusSummary": "Archive contains critical validation errors",
  "statusCode": 4000,
  "archiveFilename": "some.zip",
  "uploadDate": "2022-01-10T10:23:29Z",
  "sha256": "115f871e5d43e3eb3lb7a2343lf11893l9611a33d6594ed411027d45l2c26fe4",
  "ticketContents": null,
  "issues": [
    {
      "severity": "error",
      "code": null,
      "path": "some.zip/Contents/MacOS/some",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    }
  ]
}
```

So you do need to use the right type of certificate.

Another error you can get is this one:

```
*** Error: Server returned an invalid MIME type: text/html, body:
<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        body {
            font-family: "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif;
            font-size: 15px;
            font-weight: 200;
            line-height: 20px;
            color: #4c4c4c;
            text-align: center;
        }

        .section {
            margin-top: 50px;
        }
    </style>
</head>
<body>
<div class="section">
    <h1></h1>

    <h3>Gateway Timeout</h3>
    <p>Correlation Key: LQP356U33OIGNWWGWM3HUQTSE3</p>
</div>
</body>
</html>

*** Error: Failed to get notarization info.
*** Error: Failed to get notarization info. Failed to get authorization for username 'buildbot@your-company.com' and password. (
    "Error Domain=NSCocoaErrorDomain Code=0 \"Status code: 0\" UserInfo={NSLocalizedDescription=Status code: 0, NSLocalizedFailureReason=The auth server returned a bad status code.}"
) (-1011)
 {
    NSLocalizedDescription = "Failed to get notarization info.";
    NSLocalizedFailureReason = "Failed to get authorization for username 'buildbot@your-company.com' and password. (\n    \"Error Domain=NSCocoaErrorDomain Code=0 \\\"Status code: 0\\\" UserInfo={NSLocalizedDescription=Status code: 0, NSLocalizedFailureReason=The auth server returned a bad status code.}\"\n)";
}
```

This is an internal Apple problem (*Gateway Timeout*), so just repeat your request.

Successful notarization result will look like this:

```
No errors getting notarization info.

          Date: 2022-01-10 11:02:59 +0000
          Hash: deaf7bae75e02d35932605dafff9035ae98d78f0690c2d6f15da0e3406475f38
    LogFileURL: https://osxapps-ssl.itunes.apple.com/itunes-assets/REPORT-ID-AND-OTHER-THINGS
   RequestUUID: 0l5faf9f-5520-pfbc-82l6-8d3px73a229b
        Status: success
   Status Code: 0
Status Message: Package Approved
```

Now the application is ready for distribution. Its signature can be checked like this on the target machine:

```
$ codesign -vv /path/to/some.app
/path/to/some.app: valid on disk
/path/to/some.app: satisfies its Designated Requirement

$ spctl --verbose --assess --type execute -v /path/to/some.app
/path/to/some.app: accepted
source=Notarized Developer ID
origin=Developer ID Application: Your Company (V3VVLOW538)
```

### Entitlements

Applications can have entitlements. Not sure those are actually needed though, because here are examples of some applications already installed and working fine without any entitlements set:

``` sh
$ codesign -d --entitlements - ~/Applications/Chromium.app
Executable=/Users/vasya/Applications/Chromium.app/Contents/MacOS/Chromium

$ codesign -d --entitlements - ~/Applications/Sublime\ Text.app
Executable=/Users/vasya/Applications/Sublime Text.app/Contents/MacOS/sublime_text

$ codesign -d --entitlements - ~/Applications/Sublime\ Merge.app
Executable=/Users/vasya/Applications/Sublime Merge.app/Contents/MacOS/sublime_merge
```

Some applications, however, do have entitlements set:

``` sh
$ codesign -d --entitlements - ~/Applications/VLC.app
Executable=/Users/vasya/Applications/VLC.app/Contents/MacOS/VLC
��qq�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.automation.apple-events</key>
    <true/>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
    <key>com.apple.security.device.audio-input</key>
    <true/>
    <key>com.apple.security.device.camera</key>
    <true/>
</dict>
</plist>

$ codesign -d --entitlements - ~/Applications/IINA.app
Executable=/Users/vasya/Applications/IINA.app/Contents/MacOS/IINA
��qq?<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
</dict>
</plist>

$ codesign -d --entitlements - ~/Applications/Qt\ Creator.app
Executable=/Users/vasya/Applications/Qt Creator.app/Contents/MacOS/Qt Creator
��qqE<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>com.apple.security.cs.debugger</key>
        <true/>
        <key>com.apple.security.cs.disable-library-validation</key>
        <true/>
        <key>com.apple.security.cs.allow-jit</key>
        <true/>
        <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
        <true/>
        <key>com.apple.security.automation.apple-events</key>
        <true/>
</dict>
</plist>

$ codesign -d --entitlements - ~/Applications/Paw.app
Executable=/Users/vasya/Applications/Paw.app/Contents/MacOS/Paw
��qq}<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.files.bookmarks.app-scope</key>
    <true/>
    <key>com.apple.security.files.bookmarks.collection-scope</key>
    <true/>
    <key>com.apple.security.files.bookmarks.document-scope</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
</dict>
</plist>
```

If you'd like to add entitlements to your application, it can be done in Xcode (*with Xcode project file generated by CMake*):

![](./xcode-entitlements.png)

which is equivalent to just creating an XML file (`some.entitlements`) like this:

``` xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.automation.apple-events</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-only</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
</dict>
</plist>
```

To apply these entitlements to your application on signing, add `--entitlements ./some.entitlements` on signing:

``` sh
$ codesign -s "3R25316098208E3PE7B2372C500ADAL442E92PAC" --entitlements ./some.entitlements -f -v --timestamp --options runtime /path/to/install/bin/some.app
```

Check your application entitlements now:

``` sh
$ codesign -d --entitlements - /path/to/install/bin/some.app
Executable=/path/to/install/bin/some.app/Contents/MacOS/some
��qq�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.automation.apple-events</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-only</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
</dict>
</plist>
```

...And I didn't see any difference: with or without adding these entitlements my application works equally fine - it can read files from disk and it can make network connections and fetch remote resources.

## With gon tool

All the same steps [from above](#manually) can be executed with just one line [using gon tool](https://github.com/mitchellh/gon/blob/master/README.md), and that will also include automatic querying Apple server for notarization status until it's ready. And while it is convenient, I'd still recommended to go with the manual steps described above.

If you decided to use `gon` tool, it can be installed with Homebrew:

``` sh
$ brew tap mitchellh/gon
$ brew install mitchellh/gon/gon
```

### Signing

Create `conf-sign.json` config:

``` json
{
    "source" : ["/path/to/some.app"],
    "bundle_id" : "com.your-company.some",
    "apple_id": {
        "username": "buildbot@your-company.com",
        "password": "BUILDBOT-PASSWORD-HERE"
    },
    "sign" :{
        "application_identity" : "G5PQECV1C0O922L3CFE4K2E3P30E2BF1233E0DDF"
    },
    "zip" :{
        "output_path" : "some.zip"
    }
}
```

The `application_identity` value is the `Developer ID Application` certificate ID.

Now run:

``` sh
$ gon -log-level=info ./conf-sign.json
```

### Notarization

Apparently, this is already done in signing, so separate notarization might not be needed. If it is needed, then create `conf-notarize.json` config:

``` json
{
  "notarize": [{
    "path": "/path/to/some.zip",
    "bundle_id": "com.your-company.some",
    "staple": true
  }],
  "apple_id": {
     "username": "buildbot@your-company.com",
     "password": "BUILDBOT-PASSWORD-HERE"
  }
}
```

And run:

``` sh
$ gon -log-level=info ./conf-notarize.json
```


text:
<?php

/**
 * @file
 * Contains \Drupal\migrate_drupal\Plugin\migrate\process\d6\ProfileFieldSettings.
 */

namespace Drupal\migrate_drupal\Plugin\migrate\process\d6;

use Drupal\migrate\MigrateExecutable;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;

/**
 * @MigrateProcessPlugin(
 *   id = "d6_profile_field_settings"
 * )
 */
class ProfileFieldSettings extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   *
   * Set the profile field settings configuration.
   */
  public function transform($type, MigrateExecutable $migrate_executable, Row $row, $destination_property) {
    $settings = array();
    switch ($type) {
      case 'date':
        $settings['datetime_type'] = 'date';
        break;
    }
    return $settings;
  }

}


text:
/*	$NetBSD: uvm_object.h,v 1.6 1999/03/25 18:48:53 mrg Exp $	*/

/*
 *
 * Copyright (c) 1997 Charles D. Cranor and Washington University.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by Charles D. Cranor and
 *      Washington University.
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * from: Id: uvm_object.h,v 1.1.2.2 1998/01/04 22:44:51 chuck Exp
 */

#ifndef _UVM_UVM_OBJECT_H_
#define _UVM_UVM_OBJECT_H_

/*
 * uvm_object.h
 */

/*
 * uvm_object: all that is left of mach objects.
 */

struct uvm_object {
	simple_lock_data_t	vmobjlock;	/* lock on memq */
	struct uvm_pagerops	*pgops;		/* pager ops */
	struct pglist		memq;		/* pages in this object */
	int			uo_npages;	/* # of pages in memq */
	int			uo_refs;	/* reference count */
};

/*
 * UVM_OBJ_KERN is a 'special' uo_refs value which indicates that the
 * object is a kernel memory object rather than a normal one (kernel
 * memory objects don't have reference counts -- they never die).
 *
 * this value is used to detected kernel object mappings at uvm_unmap()
 * time.   normally when an object is unmapped its pages eventaully become
 * deactivated and then paged out and/or freed.    this is not useful
 * for kernel objects... when a kernel object is unmapped we always want
 * to free the resources associated with the mapping.   UVM_OBJ_KERN
 * allows us to decide which type of unmapping we want to do.
 */
#define UVM_OBJ_KERN	(-2)

#endif /* _UVM_UVM_OBJECT_H_ */


text:
<?php namespace Auth0\Login;

/**
 * This class represents a generic user initialized with the user information
 * given by Auth0 and provides a way to access to the user profile.
 *
 */
class Auth0User implements \Illuminate\Contracts\Auth\Authenticatable {

    private $userInfo;
    private $accessToken;
    function __construct ($userInfo, $accessToken) {
        $this->userInfo = $userInfo;
        $this->accessToken = $accessToken;
    }
    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier() {
        return $this->userInfo["user_id"];
    }

    /**
     * Get id field name.
     *
     * @return string
     */
    public function getAuthIdentifierName() {
        return 'id';
    }

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword() {
        return $this->accessToken;
    }

    public function getRememberToken() {
        return null;
    }

    public function setRememberToken($value) {

    }

    public function getRememberTokenName() {
        return null;
    }

    /**
     * Add a generic getter to get all the properties of the userInfo
     *
     * @return the related value or null if it is not set
     */
    public function __get($name) {

        if (!array_key_exists($name, $this->userInfo)) {
            return null;
        }

        return $this->userInfo[$name];
    }

    public function getUserInfo() {
        return $this->userInfo;
    }

}


text:
  Héberville est
       un village
       situé dans le département de Seine-Maritime en Haute-Normandie. Elle comptait 116 habitants en 2008.

Si vous pensez demenager à Héberville, vous pourrez aisément trouver une maison à vendre.

Le parc de logements, à Héberville, se décomposait en 2011 en zero appartements et 61 maisons soit
 un marché plutôt équilibré.

À proximité de Héberville sont positionnées géographiquement les communes de
Sainte-Colombe à 3 km, 202 habitants,
Ermenouville située à 2 km, 155 habitants,
Bourville à 2 km, 291 habitants,
Orival localisée à 3 km, 970 habitants,
Bénesville localisée à 3 km, 164 habitants,
Houdetot localisée à 3 km, 158 habitants,
 entre autres. De plus, Héberville est située à seulement 26 km de Dieppe.


text:
require "rails_helper"

RSpec.feature "Check roles section - " do

  before do
    # User
    @user = User.new(username: "user", email: "user@fsi.de", password: "massick", roles: "user")
    @user.confirmed_at = Date.today
    @user.save

    # Moderator
    @moderator = User.new(username: "moderator", email: "moderator@fsi.de", password: "massick", roles: "moderator")
    @moderator.confirmed_at = Date.today
    @moderator.save

    # Admin
    @admin = User.new(username: "admin", email: "admin@fsi.de", password: "massick", roles: "admin")
    @admin.confirmed_at = Date.today
    @admin.save
    visit "/"
    click_link "Login"
    fill_in "Email", with: @admin.email
    fill_in "Password", with: @admin.password
    click_button "Sign in"
  end

  scenario "Visit Admin User Section" do
    visit "/"
    click_link "User"
    expect(page.current_path).to eq(admin_users_path)
    expect(User.all.count).to eq(3)
    expect(page).to have_link("Edit")
    expect(page).to have_link("Delete")
  end

  scenario "Change User to Moderator" do
    visit "/admin/users/#{@user.id}/edit"
   # find(:select, 'user_roles').first(:option, 'moderator').click
    find('select#user_roles').find("option[value='user']").select_option
    click_button('Update User')
    expect(page).to have_content("User was successfully updated.")
    expect(page.current_path).to eq(admin_users_path)
  end

end

RSpec.feature "Check delete user - " do
  before do
    # Admin
    @admin = User.new(username: "admin", email: "admin@fsi.de", password: "massick", roles: "admin")
    @admin.confirmed_at = Date.today
    @admin.save
    visit "/"
    click_link "Login"
    fill_in "Email", with: @admin.email
    fill_in "Password", with: @admin.password
    click_button "Sign in"
  end

  scenario "Remove Moderator and User" do
    visit "/admin/users/#{@admin.id}"
    click_link("Delete")
  end

end


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34014
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace EConnectApi.Properties {

    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
    public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default {
            get {
                return defaultInstance;
            }
        }

        [global::System.Configuration.ApplicationScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("https://platform.everbinding.nl/api/requesttoken")]
        public string EndPointRequestToken {
            get {
                return ((string)(this["EndPointRequestToken"]));
            }
        }

        [global::System.Configuration.ApplicationScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("platform.everbinding.nl")]
        public string Realm {
            get {
                return ((string)(this["Realm"]));
            }
        }

        [global::System.Configuration.ApplicationScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("https://platform.everbinding.nl/api/accesstoken")]
        public string EndPointAccessToken {
            get {
                return ((string)(this["EndPointAccessToken"]));
            }
        }

        [global::System.Configuration.ApplicationScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("https://platform.everbinding.nl/api/accessresource")]
        public string EndPointAccessResource {
            get {
                return ((string)(this["EndPointAccessResource"]));
            }
        }

        [global::System.Configuration.ApplicationScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("Unused")]
        public string Verifier {
            get {
                return ((string)(this["Verifier"]));
            }
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace Zegeger.Decal.Plugins.ZChatSystem
{
    internal class Logging
    {
        private static string tracingLogFile;
        private static string errorLogFile;
        private static System.IO.StreamWriter sw;

        internal static bool TracingOn;

        internal static void initLogging(string TracingPath)
        {
            string tracingFileName, errorFileName;
            TracingOn = true;
            tracingFileName = TracingPath + "ZChatSystemTraceLog.txt";
            errorFileName = TracingPath + "ZChatSystemErrorLog.txt";
            tracingLogFile = getFileName(tracingFileName, 0);
            errorLogFile = getFileName(errorFileName, 0);
            startTracing();
            sw = new System.IO.StreamWriter(tracingLogFile, true);
        }

        internal static void destroyLogging()
        {
            sw.Close();
            sw = null;
        }

        private static string getFileName(string filename, int count)
        {
            if (count == 0)
            {
                if (IsFileLocked(new FileInfo(filename)))
                {
                    return getFileName(filename, 1);
                }
                else
                {
                    return filename;
                }
            }
            else
            {
                if (IsFileLocked(new FileInfo(filename.Substring(0, filename.Length - 4) + count + ".txt")))
                {
                    return getFileName(filename, count + 1);
                }
                else
                {
                    return filename.Substring(0, filename.Length - 4) + count + ".txt";
                }
            }
        }

        private static void startTracing()
        {
            System.IO.StreamWriter sw = new System.IO.StreamWriter(tracingLogFile, false);
            sw.WriteLine(DateTime.Now.ToString() + " - PLUGIN STARTUP");
            sw.Close();
        }

        [ Conditional("TRACE") ]
        internal static void LogTracing(string message)
        {
            if (TracingOn)
            {
                StackFrame sf = new StackFrame(1, false);
                //System.IO.StreamWriter sw = new System.IO.StreamWriter(tracingLogFile, true);
                sw.WriteLine("[T]" + DateTime.Now.ToString("M/d/yyyy HH:mm:ss:fff") + " - " + sf.GetMethod() + " - " + message);
                sw.Flush();
                //PluginCore.wtcwt(DateTime.Now.ToString() + " - " + sf.GetMethod() + " - " + message);
            }
        }

        [Conditional("TRACE")]
        private static void LogErrorToTrace(string message, string source)
        {
            if (TracingOn)
            {
                sw.WriteLine("[E]" + DateTime.Now.ToString("M/d/yyyy HH:mm:ss:fff") + " - " + source + " - " + message);
                sw.Flush();
            }
        }

        [Conditional("PERF")]
        internal static void LogPerfToTrace(string message)
        {
            sw.WriteLine("[P]" + DateTime.Now.ToString("M/d/yyyy HH:mm:ss:fff") + " - " + message);
            sw.Flush();
        }

        internal static void LogError(Exception ex)
        {
            System.IO.StreamWriter ew = new System.IO.StreamWriter(errorLogFile, true);
            ew.WriteLine("============================================================================");
            ew.WriteLine(DateTime.Now.ToString("M/d/yyyy HH:mm:ss:fff"));
            ew.WriteLine("Error: " + ex.Message);
            ew.WriteLine("Source: " + ex.Source);
            ew.WriteLine("Stack: " + ex.StackTrace);
            if (ex.InnerException != null)
            {
                ew.WriteLine("Inner: " + ex.InnerException.Message);
                ew.WriteLine("Inner Stack: " + ex.InnerException.StackTrace);
            }
            ew.WriteLine("============================================================================");
            ew.WriteLine("");
            ew.Close();
            LogErrorToTrace(ex.Message, ex.Source);
        }

        protected static bool IsFileLocked(FileInfo file)
        {
            FileStream stream = null;

            try
            {
                stream = file.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
            }
            catch (IOException)
            {
                //the file is unavailable because it is:
                //still being written to
                //or being processed by another thread
                //or does not exist (has already been processed)
                return true;
            }
            finally
            {
                if (stream != null)
                    stream.Close();
            }

            //file is not locked
            return false;
        }

    }
}