WIP: Adjust Cockpit manifest order

Increase order priority so that Welder does not appear as the first
thing in the top menu bar, even before Cockpit's own dashboard.
Also drop erroneous tab character.

At some point we also need to decide about the "Welder" name, which doesn't appear anywhere else in the UI; maybe change it to "Composer"?

This test failure is certainly unrelated to my change here:
 FAIL  test/test_editRecipe.js (64.333s)
  ● Edit Recipe Page › Single Word Recipe Name Scenario › Save Recipe Test #acceptance › should have toast notification pop up when Save button clicked @edit-recipe-page

    Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

Is that "expected"? Can the test be retried?

This happened a second time, thus for some curious reason this test is influenced by the order of the dashboards. I'll need to investigate this, setting as "work in progress" for now.

I actually do get a crash when I try to save a recipe, I filed this as issue #145. Just not sure why this doesn't happen in my other PRs.

Codecov Report

Merging #142 into master will decrease coverage by 0.48%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
- Coverage   40.54%   40.06%   -0.49%
==========================================
  Files          76       76
  Lines        2222     2234      +12
  Branches      291      291
==========================================
- Hits          901      895       -6
- Misses       1121     1137      +16
- Partials      200      202       +2

Impacted Files
Coverage Δ

core/utils.js
60% <0%> (-20%)
:arrow_down:

core/sagas/modals.js
60% <0%> (-9.24%)
:arrow_down:

core/sagas/recipes.js
31.25% <0%> (-5.34%)
:arrow_down:

core/sagas/inputs.js
39.13% <0%> (-3.73%)
:arrow_down:

core/sagas/users.js
12.5% <0%> (-1.79%)
:arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f29dc9d...a8dfb75. Read the comment docs.

I can't reproduce this crash locally, and it indeed seems to be a flake - a test retry (via force push) now worked.


Fix tornado version in gremlin-release dependencies

Summary of Changes
Fix tornado version to 4.5.3, which is the last compatible version with the other gremlin dependencies.
From version 5.0.0 the following multithreading issues arise: https://github.com/tornadoweb/tornado/issues/2308
Tests

Documentation

CheckList
Make sure you have checked all steps below to ensure a timely review.

[ ] PR title addresses the issue accurately and concisely. Example: "Updates the version of Flask to v1.0.2"

In case you are adding a dependency, check if the license complies with the ASF 3rd Party License Policy.

[ ] PR includes a summary of changes.
[ ] PR adds unit tests, updates existing unit tests, OR documents why no test additions or modifications are needed.
[ ] In case of new functionality, my PR adds documentation that describes how to use it.

All the public functions and the classes in the PR contain docstrings that explain what it does

Closing as was meant to be merged on a fork of this project. Once fully tested a PR here will be opened.


Encounter NullReferenceException Second Time Gl.Control Window is Opened

I am using OpenGL.Net to display a video stream using the OpenGL.Net.WinForms GlControl.  When I open the form window the first time everything works great.  However the second time I open the window I get the NullReferenceException shown in the screen capture.  I'm not sure why I am encountering the exception.  Is it a problem in my code (shown) or a bug in OpenGL.Net? Thanks!

`
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Threading;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using OpenGL;
/// <summary>
/// Class:
///     OpenGLNetWindowWriter : MediaWindow : MediaOutput : MediaAct
///
/// </summary>
/// <remarks>
/// Thread Safe: Class executes on multiple threads. Constructor executes on calling application
///              thread. A MediaIOThread is created and run from this class.
///              See individual methods.
/// </remarks>
public class OpenGLNetWindowWriter : MediaWindow
{

    //private static double usPerTick = (double)(1000 * 1000) / (double)Stopwatch.Frequency;

    /// <summary>
    /// Writes video frames to a window using a SimpleOpenGlControl (Tao OpenGL).
    /// </summary>
    /// <remarks>
    /// Thread Safe: Yes, designed to be called from the main application thread.
    /// </remarks>
    public OpenGLNetWindowWriter()
    {
        MediaActThread = new OpenGLNetWindowWriterMediaIOThread("OpenGL.Net Window Writer", this, ThreadPriority.AboveNormal);
    }

    /// <summary>
    /// Open the media act (parameters must be set before opening).
    /// </summary>
    /// <Param Name="timeTicks">Open time (in ticks).</Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - Yes
    /// </remarks>
    internal override void ActOpen(long timeTicks, VideoMedia video, AudioMedia audio, MediaScript.ActionEnum action)
    {
        if (!ActOpened)
        {
            videoSizeRatio = (double)video.VideoSize.Width / (double)video.VideoSize.Height;
            windowSize = new Size(video.VideoSize.Width, video.VideoSize.Height);
            windowLocation = new Point(0, 0);   // #### should be passed in?

            base.ActOpen(timeTicks, video, audio, action);
        }
    }

    /// <summary>
    /// Show the window by setting window state to normal (it starts out minimized).
    /// </summary>
    /// <Param Name=""></Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - Yes, designed to be called from the main application thread.
    /// </remarks>
    private delegate void showDelegate();
    public override void Show()
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;
        if (openGLNetWindowThread.containerForm.InvokeRequired)
            openGLNetWindowThread.containerForm.BeginInvoke(new showDelegate(SetWindowState));
        else
            SetWindowState();
    }

    private void SetWindowState()
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;
        if (openGLNetWindowThread.containerForm != null)
            openGLNetWindowThread.containerForm.WindowState = FormWindowState.Normal;
    }

    /// <summary>
    /// Set the size of the window, set the video frame size to fit in the window (scale to maintain aspect ratio).
    /// </summary>
    /// <Param Name="size"> New size of window.</Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - Yes, intended to be called from the main app thread.
    /// </remarks>
    private delegate void setClientSizeDelegate(Size size);
    public override void SetSize(Size size)
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;
        if (openGLNetWindowThread.containerForm != null)
            if (openGLNetWindowThread.containerForm.InvokeRequired)
                openGLNetWindowThread.containerForm.BeginInvoke(new setClientSizeDelegate(SetClientSize), size);
            else
                SetClientSize(size);
    }

    /// <summary>
    /// Set the size of the window, set the video frame size to fit in the window (scale to maintain aspect ratio).
    /// </summary>
    /// <Param Name="size"> New size of window.</Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread).
    /// </remarks>
    private void SetClientSize(Size size)
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;

        if (openGLNetWindowThread.containerForm != null)
        {
            Size videoSize = size;
            Point videoLocation = new System.Drawing.Point(0, 0);
            windowSize = size;
            openGLNetWindowThread.containerForm.ClientSize = size;

            // keep video size perportional to captured video size
            double windowSizeRatio = (double)size.Width / (double)size.Height;
            if (windowSizeRatio > videoSizeRatio)
            {
                videoSize.Width = (int)((double)size.Height * videoSizeRatio);          // scale video size by height
                videoLocation = new Point((size.Width - videoSize.Width) / 2, 0);       // center video in window
            }
            else if (windowSizeRatio < videoSizeRatio)
            {
                videoSize.Height = (int)((double)size.Width / videoSizeRatio);          // scale video size by width
                videoLocation = new Point(0, (size.Height - videoSize.Height) / 2);       // center video in window
            }

            OpenGL.GlControl openGlControl = openGLNetWindowThread.windowControl as OpenGL.GlControl;
            openGlControl.Size = videoSize;
            openGlControl.Location = videoLocation;
        }

    }

    /// <summary>
    /// Set the screen location of the window.
    /// </summary>
    /// <Param Name="location"> New screen location of window.</Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - Yes, intended to be called from the main application thread.
    /// </remarks>
    private delegate void setClientLocationDelegate(Point location);
    public override void SetLocation(Point location)
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;

        if (openGLNetWindowThread.containerForm != null)
            if (openGLNetWindowThread.containerForm.InvokeRequired)
                openGLNetWindowThread.containerForm.BeginInvoke(new setClientLocationDelegate(SetClientLocation), location);
            else
                SetClientLocation(location);
    }

    /// <summary>
    /// Set the screen location of the window.
    /// </summary>
    /// <Param Name="location"> New screen location of window.</Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread).
    /// </remarks>
    private void SetClientLocation(Point location)
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;

        if (openGLNetWindowThread.containerForm != null)
        {
            windowLocation = location;
            openGLNetWindowThread.containerForm.Location = location;
        }
    }

    /// <summary>
    /// Set window focus.
    /// </summary>
    /// <Param Name=""></Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - Yes, intended to be called from the main application thread.
    /// </remarks>
    private delegate void setWindowFocusDelegate();
    public override void SetWindowFocus()
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;

        if (openGLNetWindowThread.containerForm != null)
            if (openGLNetWindowThread.containerForm.InvokeRequired)
                openGLNetWindowThread.containerForm.BeginInvoke(new setWindowFocusDelegate(SetFocus));
            else
                SetFocus();
    }

    /// <summary>
    /// Set window focus, bring window to top of z-order.
    /// </summary>
    /// <Param Name=""></Param>
    /// <returns></returns>
    /// <remarks>
    /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread).
    /// </remarks>
    private void SetFocus()
    {
        OpenGLNetWindowWriterMediaIOThread openGLNetWindowThread = MediaActThread as OpenGLNetWindowWriterMediaIOThread;
        //System.Diagnostics.Debug.WriteLine("2) openGLNetWindowThread.SetFocus() " + openGLNetWindowThread.containerForm.WindowState.ToString());
        if (openGLNetWindowThread.containerForm != null)
        {
            openGLNetWindowThread.containerForm.TopMost = true;
            openGLNetWindowThread.containerForm.Refresh();
            openGLNetWindowThread.containerForm.TopMost = false;
        }
    }

    /// <summary>
    ///     Class:      OpenGLNetWindowWriterMediaIOThread : MediaIOThread : MediaThread
    ///
    ///
    ///
    ///
    /// </summary>

    internal class OpenGLNetWindowWriterMediaIOThread : MediaIOThread, IDisposable
    {
        public Control windowControl;
        public Form containerForm;
        private DeviceContext deviceContext;
        private IntPtr renderContext;
        private bool disposed = false;
        private bool delayedStorageCleanup = false;

        public OpenGLNetWindowWriterMediaIOThread(string threadName, MediaAct parent, ThreadPriority priority)
            : base(threadName, parent, priority)
        {
            containerForm = null;
            windowControl = null;
            deviceContext = null;
            renderContext = IntPtr.Zero;
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
                return;

            if (disposing)
            {
                // dispose managed resources
                StopProcessing();
            }
            disposed = true;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        /// <summary>
        /// Windows message loop thread.
        /// </summary>
        /// <Param Name=""></Param>
        /// <returns>This method does not return until the Media is closed (Windows form is closed).</returns>
        /// <remarks>
        /// Thead Safe - No, designed to be called from the MediaAct thread.
        /// </remarks>
        protected void WindowsMessageLoop()
        {
            StartProcessing();
        }

        /// <summary>
        /// Open MediaAct media, create windows form, OpenGL.Net windows control, and start Windows message loop thread.
        /// </summary>
        /// <Param Name=""></Param>
        /// <returns>This method does not return until the Media is closed (Windows form is closed).</returns>
        /// <remarks>
        /// Thead Safe - No, designed to be called from the MediaAct thread.
        /// </remarks>
        protected override bool StartProcessing()
        {
            bool success = false;

            try
            {
                OpenGLNetWindowWriter OpenGLNetWindowWriter = ParentMediaAct as OpenGLNetWindowWriter;

                Application.EnableVisualStyles();
                containerForm = new Form();                     // create form as a container for the Open Gl Window

                containerForm.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
                containerForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                containerForm.ControlBox = false;
                containerForm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
                containerForm.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
                containerForm.Margin = new System.Windows.Forms.Padding(0);
                containerForm.ShowIcon = false;
                containerForm.ShowInTaskbar = false;
                containerForm.ClientSize = OpenGLNetWindowWriter.windowSize;
                containerForm.Location = OpenGLNetWindowWriter.windowLocation;
                containerForm.AutoScaleMode = AutoScaleMode.None;
                containerForm.Cursor = Cursors.Default;
                containerForm.WindowState = FormWindowState.Minimized;
                containerForm.Load += new EventHandler(containerForm_Load);

                // start a windows message loop
                Application.Run(containerForm);

                // Windows message loop does NOT exit until the form is closed

                success = true;
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("OpenGLNetWindowWriter :" + e.ToString());
            }

            return success;
        }

        /// <summary>
        /// Form load event of the MediaAct thread, used to send MediaAct initialized event.
        /// </summary>
        /// <Param Name=""></Param>
        /// <returns></returns>
        /// <remarks>
        /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread).
        /// </remarks>
        protected void containerForm_Load(object sender, EventArgs e)
        {
            OpenGLNetWindowWriter OpenGLNetWindowWriter = ParentMediaAct as OpenGLNetWindowWriter;

            windowControl = new OpenGL.GlControl();
            OpenGL.GlControl openGlControl = windowControl as OpenGL.GlControl;
            openGlControl.BackColor = System.Drawing.Color.Black;
            openGlControl.Location = new System.Drawing.Point(0, 0);
            openGlControl.Name = "MediaWindowWriter";
            openGlControl.Size = new Size(OpenGLNetWindowWriter.windowSize.Width, OpenGLNetWindowWriter.windowSize.Height);
            openGlControl.AutoScaleMode = AutoScaleMode.None;
            openGlControl.BorderStyle = BorderStyle.None;
            openGlControl.TabStop = false;
            //openGlControl.MouseDown += new System.Windows.Forms.MouseEventHandler(openGlControl_MouseDown);
            //openGlControl.MouseMove += new System.Windows.Forms.MouseEventHandler(openGlControl_MouseMove);
            //openGlControl.MouseUp += new System.Windows.Forms.MouseEventHandler(openGlControl_MouseUp);
            //openGlControl.MouseLeave += new System.EventHandler(openGlControl_MouseLeave);
            openGlControl.MouseClick += new System.Windows.Forms.MouseEventHandler(openGlControl_MouseClick);
            openGlControl.MouseWheel += new System.Windows.Forms.MouseEventHandler(openGlControl_MouseWheel);
            openGlControl.ContextCreated += new EventHandler<GlControlEventArgs>(containerForm_ContextCreated);

            containerForm.Controls.Add(openGlControl);

            OpenGLNetWindowWriter.ActOpened = true;
            OpenGLNetWindowWriter.SendOpenedEvent();
        }

        /// <summary>
        /// OpenGL context created event of the MediaAct thread.
        /// </summary>
        /// <Param Name=""></Param>
        /// <returns></returns>
        /// <remarks>
        /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread).
        /// </remarks>
        protected void containerForm_ContextCreated(object sender, GlControlEventArgs e)
        {
            deviceContext = e.DeviceContext;
            renderContext = e.RenderContext;
            System.Diagnostics.Debug.WriteLine("Context created");
        }

        /// <summary>
        /// OpenGL.Net control mouse click event, send event (back to main application).
        /// </summary>
        /// <Param Name=""></Param>
        /// <returns></returns>
        /// <remarks>
        /// Thead Safe - Yes
        /// </remarks>
        private void openGlControl_MouseClick(object sender, MouseEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine("openGTKControl_MouseClick()");
            OpenGLNetWindowWriter OpenGLNetWindowWriter = ParentMediaAct as OpenGLNetWindowWriter;
            OpenGLNetWindowWriter.SendWindowMouseClickEvent(e);
        }

        /// <summary>
        /// OpenGL.Net control mouse wheel event, send event (back to main application).
        /// </summary>
        /// <Param Name=""></Param>
        /// <returns></returns>
        /// <remarks>
        /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread).
        /// </remarks>
        private void openGlControl_MouseWheel(object sender, MouseEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine("openGlControl_MouseWheel()");
            OpenGLNetWindowWriter OpenGLNetWindowWriter = ParentMediaAct as OpenGLNetWindowWriter;
            OpenGLNetWindowWriter.SendWindowMouseWheelEvent(e);
        }

        /// <summary>
        /// CloseMedia
        /// </summary>
        /// <Param Name=""></Param>
        /// <returns></returns>
        /// <remarks>
        /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread). Use
        ///              CloseMediaDelegate() with BeginInvoke() from other threads.
        /// </remarks>
        protected delegate bool CloseMediaDelegate();
        protected override bool StopProcessing()
        {
            bool success = false;

            try
            {
                if (containerForm != null)
                {
                    containerForm.Close();
                    OpenGL.GlControl openGlControl = windowControl as OpenGL.GlControl;
                    openGlControl.Dispose();
                    containerForm = null;
                    deviceContext = null;
                    renderContext = IntPtr.Zero;
                }
                success = true;
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("OpenGLNetWindowWriter.CloseMedia(): " + e.ToString());
            }

            return success;
        }

        /// <summary>
        /// Handle MediaThread events (thread loop).
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// Thead Safe - Yes
        /// </remarks>
        protected override void HandleEvents()
        {
            bool started = true;
            ThreadEventsList newEventIndex;
            MediaFrameEventInfo newFrameInfo = null;
            VideoFrame lastOtherFrame = null;
            OpenGLNetWindowWriter OpenGLNetWindowWriter = ParentMediaAct as OpenGLNetWindowWriter;

            // tell anyone who is listening - initialization is complete
            SendInitializedEvent();

            while (started)
            {
                try
                {
                    newEventIndex = (ThreadEventsList)WaitHandle.WaitAny(ThreadEvents);     // ##### need a timeout here ??
                    switch (newEventIndex)
                    {
                        case ThreadEventsList.StartProcessing:

                            // start windows form message loop
                            Thread windowsThread = new Thread(new ThreadStart(WindowsMessageLoop));
                            windowsThread.Name = "OpenGL.Net Window Writer MessageLoop";
                            windowsThread.Start();                                          // #### should add an error event to handle errors in this thread

                            break;

                        case ThreadEventsList.StopProcessing:
                            if (OpenGLNetWindowWriter.ActOpened)
                            {
                                if (containerForm != null)
                                    containerForm.BeginInvoke(new CloseMediaDelegate(StopProcessing));
                                OpenGLNetWindowWriter.ActOpened = false;
                                OpenGLNetWindowWriter.SendClosedEvent();
                            }
                            break;

                        case ThreadEventsList.Shutdown:
                            if (OpenGLNetWindowWriter.ActOpened)
                            {
                                if (containerForm != null)
                                    containerForm.BeginInvoke(new CloseMediaDelegate(StopProcessing));
                                OpenGLNetWindowWriter.ActOpened = false;
                                OpenGLNetWindowWriter.SendClosedEvent();
                            }
                            started = false;
                            break;

                        case ThreadEventsList.Frame:
                            int frameEventQueueCount = 0;
                            lock (FrameEventQueue.SyncRoot)
                                frameEventQueueCount = FrameEventQueue.Count;

                            while (frameEventQueueCount > 0)
                            {
                                lock (FrameEventQueue.SyncRoot)
                                {
                                    newFrameInfo = (MediaFrameEventInfo)FrameEventQueue.Dequeue();
                                    frameEventQueueCount = FrameEventQueue.Count;
                                }
                                MediaScript.ActionEnum action = OpenGLNetWindowWriter.ActAction;

                                if ((OpenGLNetWindowWriter.ActOpened) && (newFrameInfo != null) && (newFrameInfo.Frame != null))
                                {
                                    // see if the frame is a video frame
                                    VideoFrame videoFrame = newFrameInfo.Frame as VideoFrame;

                                    if (videoFrame != null)
                                    {

                                        MediaScript.ActionEnum otherDisplay = (action == MediaScript.ActionEnum.Display1) ? MediaScript.ActionEnum.Display2 : MediaScript.ActionEnum.Display1;

                                        // Frame source and display match (Source1 and Display1 OR Source2 and Display2)
                                        bool frameSourceDisplayMatch = ((videoFrame.Source == MediaScript.ActionEnum.Source1) && (action == MediaScript.ActionEnum.Display1))
                                                                                ||
                                                                       ((videoFrame.Source == MediaScript.ActionEnum.Source2) && (action == MediaScript.ActionEnum.Display2));

                                        //Debug.WriteLine("WindowWriter Action " + action.ToString() + " VideoFrame " + videoFrame.Source.ToString() + " FrameNumber " +
                                        //                videoFrame.FrameNumber.ToString() + " DisplayMatch " + frameSourceDisplayMatch.ToString());

                                        // is swap displays enabled?
                                        if (videoFrame.SwapSource && videoFrame.Script.Is(action, MediaScript.ActionStateEnum.Active) &&
                                            videoFrame.Script.Is(otherDisplay, MediaScript.ActionStateEnum.Active))
                                        {
                                            if (!frameSourceDisplayMatch)
                                                lastOtherFrame = videoFrame;
                                            else if (lastOtherFrame != null)
                                                videoFrame = lastOtherFrame;
                                        }
                                        else if (!frameSourceDisplayMatch)
                                            lastOtherFrame = null;

                                        if (videoFrame.Script.Is(action, MediaScript.ActionStateEnum.Active) && frameSourceDisplayMatch)
                                        {
                                            // write overlay

                                            //string frameTime = ((double)videoFrame.FrameCaptureTimeTicks / (double)Stopwatch.Frequency).ToString("0000.000 ");
                                            //Debug.WriteLine(frameTime + action.ToString() + " " + videoFrame.Source.ToString() + " write overlay
                                            if (videoFrame.DataLock.TryEnterReadLock(videoFrame.DataLockTimeout))
                                            {
                                                // write overlay to display bitmap (only for exam display)
                                                if (videoFrame.Overlay != null)
                                                {
                                                    // draw on the frame bitmap - might want to use a copy here?
                                                    videoFrame.Overlay.Draw(videoFrame.VideoBitmap.RGBBitmap,
                                                        OpenGLNetWindowWriter.ShowSubtitles, OpenGLNetWindowWriter.ShowGraphic);
                                                    if (videoFrame.FilteredVideoBitmap != null)
                                                        videoFrame.Overlay.Draw(videoFrame.FilteredVideoBitmap.RGBBitmap,
                                                            OpenGLNetWindowWriter.ShowSubtitles, OpenGLNetWindowWriter.ShowGraphic);
                                                }
                                                videoFrame.DataLock.ExitReadLock();
                                            }

                                            WriteFrame(videoFrame, OpenGLNetWindowWriter.Video);

                                            // capture image requested ?
                                            if (Interlocked.CompareExchange(ref OpenGLNetWindowWriter.CaptureImageFlag, 0, 1) == 1)
                                                CaptureImage(videoFrame);

                                            if (videoFrame.DataLock.TryEnterWriteLock(videoFrame.DataLockTimeout))
                                            {
                                                // Return video storage to global pool.
                                                if (!delayedStorageCleanup)
                                                {
                                                    videoFrame.ReturnVideoStorage();
                                                    videoFrame.ReturnFilteredVideoStorage();
                                                }
                                                videoFrame.DataLock.ExitWriteLock();
                                            }
                                        }
                                    }

                                    // send audio frame event (i.e. used to display audio level)
                                    AudioFrame audioFrame = newFrameInfo.Frame as AudioFrame;
                                    if (audioFrame != null)
                                    {
                                        if (audioFrame.Script.Is(action, MediaScript.ActionStateEnum.Active))
                                        {
                                            OpenGLNetWindowWriter.SendAudioFrameEvent(new MediaFrameEventInfo(newFrameInfo.Frame));
                                        }
                                    }
                                }

                                if ((newFrameInfo != null) && (newFrameInfo.Frame != null))
                                    OpenGLNetWindowWriter.SendFrameEvent(new MediaFrameEventInfo(newFrameInfo.Frame));
                            }
                            break;
                    }
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine("OpenGLNetWindowWriterMediaIOThread.HandleEvents: " + e.ToString());
                }
            }
        }

        /// <summary>
        /// Writes video frame to the openGl window.
        /// </summary>
        /// <Param Name="frame">Video frame to be written.</Param>
        /// <Param Name="options">Video frame options for writing.</Param>
        /// <returns>true - if no error</returns>
        /// <remarks>
        /// Thead Safe - Yes, intended to be called from the MediaAct thread.
        /// </remarks>
        private bool WriteFrame(VideoFrame frame, VideoMedia options)
        {
            bool result = false;
            delayedStorageCleanup = false;

            if (windowControl != null)
            {
                try
                {
                    if (windowControl.InvokeRequired)
                    {
                        delayedStorageCleanup = true;
                        windowControl.BeginInvoke(new OpenGLNetWindowWriterMediaIOThread.RenderWindowDelegate(Render), frame, options);
                    }
                    else
                        Render(frame, options);
                    result = true;
                }
                catch (System.Exception e)
                {
                    System.Diagnostics.Debug.WriteLine("OpenGLNetWindowWriterMediaIOThread.WriteFrame: " + e.ToString());
                }
            }

            return result;
        }

        /// <summary>
        /// Renders video frame to the openGl window.
        /// </summary>
        /// <Param Name="frame">Video frame to be rendered.</Param>
        /// <Param Name="options">Video frame options for rendering.</Param>
        /// <returns></returns>
        /// <remarks>
        /// Thead Safe - No, must be called from the thread the media was opened on (i.e. MediaAct thread).
        /// </remarks>
        public delegate void RenderWindowDelegate(VideoFrame frame, VideoMedia options);
        public void Render(VideoFrame frame, VideoMedia options)
        {
            RGBStorage videoBitmap;
            BitmapData bmData;
            bool locked = false;

            if (frame != null)
            {
                try
                {
                    frame.FrameDisplayTimeTicks = DateTime.UtcNow.Ticks - frame.FrameCaptureTimeTicks;

                    OpenGL.GlControl openGlControl = windowControl as OpenGL.GlControl;
                    if (openGlControl != null && deviceContext != null)
                    {
                        deviceContext.MakeCurrent(renderContext);
                        Gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

                        //Debug.WriteLine("OpenGlWriter.Render TryEnterReadLock Frame");
                        if (frame.DataLock.TryEnterReadLock(frame.DataLockTimeout))
                        {
                            locked = true;

                            videoBitmap = frame.VideoBitmap;
                            //videoBitmap = videoFrame.FilteredVideoBitmap;
                            if (videoBitmap != null)
                            {
                                //System.Diagnostics.Debug.WriteLine("Rendering");
                                if (options.Stereo == VideoMedia.VideoStereoEnum.TopRightBottomLeft)
                                {
                                    Gl.PixelZoom((float)openGlControl.Width / (float)videoBitmap.Width, (float)openGlControl.Height / ((float)videoBitmap.Height) / 2F);
                                    Gl.DrawBuffer(DrawBufferMode.BackLeft);
                                    bmData = videoBitmap.RGBBitmap.LockBits(new Rectangle(0, 0, (int)videoBitmap.Width, (int)videoBitmap.Height / 2),
                                        ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                                    Gl.DrawPixels((int)videoBitmap.Width, (int)videoBitmap.Height, OpenGL.PixelFormat.Bgr, OpenGL.PixelType.UnsignedByte, bmData.Scan0);
                                    videoBitmap.RGBBitmap.UnlockBits(bmData);

                                    Gl.DrawBuffer(DrawBufferMode.BackRight);
                                    bmData = videoBitmap.RGBBitmap.LockBits(new Rectangle(0, (int)videoBitmap.Height, (int)videoBitmap.Width, (int)videoBitmap.Height),
                                        ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                                    Gl.DrawPixels((int)videoBitmap.Width, (int)videoBitmap.Height, OpenGL.PixelFormat.Bgr, OpenGL.PixelType.UnsignedByte, bmData.Scan0);
                                    videoBitmap.RGBBitmap.UnlockBits(bmData);
                                }
                                else if (options.Stereo == VideoMedia.VideoStereoEnum.RightLeft)
                                {
                                    Gl.PixelZoom((float)openGlControl.Width / ((float)videoBitmap.Width) / 2F, (float)openGlControl.Height / (float)videoBitmap.Height);
                                    Gl.DrawBuffer(DrawBufferMode.BackRight);
                                    bmData = videoBitmap.RGBBitmap.LockBits(new Rectangle(0, 0, (int)videoBitmap.Width / 2, (int)videoBitmap.Height),
                                        ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                                    Gl.DrawPixels((int)videoBitmap.Width, (int)videoBitmap.Height, OpenGL.PixelFormat.Bgr, OpenGL.PixelType.UnsignedByte, bmData.Scan0);
                                    videoBitmap.RGBBitmap.UnlockBits(bmData);

                                    Gl.DrawBuffer(DrawBufferMode.BackLeft);
                                    bmData = videoBitmap.RGBBitmap.LockBits(new Rectangle((int)videoBitmap.Width / 2, 0, (int)videoBitmap.Width / 2, (int)videoBitmap.Height),
                                        ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                                    Gl.DrawPixels((int)videoBitmap.Width, (int)videoBitmap.Height, OpenGL.PixelFormat.Bgr, OpenGL.PixelType.UnsignedByte, bmData.Scan0);
                                    videoBitmap.RGBBitmap.UnlockBits(bmData);
                                }
                                else // default to mono (no Stereo)
                                {
                                    Gl.PixelZoom((float)openGlControl.Width / (float)videoBitmap.Width, (float)openGlControl.Height / (float)videoBitmap.Height);
                                    bmData = videoBitmap.RGBBitmap.LockBits(new Rectangle(0, 0, (int)videoBitmap.Width, (int)videoBitmap.Height),
                                        ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                                    Gl.DrawBuffer(DrawBufferMode.BackLeft);
                                    Gl.DrawPixels((int)videoBitmap.Width, (int)videoBitmap.Height, OpenGL.PixelFormat.Bgr, OpenGL.PixelType.UnsignedByte, bmData.Scan0);
                                    videoBitmap.RGBBitmap.UnlockBits(bmData);
                                }

                            }

                            // Return video storage to global pool.
                            if (delayedStorageCleanup)
                            {
                                frame.ReturnVideoStorage();
                                frame.ReturnFilteredVideoStorage();
                            }

                            frame.DataLock.ExitReadLock();
                            locked = false;

                            Gl.Flush();
                            deviceContext.SwapBuffers();
                        }
                        else
                            throw (new Exception("OpenGLNetWindowWriter.Render(): Lock Timeout"));

                        frame.FrameDisplayCompleteTimeTicks = DateTime.UtcNow.Ticks - frame.FrameCaptureTimeTicks;
                    }
                }
                catch (System.Exception e)
                {
                    System.Diagnostics.Debug.WriteLine("OpenGLNetWindowWriter.Render(): " + e.ToString());
                }
                finally
                {
                    if (locked)
                    {
                        //Debug.WriteLine("OpenGlWriter.Render TryEnterReadLock Frame ENTER finally");
                        frame.DataLock.ExitReadLock();
                    }
                }

            }
        }

        /// <summary>
        /// Capture image from video frame and send the capture image event.
        /// </summary>
        /// <Param Name="frame">Current media video frame.</Param>
        /// <returns>true - if no error</returns>
        /// <remarks>
        /// Thead Safe - Yes, intended to be called from the MediaAct thread.
        /// </remarks>
        private bool CaptureImage(VideoFrame videoFrame)
        {
            bool result = false;
            bool locked = false;
            MediaImage newImage = null;
            OpenGLNetWindowWriter openGlWindowWriter = ParentMediaAct as OpenGLNetWindowWriter;

            try
            {
                if ((videoFrame != null) && (videoFrame.DataLock.TryEnterWriteLock(videoFrame.DataLockTimeout)))
                {
                    locked = true;
                    newImage = new MediaImage();
                    newImage.ImageBitmap = (Bitmap)videoFrame.VideoBitmap.RGBBitmap.Clone();
                    if (videoFrame.RawVideoBitmap != null)
                        newImage.RawImageBitmap = (Bitmap)videoFrame.RawVideoBitmap.RGBBitmap.Clone();
                    if (videoFrame.FilteredVideoBitmap != null)
                        newImage.FilteredImageBitmap = (Bitmap)videoFrame.FilteredVideoBitmap.RGBBitmap.Clone();

                }
            }
            catch (Exception e)
            {
                newImage = null;
                System.Diagnostics.Debug.WriteLine("openGlWindowWriterMediaThreadIO.CaptureImage(): " + e.ToString());
            }
            finally
            {
                if (locked)
                    videoFrame.DataLock.ExitWriteLock();
            }

            // post image captured event to anyone who is listening
            if (newImage != null)
            {
                // images need to be flipped (display needs them one way and file needs them another)

                if (newImage.ImageBitmap != null)
                    newImage.ImageBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
                if (newImage.RawImageBitmap != null)
                    newImage.RawImageBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
                if (newImage.FilteredImageBitmap != null)
                    newImage.FilteredImageBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);

                openGlWindowWriter.SendImageEvent(new MediaImageEventInfo(videoFrame.Source, newImage));
            }

            return result;
        }
    }
}

`

Can you clarify the meaning of "open/close" window? Do you dispose it? Or do you simply show/hide it? Are you running on different threads each time a window is displayed?
The NullReferenceException is telling me that no OpenGL procedure pointers are loaded.

Yes, I dispose the GlControl in the StopProcessing() method.  The thread that calls StartProcessing() and StopProcessing() remains running in the process until I close the application.  Note that I can induce the exception when first opening the window (which calls StartProcessing()) by calling Gl.Initialize() in the constructor.  I suppose that I can avoid the exception by not disposing the GlControl.  The problem is I will still likely encounter the exception when I open a second window (the application has that capability).  Is there a way to force loading of OpenGL procedures in conjunction with Gl.Initialize()?
Disclaimer: This is inherited code.  I would not have designed the form to operate in this fashion.  I am moving to OpenGL.Net from OpenTK which causes random exceptions in the CLR on GC.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 11:19 AM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Can you clarify the meaning of "open/close" window? Do you dispose it? Or do you simply show/hide it? Are you running on different threads each time a window is displayed?
The NullReferenceException is telling me that no OpenGL procedure pointers are loaded.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322219498, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-UHlIMSUoMgganqDaJYnDACjUkvbks5sYGVZgaJpZM4O2apX.

There's a Gl.BindAPI() method that loads function pointers based on the context current on the calling thread. Call it before creation the new window.
But it shouldn't necessary, since this is called automatically the GlControl at handle creation time. I suspect there is something wrong elsewhere.

I already tried calling Gl.BindApi() before creating the GlControl.  I still get the same exception.  In this case the first time the window is opened since I have to call Gl.Initialize() first in order to get the KhronosVersion and Extensions objects.  That appears to be the key to solving the issue.  I don’t understand why the OpenGL bindings are not available after calling Gl.Initialize() since Gl.Initialize() is called automatically without setting the OPENGL_NET_INIT env variable to NO.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 12:38 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
There's a Gl.BindAPI() method that loads function pointers based on the context current on the calling thread. Call it before creation the new window.
But it shouldn't necessary, since this is called automatically the GlControl at handle creation time. I suspect there is something wrong elsewhere.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322241207, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-YxVEBOA7a9il7-Xmbe8XdogeBbcks5sYHf_gaJpZM4O2apX.

Gl.Initialize is executed only once, and it is described in the wiki pages. Using GlControl is not necessary to call it explicitly.
To overcome this issue, try to set Gl.CurrentExtensions.SwapControl_EXT to false (after calling Gl.Initialize explicitly). This will leave the swap interval as default (V-Sync enabled on double buffered visual configurations). In practice, it avoids to to call that specific API.
Which version of OpenGL.Net you are running on?

I’ll try setting Gl.CurrentExtensions.SwapControl_EXT to false.
I’m using version 0.5.2 which appears to be the latest on NuGet.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 1:08 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Gl.Initialize is executed only once, and it is described in the wiki pages. Using GlControl is not necessary to call it explicitly.
To overcome this issue, try to set Gl.CurrentExtensions.SwapControl_EXT to false (after calling Gl.Initialize explicitly). This will leave the swap interval as default (V-Sync enabled on double buffered visual configurations). In practice, it avoids to to call that specific API.
Which version of OpenGL.Net you are running on?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322248946, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-Q830vZ60Hjh7BGoafv1oAkP4lp6ks5sYH7rgaJpZM4O2apX.

Sorry for the typo, but you should set Wgl.CurrentExtensions.SwapControl_EXT.

Actually Gl.CurrentExtensions.SwapControl_EXT does not exist in version 0.5.2. At least the in the version I downloaded from NuGet.  Does the NuGet package require updating?
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 1:08 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Gl.Initialize is executed only once, and it is described in the wiki pages. Using GlControl is not necessary to call it explicitly.
To overcome this issue, try to set Gl.CurrentExtensions.SwapControl_EXT to false (after calling Gl.Initialize explicitly). This will leave the swap interval as default (V-Sync enabled on double buffered visual configurations). In practice, it avoids to to call that specific API.
Which version of OpenGL.Net you are running on?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322248946, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-Q830vZ60Hjh7BGoafv1oAkP4lp6ks5sYH7rgaJpZM4O2apX.

Sorry for the typo, but you should set Wgl.CurrentExtensions.SwapControl_EXT.

Unfortunately that didn’t work either.  I end up getting an exception at the next OpenGL function call.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 1:27 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Sorry for the typo, but you should set Wgl.CurrentExtensions.SwapControl_EXT.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322253708, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-XKT9bGH1-0ApIiwzV8p57tHKbnWks5sYINbgaJpZM4O2apX.

Good (even if it is not yet solved, this proves that the problem is elsewhere). Maybe I found the problem, since I've encountered it some days ago.
Can you check whether Wgl.GetCurrentContext() is returning a value different from IntPtr.Zero after GlControl disposition? If it is, that's the cause. Because this code:
public override bool MakeCurrent(IntPtr ctx)
{
	// Avoid actual call to wglMakeCurrent if it is not necessary
	// Efficient on simple/nominal applications
	IntPtr currentContext = Wgl.GetCurrentContext(), currentDc = Wgl.GetCurrentDC();
	if (ctx == currentContext && _DeviceContext == currentDc)
		return (true);

	// Base implementation
	return (base.MakeCurrent(ctx));
}

protected override bool MakeCurrentCore(IntPtr ctx)
{
	return (Wgl.MakeCurrent(_DeviceContext, ctx));
}

Probably that "Efficient on simple/nominal applications" becomes "Buggy on strange/complex applications" ... -.-

Another hypothesis. Windows are run on different threads?

Wgl.GetCurrentContext()returns IntPtr.Zero after calling Dispose on the GlControl.  That said, the disposition occurs in a different thread than the thread on which the GlControl was created.  StartProcessing() calls Application.Run() on the form that contains the GlControl UserControl.  Application.Run() spawns a new thread and calls containerForm_Load().  The GlControl is created in that method.  I tried creating the GlControl directly in StartProcessing() but I get the same result.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 1:39 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Good (even if it is not yet solved, this proves that the problem is elsewhere). Maybe I found the problem, since I've encountered it some days ago.
Can you check whether Wgl.GetCurrentContext() is returning a value different from IntPtr.Zero after GlControl disposition? If it is, that's the cause. Because this code:
public override bool MakeCurrent(IntPtr ctx)
{
    // Avoid actual call to wglMakeCurrent if it is not necessary

    // Efficient on simple/nominal applications

    IntPtr currentContext = Wgl.GetCurrentContext(), currentDc = Wgl.GetCurrentDC();

    if (ctx == currentContext && _DeviceContext == currentDc)

           return (true);

    // Base implementation

    return (base.MakeCurrent(ctx));

}
protected override bool MakeCurrentCore(IntPtr ctx)
{
    return (Wgl.MakeCurrent(_DeviceContext, ctx));

}
Probably that "Efficient on simple/nominal applications" becomes "Buggy on strange/complex applications" ... -.-
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322256764, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-YzAtwMaVvd05k2_yhDgaP7wuZWTks5sYIYjgaJpZM4O2apX.

What do you mean “Windows are run on different threads”?  The second time I try to open the form the attempt is made on a new thread.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 1:58 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Another hypothesis. Windows are run on different threads?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322262136, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-bATro79XHvPW-8tcNPVLWJ1T86Kks5sYIq7gaJpZM4O2apX.

(Probably) I found the source of the problem. Actually the library has never been tested for multi-threading, even if it is ready to support it. What you need is to load WGL procedures; to do so, you need the Wgl.BindAPI(), but actually is private.
I think you could execute it via reflection at the moment. I'll provide some pattern to support multiple threads.in the next days

Being said this, probably the problem is caused by a missing call to Wgl.BindAPI() (a private method). You must know that all procedure on KhronoApi derived classes (indeed including Wgl), have a [ThreadStatic] attribute.
Indeed, each thread using any method must load procedures dynamically. Wgl procedures are thread static too. That's responsibility of Wgl.BindAPI(); this method is called only in two places:

Wgl static constructors
After a successfull call to Wgl.MakeCurrent

Despite all the reasoning above is correct, I cannot explain why only the Wgl.SwapIntervalEXT is failing (and not the GL context creation itself). I'll try to reproduce it locally using an unit test.

By the way, for what is worth, throw away that crazy design with a single-window-at-time-with-multithreading with a safe and fast single-ui-thread design i.e. what this answer explain quite well.

It also doesn’t explain why the form functions properly the first time it is opened but not the second.  Perhaps that makes sense to you at this point.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 4:26 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Despite all the reasoning above is correct, I cannot explain why only the Wgl.SwapIntervalEXT is failing (and not the GL context creation itself). I'll try to reproduce it locally using an unit test.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322299680, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-UbbAQg7KZ20HNnt17EsLHVa7w0vks5sYK1dgaJpZM4O2apX.

I’ll try using Wgl.MakeCurrent().
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 4:03 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
(Probably) I found the source of the problem. Actually the library has never been tested for multi-threading, even if it is ready to support it. What you need is to load WGL procedures; to do so, you need the Wgl.BindAPI(), but actually is private.
I think you could execute it via reflection at the moment. I'll provide some pattern to support multiple threads.in the next days

Being said this, probably the problem is caused by a missing call to Wgl.BindAPI() (a private method). You must know that all procedure on KhronoApi derived classes (indeed including Wgl), have a [ThreadStatic] attribute.
Indeed, each thread using any method must load procedures dynamically. Wgl procedures are thread static too. That's responsibility of Wgl.BindAPI(); this method is called only in two places:

Wgl static constructors
After a successfull call to Wgl.MakeCurrent

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322293776, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-ZoQI9fqtgWvrSZGJzucu1_37DcGks5sYKfmgaJpZM4O2apX.

Unfortunately it will not be easy to change the current design.  Also the current code does use Invoke/InvokeRequired as explained in the thread.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 4:48 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
By the way, for what is worth, throw away that crazy design with a single-window-at-time-with-multithreading with a safe and fast single-ui-thread design i.e. what thishttps://stackoverflow.com/a/7568400/161554 answer explain quite well.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322305094, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-dZEnQ2apa1m3sPtpcffnHpBmFUXks5sYLJ1gaJpZM4O2apX.

Actually I’m not certain how I can reach Wgl.BindApi() with a call to Wgl.MakeCurrent().  It requires that newContext is not IntPtr.Zero.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 4:03 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
(Probably) I found the source of the problem. Actually the library has never been tested for multi-threading, even if it is ready to support it. What you need is to load WGL procedures; to do so, you need the Wgl.BindAPI(), but actually is private.
I think you could execute it via reflection at the moment. I'll provide some pattern to support multiple threads.in the next days

Being said this, probably the problem is caused by a missing call to Wgl.BindAPI() (a private method). You must know that all procedure on KhronoApi derived classes (indeed including Wgl), have a [ThreadStatic] attribute.
Indeed, each thread using any method must load procedures dynamically. Wgl procedures are thread static too. That's responsibility of Wgl.BindAPI(); this method is called only in two places:

Wgl static constructors
After a successfull call to Wgl.MakeCurrent

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322293776, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-ZoQI9fqtgWvrSZGJzucu1_37DcGks5sYKfmgaJpZM4O2apX.

Something like using System.Reflection:
MethodInfo bindApiMethod = typeof(Wgl).GetMethod("BindAPI", BindingFlags.NonPublic | BindingFlags.Static);
bindApiMethod.Invoke(null, null);

Ok, I've unit tested the multi-threading UI using WinForms control, as you can see from the commit referenced above. As I expected, it throws a NullReferenceException when access to wglCreateContextAttribsARB, and this happens on the slower thread (because the other get execution of static constructors).
Now the unit test works as expected. I hope this will fix you issue. In the other case, you can continue this issue.

Great! Will you be releasing a new version on nuget?
I will test the reflection solution tomorrow.
Sent with BlackBerry Work
(www.blackberry.com)
From: Luca Piccioni <notifications<EMAIL_ADDRESS>Date: Monday, Aug 14, 2017, 6:29 PM
To: luca-piccioni/OpenGL.Net <OpenGL.Net<EMAIL_ADDRESS>Cc: BIGLER Don (IB) <don.bigler<EMAIL_ADDRESS>Author <author<EMAIL_ADDRESS>Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Ok, I've unit tested the multi-threading UI using WinForms control, as you can see from the commit referenced above. As I expected, it throws a NullReferenceException when access to wglCreateContextAttribsARB, and this happens on the slower thread (because the other get execution of static constructors).
Now the unit test works as expected. I hope this will fix you issue. In the other case, you can continue this issue.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322327085, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-Sl09pxav3Lg_C2ViovAGyT90M7aks5sYMm6gaJpZM4O2apX.

I tried using the code below. I still get the same exception when opening the window the second time.  As you noted, it’s strange that the exception occurs at SwapIntervalEXT instead of at Gl context creation.  It’s almost as if some but not all of the OpenGL calls are initialized.  I wonder if there is a static variable that becomes initialized when the window is first opened and remains initialized after disposition such that it does not allow the full initialization of all of the OpenGL functions.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 5:32 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Something like using System.Reflection:
MethodInfo bindApiMethod = typeof(Wgl).GetMethod("BindAPI", BindingFlags.NonPublic | BindingFlags.Static);
bindApiMethod.Invoke(null, null);
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322315615, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-QkQcq-x279PMqBzlKSZSO8G55ruks5sYLy9gaJpZM4O2apX.

Quite strange. At this point I suggest to clone the master branch, and test
application against it. It is alrwady patched for your case.
Il mar 15 ago 2017, 15:02 dcb-areva<EMAIL_ADDRESS>ha scritto:

I tried using the code below. I still get the same exception when opening
the window the second time. As you noted, it’s strange that the exception
occurs at SwapIntervalEXT instead of at Gl context creation. It’s almost as
if some but not all of the OpenGL calls are initialized. I wonder if there
is a static variable that becomes initialized when the window is first
opened and remains initialized after disposition such that it does not
allow the full initialization of all of the OpenGL functions.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 5:32 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException
Second Time Gl.Control Window is Opened (#58)
Something like using System.Reflection:
MethodInfo bindApiMethod = typeof(Wgl).GetMethod("BindAPI",
BindingFlags.NonPublic | BindingFlags.Static);
bindApiMethod.Invoke(null, null);
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<
https://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322315615>,
or mute the thread<
https://github.com/notifications/unsubscribe-auth/Adkl-QkQcq-x279PMqBzlKSZSO8G55ruks5sYLy9gaJpZM4O2apX>.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322459911,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEe6CUK5ol6chSvZnfp66HfauYyPLzdvks5sYZbRgaJpZM4O2apX
.

Another check: did you call the Wgl.BindAPI method on the new thread, isn't
it?
Il mar 15 ago 2017, 15:06 Luca Piccioni<EMAIL_ADDRESS>ha
scritto:

Quite strange. At this point I suggest to clone the master branch, and
test application against it. It is alrwady patched for your case.
Il mar 15 ago 2017, 15:02 dcb-areva<EMAIL_ADDRESS>ha scritto:

I tried using the code below. I still get the same exception when opening
the window the second time. As you noted, it’s strange that the exception
occurs at SwapIntervalEXT instead of at Gl context creation. It’s almost as
if some but not all of the OpenGL calls are initialized. I wonder if there
is a static variable that becomes initialized when the window is first
opened and remains initialized after disposition such that it does not
allow the full initialization of all of the OpenGL functions.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 5:32 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException
Second Time Gl.Control Window is Opened (#58)
Something like using System.Reflection:
MethodInfo bindApiMethod = typeof(Wgl).GetMethod("BindAPI",
BindingFlags.NonPublic | BindingFlags.Static);
bindApiMethod.Invoke(null, null);
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<
https://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322315615>,
or mute the thread<
https://github.com/notifications/unsubscribe-auth/Adkl-QkQcq-x279PMqBzlKSZSO8G55ruks5sYLy9gaJpZM4O2apX>.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322459911,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEe6CUK5ol6chSvZnfp66HfauYyPLzdvks5sYZbRgaJpZM4O2apX
.

I tested the application against the latest in Master.  Your latest commit seems to have fixed the problem.  I’d like to build against the NuGet package instead of building from source so I would appreciate an update at your earliest convenience.
Thank you
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Tuesday, August 15, 2017 9:07 AM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException Second Time Gl.Control Window is Opened (#58)
Quite strange. At this point I suggest to clone the master branch, and test
application against it. It is alrwady patched for your case.
Il mar 15 ago 2017, 15:02 dcb-areva <notifications<EMAIL_ADDRESS>ha scritto:

I tried using the code below. I still get the same exception when opening
the window the second time. As you noted, it’s strange that the exception
occurs at SwapIntervalEXT instead of at Gl context creation. It’s almost as
if some but not all of the OpenGL calls are initialized. I wonder if there
is a static variable that becomes initialized when the window is first
opened and remains initialized after disposition such that it does not
allow the full initialization of all of the OpenGL functions.
From: Luca Piccioni<EMAIL_ADDRESS>Sent: Monday, August 14, 2017 5:32 PM
To: luca-piccioni/OpenGL.Net
Cc: BIGLER Don (IB); Author
Subject: Re: [luca-piccioni/OpenGL.Net] Encounter NullReferenceException
Second Time Gl.Control Window is Opened (#58)
Something like using System.Reflection:
MethodInfo bindApiMethod = typeof(Wgl).GetMethod("BindAPI",
BindingFlags.NonPublic | BindingFlags.Static);
bindApiMethod.Invoke(null, null);
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<
https://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322315615>,
or mute the thread<
https://github.com/notifications/unsubscribe-auth/Adkl-QkQcq-x279PMqBzlKSZSO8G55ruks5sYLy9gaJpZM4O2apX>.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322459911,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEe6CUK5ol6chSvZnfp66HfauYyPLzdvks5sYZbRgaJpZM4O2apX
.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/luca-piccioni/OpenGL.Net/issues/58#issuecomment-322460864, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Adkl-bDFdJAcfWkwkZgfsc5ZsbKjBw-qks5sYZfWgaJpZM4O2apX.

Indeed I found the bug: the commit fixes the multi-threading issues you found.
Essentially WGL function pointers doesn't must be ThreadStatic, and they requires to be initialized only at Gl initialization time. Then, WGL function pointers are shared across all threads.
This will be included in the NuGet package v0.6.0-beta3 that I'll release soon.


fails to get frame on pi zero

Traceback (most recent call last):
  File "controller.py", line 140, in <module>
    main()
  File "controller.py", line 135, in main
    args.headless).run()
  File "controller.py", line 118, in run
    raise e
  File "controller.py", line 38, in run
    frame = self.model.getFrame()
  File "/home/pi/dab/opencv_bombing/model.py", line 49, in getFrame
    frame = imutils.resize(frame, width=600)
  File "/home/pi/dab/lib/python3.7/site-packages/imutils/convenience.py", line 69, in resize
    (h, w) = image.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'

running on a pi zero w
opencv version: 3.4.3
the thing fails to get a frame from the camera

that's a problem with older versions of opencv, and guess what there aren't any newer versions of opencv-python for the pi zero so either you compile it yourself(10+ hours) or don't use a zero


Login credentials

Could you please provide login credentials of admin and super admin ??

yes i am also unable to login into any account

go to login blade and change  input name from identity to email it will work

This plus other issues are fixed in this PR https://github.com/4jean/lav_sms/pull/13#issue-493696564

Please Check fix Line 43
https://github.com/4jean/lav_sms/blob/master/app/Http/Controllers/Auth/LoginController.php

Please Check fix..Oveeride username method of trait AuthenticatesUsers
https://github.com/4jean/lav_sms/blob/master/app/Http/Controllers/Auth/LoginController.php
public function username ()
    {
        $identity = request()->identity;
        $field = filter_var($identity, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
        request()->merge([$field => $identity]);
        return $field;
    }


Added point density hexagon layer (That's it, the name is sealed)

Changes included
PointDensityHexagonLayer

PointDensityHexagonLayer is a layer wrapper that aggregates points into hexagonal bins
It takes an array of points and the radius of hexagon bin in meters
Color and height of each hexagon are scaled by the density of the bins, that is, the number of points it contains.
By default PointDensityHexagonLayer uses d3-hexbin as hexagon aggregator it also takes hexagonAggregator as a prop

HexagonLayer

HexagonLayer now also takes in radius in meter and angle in radian as props to calculate primitive hexagon. If radius and angle are provided, hexagonVertices will be ignored.
Change radiusScale to coverage for clarity. coverage will be clamped between 0 - 1
Added elevationScale to scale elevation.

GridLayer

Added elevationScale to scale elevation.

LayerControl

Added ColorRangePicker

By default PointDensityHexagonLayer uses d3-hexbin as hexagon aggregator it also takes hexagonAggregator as a prop

This is really cool. We should consider whether deck.gl should include d3-hexbin at all, or if that should just be included in the example. In that case the HexagonLayer would not be usable on its own since no default aggregator.

HexagonLayer now also takes in radius in meter and angle in radian as props to calculate primitive hexagon.

If radius and angle are provided, hexagonVertices will be ignored.

I might have done it the other way (i.e. hexagonVertices would override angle and radius) as it seems a little more intuitive for a new user to have the more complicated and powerful API be the optional one.

Change radiusScale to coverage for clarity. coverage will be clamped between 0 - 1

Not completely onboard with this. I'll just drop a bunch of thoughts and we can discuss offline:

First a nit: per the API guidelines, all multiplicative properties should have the suffix ...Scale (unless they are established concepts like opacity). Accordingly this should be called coverageScale?
But since we have radiusScale in other layers and this essentially does the same thing, I think there is a real value in calling it the same thing.
Not sure why we would want to enforce a clamp on this. The general hexagon layer does not enforce centroid spacing, so larger than 1 hexagons could potentially be useful. Also other layers that support radius scale support overlap and overdraw, so not doing it here could be more surprising than helpful in some cases.
For the demo, I do see that want to restrict the range of the slider. We could do that without renaming the attribute. We could check the layerName when we determine the type of a prop. We could add a propTypes field to the example objects in layer-examples.js.

Added elevationScale to scale elevation.

Note that elevation scaling could also be achieved using the modelMatrix prop.

That said, having a separate prop for this is certainly easier for casual users who might not be well versed in linear algebra.
If we add elevationScale to these layers we should at least consider whether we want to update our API guidelines to state that all extruded layers should support elevationScale

Added ColorRangePicker

This is a really nice addition. At some point we should consider if there are there other layers for which color ranges would make sense?

HexagonLayer now also takes in radius in meter and angle in radian as props to calculate primitive hexagon.
If radius and angle are provided, hexagonVertices will be ignored.

We need to discuss this offline.

First a nit: per the API guidelines, all multiplicative properties should have the suffix ...Scale (unless they are established concepts like opacity). Accordingly this should be called coverageScale?
But since we have radiusScale in other layers and this essentially does the same thing, I think there is a real value in calling it the same thing.
Not sure why we would want to enforce a clamp on this. The general hexagon layer does not enforce centroid spacing, so larger than 1 hexagons could potentially be useful. Also other layers that support radius scale support overlap and overdraw, so not doing it here could be more surprising than helpful in some cases.

I don't quite get this part. It feels like the "coverage" props shows the ratio between the underlying "binning cell" and actually "rendered cell". Changing it to radiusScale or allow larger than 1 ratio would make this parameter unintuitive...

Note that elevation scaling could also be achieved using the modelMatrix prop.

That said, having a separate prop for this is certainly easier for casual users who might not be well versed in linear algebra.
Agree. We could decide to use modelMatrix to implement the scaling of heights but probably don't want anyone except power users to directly set it. Exposing elevationScale and/or rotation sounds much better to me.

If we add elevationScale to these layers we should at least consider whether we want to update our API guidelines to state that all extruded layers should support elevationScale

We should.

I feel "binSize" or even "cellSize" as we have in the pointDensityGridLayer is more appropriate than "radius"

I don't quite get this part. It feels like the "coverage" props shows the ratio between the underlying "binning cell" and actually "rendered cell". Changing it to radiusScale or allow larger than 1 ratio would make this parameter unintuitive...

OK I see where you are coming from. Since there are two layers involved, different props might make sense for them. The basic HexagonLayer does not know anything about binning, or centroids etc, and it uses radius as the primary property defining a hexagon. On this layer, things like a radiusScale (and even a getRadius accessor) might make perfect sense.
In the PointDensityHexagonLayer I agree that the semantics are different and that it could make sense to define a different prop. Where I still struggle is that if coverage is less than 1, per the docs this does not affect what is being binned, so the link between the name and semantics of the prop and binning isn't that obvious to me. Somehow I keep feeling that this is a visual prop.
But in lieu of a better name, I could go with this (we should of course make a call on the coverage vs coverageScale question)

I feel "binSize" or even "cellSize" as we have in the pointDensityGridLayer is more appropriate than "radius"

This direction makes sense if we can find names that are reasonable in both cases.
And perhaps this could be a good way to attack the prop naming problem discussed above, i.e. clearly separate binning related props and visual props.


v0.2.0 DeployStudio crash

Using the latest pre-release v0.2.0, I am able to consistently crash the app when selecting the DeployStudio tab (and only this tab). I even tested it in a clean 10.11 VM that didn't have an old version of NBICreator installed.
The only thing in the log at ~/Library/logs/NBICreator is:
2015/12/02 11:35:05:975
2015/12/02 11:35:05:981  Starting NBICreator version 0.2.0 (build 1)...
2015/12/02 11:35:05:981  Log level: Info
2015/12/02 11:35:06:023  Couldn’t communicate with a helper application.

Even after installing the helper tool the crash still happens.

Thanks, I will investigate right away, there are a lot of additions to the helper and it's invocation. But I have never seen a crash like that. You can enable debug logging in preferences, and see if you get more ouptut, but this seems easy enough to provoke myself.

I didn't realize you added the logging info as a preference menu option! Adding log attachment to this comment.
com.github.NBICreator 2015-12-02 19-35.txt

Are there any other info available, like a crash report in crash reports or in the system log?

Ah, now I've been able to reproduce it at least, will fix asap!

DeployStudio is not installed on your systems?

Correct DeployStudio was not installed on either system. Which brings us to the next question. Yes installing DeployStudio stops the crash.
I'm assuming you can find the uncaught exception from that but I'm attaching the crash report in case that helps.
crash_report_NBICreator_12022015.txt

Added a new release, tested on systems where DeployStudio were not isntalled: https://github.com/NBICreator/NBICreator/releases/tag/v0.2.1

Tested and issue is fixed over here as well.
Thanks Erik.


Plans for supporting Open API 3.x spec?

@z0mt3c Congrats for the great plugin!  Wanted to know if you have any plans for supporting the latest Open API 3.x spec?

+1 Would love to see an OpenAPI compatible swagger plugin

+1


fix readme flag + docker file

thanks for creating a standard probe @ahmetb !
I noticed a few minor fixes while going through the artifacts. suggesting the fixes in this PR

Thanks!


CMake warnings with CMake <IP_ADDRESS>

I get this warning when building a Slicer extension, and I get it many times (so it slows down the build process):
CMake Warning (dev) at C:/devel/Slicer4/CMake/SlicerMacroPythonWrapModuleVTKLibrary.cmake:97 (include):
Syntax Warning in cmake code at
C:/devel/Slicer4_D64-bin/CTK/CMake/ctkMacroCompilePythonScript.cmake:226:24
Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
SlicerRtCommon/CMakeLists.txt:54 (SlicerMacroPythonWrapModuleVTKLibrary)
This warning is for project developers.  Use -Wno-dev to suppress it.
CMake Warning (dev) at C:/devel/Slicer4/CMake/SlicerMacroPythonWrapModuleVTKLibrary.cmake:97 (include):
Syntax Warning in cmake code at
C:/devel/Slicer4_D64-bin/CTK/CMake/ctkMacroCompilePythonScript.cmake:226:29
Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
SlicerRtCommon/CMakeLists.txt:54 (SlicerMacroPythonWrapModuleVTKLibrary)
This warning is for project developers.  Use -Wno-dev to suppress it.

Fixed by 5dae408


Restrict Access to /swagger page

Hi,
I am trying to create 2 separate swagger pages- one public and the other one private for internal use.
I was able to create separate pages using OperationProcessor but I am facing issues in restricting access to the private page. I tried to use a MessageHandler (DelegatingHandler) to check if the user is authenticated before the private swagger page is displayed. I followed the solution given for SwashBuckle on this page -
public class SwaggerAccessMessageHandler : DelegatingHandler
{
    protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    {
        if (IsSwagger(request) && !Thread.CurrentPrincipal.Identity.IsAuthenticated)
        {
            var response = request.CreateResponse(HttpStatusCode.Unauthorized);
            return Task.FromResult(response);
        }
        else
        {
            return base.SendAsync(request, cancellationToken);
        }
    }
    private bool IsSwagger(HttpRequestMessage request)
    {
        return request.RequestUri.PathAndQuery.StartsWith("/swagger");
    }
}

And I tried to register the Message Handler from the GlobalConfiguration in Global.asax.cs -
GlobalConfigurationMessageHandlers.Add(new SwaggerAccessMessageHandler());

Problem is that this message handler is not called when the swagger api is called( swagger page is displayed). However, this handler is called for the other apis present in the project.
Is there any other way to register the message handler in NSwag? If not, is there any other way to restrict the access to the private swagger page?

@jeremyVignelles wrote a middleware to do that (ASP.NET Core). I think you can easily write this as an OWIN middleware:
    /// <summary>
    /// The extension methods that extends <see cref="IApplicationBuilder" /> for authentication purposes
    /// </summary>
    public static class ApplicationBuilderExtensions
    {
        /// <summary>
        /// Requires authentication for paths that starts with <paramref name="pathPrefix" />
        /// </summary>
        /// <param name="app">The application builder</param>
        /// <param name="pathPrefix">The path prefix</param>
        /// <returns>The application builder</returns>
        public static IApplicationBuilder RequireAuthenticationOn(this IApplicationBuilder app, string pathPrefix)
        {
            return app.Use((context, next) =>
            {
                // First check if the current path is the swagger path
                if (context.Request.Path.HasValue && context.Request.Path.Value.StartsWith(pathPrefix, StringComparison.InvariantCultureIgnoreCase))
                {
                    // Secondly check if the current user is authenticated
                    if (!context.User.Identity.IsAuthenticated)
                    {
                        return context.ChallengeAsync();
                    }
                }

                return next();
            });
        }
    }

Closing as this has been answered, feel free to reopen if you need something else

You can also do something like this.
        /// <summary>
        /// Secure the swagger endpoints to only authentication users.
        /// </summary>
        /// <param name="endpoints"></param>
        public static void SecureSwaggerSpec(this IEndpointRouteBuilder endpoints)
        {
            if (Debugger.IsAttached)
            {
                return;
            }

            var pipeline = endpoints.CreateApplicationBuilder().Build();
            var swaggerAuthAttr = new AuthorizeAttribute
            {
                Roles = AuthToken.AdminRoleName
            };
            endpoints
                .Map("/swagger/{documentName}/swagger.json", pipeline)
                .RequireAuthorization(swaggerAuthAttr);
            endpoints
                .Map("/swagger/index.html", pipeline)
                .RequireAuthorization(swaggerAuthAttr);

        }

This function can be called inside IApplicationBuilder UseEndpoints in your Startup.Configure method.


metricstore: remove high cardinality labels from metrics osm metrics

They are causing serious memory outages on Prometheus at a larger number
of pods. Storing is linear (0.5Mb/pod), but once the metrics are queried,
Prometheus spikes in memory footprint really hard on these.
Disabling for the time being, we will reintroduce them with config switches
for 0.8, for setups that either can or want to handle the extra resource consumption:
https://github.com/openservicemesh/osm/issues/2408
Affected area:

Metrics                [X]
Performance            [X]

Please answer the following questions with yes/no.

Does this change contain code from or inspired by another project? If so, did you notify the maintainers and provide attribution?
No

Codecov Report

Merging #2409 (e206a09) into main (f761926) will increase coverage by 0.18%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2409      +/-   ##
==========================================
+ Coverage   58.85%   59.04%   +0.18%
==========================================
  Files         152      152
  Lines        6793     6790       -3
==========================================
+ Hits         3998     4009      +11
+ Misses       2781     2767      -14
  Partials       14       14

Impacted Files
Coverage Δ

pkg/envoy/ads/profile.go
100.00% <100.00%> (ø)

pkg/injector/patch.go
73.33% <100.00%> (ø)

pkg/metricsstore/metricsstore.go
90.42% <100.00%> (-0.30%)
:arrow_down:

pkg/configurator/validating_webhook.go
80.00% <0.00%> (+9.65%)
:arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f761926...e206a09. Read the comment docs.

Codecov Report

Merging #2409 (e206a09) into main (f761926) will increase coverage by 0.18%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2409      +/-   ##
==========================================
+ Coverage   58.85%   59.04%   +0.18%
==========================================
  Files         152      152
  Lines        6793     6790       -3
==========================================
+ Hits         3998     4009      +11
+ Misses       2781     2767      -14
  Partials       14       14

Impacted Files
Coverage Δ

pkg/envoy/ads/profile.go
100.00% <100.00%> (ø)

pkg/injector/patch.go
73.33% <100.00%> (ø)

pkg/metricsstore/metricsstore.go
90.42% <100.00%> (-0.30%)
:arrow_down:

pkg/configurator/validating_webhook.go
80.00% <0.00%> (+9.65%)
:arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f761926...e206a09. Read the comment docs.


remove form_remote_tag

I don't think we use form_remote_tag anymore
The only possible remnant I can find is link_to_remote defined here
please verify that link before merging
Looks like this is in a file that is not used anymore (was "My Tags") in config area
/cc @dclarizio @chessbyte can we kill this?

:heart_eyes:

@dclarizio @h-kataria Not sure if I interpreted your statements correctly.
Let me know if this is what you thought, and lets merge once we get the go ahead from Xav

@kbrock i had created a PR yesterday to remove the My Tags related dead code https://github.com/ManageIQ/manageiq/pull/4712

duplicate - closing


Update mccs.yml

Add USB-C ports
Source https://github.com/alin23/Lunar/blob/master/Lunar/DDC/DDC.swift
Checked on DELL U4021QW

So I think it just needs to be something like >=0x1C || (>=0x13 && <0x19)?

Yeah, question. Better cover all gaps in single value, or like I did in last commit?

I think better to combo in single. Agree with you.

@arcnmx Could you pls review?


Use Docker dependencies from tarball?

Pro:

Tarball is downloaded anyway
No time consuming check for versions of dependencies

Con:

It is more elegant to use the upstream binaries
Use the original binaries build by the upstream project
Tarball is missing rootlessctl

Superceded by #40


Nodes and Gateways software update

DeAnn Presley from KS called today. We did a Zoom call and updated her nodes and gateways to the latest firmware update. Everything was successful.
Also connected to the tablet to see the one of her gateways because it was not connecting to the network. We were able to get them working, but the nodes stop collecting data when the gateway stop communicating, this represents a big issue since we thought this was not a problem. The firmware that they had was 3.9, and we updated to 4.14 hope that will solve this last issue.

Have we established a protocol for people manually downloading data of the nodes at sites with consistent gateway issues?
@elhenriq Are you saying we need to program the nodes to forget the gateway in order for them to save data as we did last year at sites with bad/no cell service?  Seems like an urgent issue before folks start losing lots of data.

@annabirnbaum @elhenriq I think the firmware update should take care of the problem with the nodes not collecting. That was probably the issue with the alarms that the update fixes.
For manually downloading data, the first option is to get the data off of the gateway’s SD card. They should use an SD card reader instead of the menu. Only if that doesn’t work or doesn’t have all the node data should someone then connect directly to a node. Printing data from the node is slow and saving it nuanced.

@alondrathompson @elhenriq how can we test if the nodes are saving data? Can we get help with this issue?

@annabirnbaum like @alondrathompson with the latest update which everybody has now this shouldn't be a problem.
@saseehav the only way to get data and see if they are working is to connect to the nodes and manually print it to the serial port and then copy all of it.
I did it for this farm because I had the suspicion the 3.9 software had that problem and that confirmed it. As for a protocol to do manual collection, I don't think we should do it!

@alondrathompson select 3 sites where gateways have come on and off/ lost connection, and do a manual check to confirm that A) the sd card is collecting an entire set of data from the nodes and B) manual check the nodes for saving data as well, in case the sd card is not whole

@saseehav I'm not sure I understand your last comment. Are you asking me to pick 3 sites and work with the technicians to check for the data? Or are you laying out the steps for a protocol and asking for confirmation?

@alondrathompson yes, please try to find 3 or so sites, yours or someone else's that have had gateway communication go down for a period of time, or gateways that connect but cannot seem to get a message from the nodes, and confirm that either the sd card has all the data, or if not, that the data exists on the nodes. We don't have evidence that it does yet. One example might be UAN - farm in GA - gateway sent a message at start up May 25, then went down until today. One node never transmitted anything. I am not convinced the data is there from that time period.

Ok. I'll need help from @elhenriq @annabirnbaum and/or @ethansweep to find sites and get data from them. I'm not actually involved in the installation of the MD sets and neither do I have any tests of my own running right now.
Esleyther, Anna, and Ethan: I don't want to add an extra burden to you, so if you have such a site close by or are going to visit such a site anyway, let me know. If you are able to download the data and send it to me, I'll check it for missing dates and such.
@saseehav Is this how you were envisioning we do this?

I see what I can do

okay, i'll work on this.  Don't pay too much attention to UAN, it is from the winter testing, at a UGA farm, running old firmware and that one node needs a new antennae.
Anna Paulk Birnbaum
Agricultural Specialist
UGA-Department of Crop and Soil Sciences
1420 Experiment Station Rd
Watkinsville, GA 30677
C:<PHONE_NUMBER>

From: elhenriq @.>
Sent: Tuesday, June 8, 2021 2:49 PM
To: precision-sustainable-ag/On-farm-Protocols @.>
Cc: Anna Paulk Birnbaum @.>; Mention @.>
Subject: Re: [precision-sustainable-ag/On-farm-Protocols] Nodes and Gateways software update (#89)
[EXTERNAL SENDER - PROCEED CAUTIOUSLY]
I see what I can do
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/precision-sustainable-ag/On-farm-Protocols/issues/89#issuecomment-857010273, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APL6HJ666ODLR35S75I6G23TRZQ25ANCNFSM46IBTPKQ.


Refactor the props usage, and add real ID to map

Using the map index is considered to be bad practice, so I used the key={proj.owner + "/" + proj.name} that supposed to be unique.

Refactored the Project component to use Destructuring Props to avoid all the redundant props.  usages.

Some tailwind order auto fixes.

Hmm that brings back the duplication bug

Maybe we should see what's wrong with that project specifically, as it only happens with this one

I'll check that

Somehow in the fetch we get the the following repository twice:


Add new paste sites

The paste sites source has been updated to include new locations. These need to be reflected in the PasteEntity.
The paste service the record was retrieved from. Current values are:

Pastebin, Pastie, Slexy, Ghostbin, QuickLeak, JustPaste, AdHocUrl, PermanentOptOut, OptOut

Done.


Retire Common Crawl DAGs

Description

We have two Common Crawl related DAGs available in production but not enabled: commoncrawl_etl_workflow and sync_commoncrawl_workflow. We currently don't have re-enabling them as part of our future priorities, so it might be best just to retire them for now to de-clutter the DAGs view. We'll still keep the code, but we would no longer need to navigate around them in the UI :slightly_smiling_face:
I believe we could move the entirety of the dags/commoncrawl/ module into the retired folder to address this.
@WordPress/openverse-catalog - any concerns about doing this?
Implementation

[ ] 🙋 I would be interested in implementing this feature.

Hi @AetherUnbound, I would like to work on this can you assign this to me?

Definite +1 for retiring these DAGs from me. Thanks for picking this up @Pmeet!

Thank you for assigning this to me. I will try and complete both by end of the week.


"Sill Reify Mark Deleted"

Hello, I'm trying to install the serverless and am receiving this error message. Could you please assist?
C:\Users\sarah\Twilio-Outbound-Messaging\serverless>npm install npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE   package<EMAIL_ADDRESS>npm WARN EBADENGINE   required: { node: '12' }, npm WARN EBADENGINE   current: { node: 'v20.12.0', npm: '10.5.0' } npm WARN EBADENGINE } [#########.........] | reify:fsevents: sill reify mark deleted [

hello, this seems to be related to the node version in the "package.json" versus what you have in your system (which is newer).
Seems also to be a WARN rather than error, does it stop the installation after this is thrown?
You can also go to package.json and change the "engines" object to be like this
"engines": {     "node": ">=12" }
and retry


Differentiate between tagged releases and source builds in --version output

Describe the feature
We can set an environment variable in the build script to append '-dev' at the end of the version string when the binary has not been built on a git tag.
Additional context

for example, rustc:

$ rustc +stage2 -V
rustc 1.79.0-dev

$ rustc +stage2 -Vv
rustc 1.79.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.79.0-dev
LLVM version: 18.1.2

Can do it tmrw


Feature request: expose configurable hashing function?

I love jdenticon!
I'm working on a project now that could use it in an unconventional way. I want to show a table of webhooks my service receives, and visually represent similar requests. I was thinking of using jdenticon with a hash function designed to optimize collisions as opposed to avoid them (for example the Nilsimsa hash). To do that, I would need to be able to pass jdenticon a hash function. How would you all feel about exposing a configurable hash? I'd be happy to put up a PR for it.

I believe I've found that you kind of already do this. Am I correct in saying that if I pass a valid hexadecimal string, it will not be hashed, and it will be rendered directly?

Yes, you're correct.


Is there a way to convert AST back to query string?

Hi,
I'm trying to come up with a way to split graphql servers into multiple servers.
Let's say I have three objects in my schema,
object1: should be queried against server 1
object2: should be queried against server 2
object3: should be queried against server 3
Then I will have an API Gateway that is aware of where those objects are.
My first step is to see if there is a way to get a portion of query.
Let's say I have the following query
{
  test: Creative{
    id
    products {
      name
    }
  },
  hello: HelloWorld
}

I would like to get the following string from "Creative" resolver. It looks like I can get AST from OperationDefinitionNode object, but I don't think there is a function that converts AST back to string.
{
  test: Creative{
    id
    products {
      name
    }
  }
}

Is there a way to do that already or should I implement it myself?

Use printer:
GraphQL\Language\Printer::doPrint($myAst);

@vladar Thank you!
Is there a way to access AST in a resolver?

Which part of AST?
Resolver signature is function ($value, $args, $context, ResolveInfo $info).
ResolveInfo has $info->fieldNodes (AST of the resolved field), $info->operation (AST of the operation definition) and $info->fragments (list of operation fragment ASTs)

@vladar That's all I needed. Thank you so much for taking for to reply!


ci: manually install yarn before using it

No longer needed; relevant changes have been made in #21


Can't receive the message

在一个页面打开的时候会收到其他几个页面发送来同样的EventMessageBean,但是EventMessageBean里面的type不一样，会导致只接收到一次数据，剩余的页面发送的都收不到
When opening a page will receive several other page is sent to the same EventMessageBean, EventMessageBean inside of different type, can cause only receives the data at a time, don't get to send the rest of the page

这个页面打开的时候会同时收到其他几个页面同时发来的消息，导致消息只能接收第一条，其他的都收不到。
When this page is opened, it will receive messages from several other pages at the same time, resulting in only the first message can be received, and the others cannot be received.

It appears you are using sticky events. To prevent receiving the same sticky event again, use removeStickyEvent. See the documentation.
Does that solve your issue?