sliding window maximum

I have a stream of tuples arriving in the following form : (timestamp,price). There is no pattern in the arrival of these data points (number of data points per minute is random). I need to be able to return the maximum price in the last hour at any point of time. What is the most efficient algorithm in terms of time complexity and space complexity separately to do this ? I thought of the following: 1) create 1 min candles of prices, which will reduce the storage but then wont be exactly correct 2) store the top K elements with their price and timestamps and update this list according to the current timestamp

Unintended window opening when pressing Unity’s “Submit” button

I’ve been working on a top down 2D game for a while now, and yesterday I found a strange bug that I just can’t explain to myself whatsoever. I have a loot window for looting enemies, as well as a character panel to equip gear/see stats. I realized that after I open and close a loot window, if I spam the space button (used for attacking, not for opening any windows) it sometimes (seems to depend on screen positioning) opens the character panel. Once I “found” it, I can spam space to open/close the character panel.

Went to the character panels OpenClose() function (all it does is set the canvas group alpha to 0 and block raycast to false and vice versa) which is being called unintendedly, put a debug.log inside to verify if it really was being called, and yes, it is. I look up all references to see where I used it, but I only use it in a single place in the project that is behind an if-statement looking for they keycode C (NOT space). I added a debug.log for the Input.inputstring to see if somehow a magic C button press is ending up in that function, but no. If I press C to open the window, the debug log pops up, if I press space, the inputstring appears to be empty, so the if statement to get to the only place in the code referencing that function cannot be met. Removed the space button from my Player entirely, the behaviour still persists.

Added another debug.log with stackTrace.GetFrame(1).GetMethod().Name to show who is actually running this function, but it turns out that if I run it and press C, it says it’s being opened by the update function in the UIManager (as expected). If I run it the strange, unintended way, it says it is being run by the EventSystems Invoke function. Coupled with the fact that the behaviour persists despite the space button being removed from the player, I realized that it’s Unity’s built in “Submit” button being pressed.

Strange behaviour:

  • If I rename the OpenClose() function that is being called to anything else, the behaviour stops. Looked for all references of the OpenClose string through the entire project, it only shows up in the other 7-8 OpenClose functions for other windows I have, that seem to work normally.
  • It appears to call the submit function on the OpenClose button for the character panel, but only under the circumstance that I closed a loot window and haven’t clicked the mouse anywhere yet afterwards. If I deactivate the button that holds the character panels OpenClose function, the behaviour stops. The button shouldn’t be pressed though, because it is on a canvas group with alpha 0/block raycast=false, just like all the other buttons with the identical function that work fine. The loot window has no idea about the character panel either, and all the windows are properly wired to their own OpenClose function.

So basically my issue is; how do I figure out why this function is being called? It feels as if closing the loot window somehow “caches” the OpenClose button for the character panel onto the submit button, but only until I click elsewhere on the screen. Did you guys have any experience with a similar situation? Could you share some pointers on how to debug this? I’ve spent about 4 hours on this now and don’t know how to get any further.

Thanks for the long read! Any help appreciated.

Connect-PnPOnline -Url -UseWebLogin hangs with a blank window

I’m trying to connect to a site where I’ll try to upload some documents, here is what I try to do:

Connect-PnPOnline -Url  https://<mysite> -UseWebLogin  

What happens is it just opens a blank window and hangs.

What I have tried to do:

  • Connect-PnPOnline -Url https://<mysite><my-site> -UseWebLogin (use the full pat h to the site)
  • Connect-PnPOnline -Url https://<mysite><my-site> -UseWebLogin (use that path before it was redirected)
  • Connect-PnPOnline -Url https://<mysite> -UseWebLogin (same only with the root)

Logging into the site on the web works fine however, as does Connect-PnPOnline -Url https://<mysite><my-site> -Credentials (Get-Credential)

I’m on Windows 10, PowerShell version 5.1 and I’m using SharePointPnPPowerShellOnline version 3.13.1909.0.

Any ideas on what I can do to fix this would be appreciated.

Any ideas?

SER sometimes requires “two clicks” to bring window to front

Hi @sven, a bug I’ve noticed since have been using SER a lot lately. In Windows 7 (possibly Windows 10 as well), SER requires “two clicks” when you have a project running and navigate away from the SER window.

To re-create the bug:

– Open SER
– Start a project (make active)
– Click to another taskbar program, for example, Excel
– Wait a while, don’t click on SER immediately after
– Click on SER icon in the taskbar
– SER doesn’t recognize the click, the window does not open
– Click SER taskbar icon again and it will show properly

This is a small but really annoying issue as when a program is clicked you would expect it to appear accordingly. It could be a Windows problem, but I’ve never encountered this with any other program besides SER.

Update: I actually just had this issue without an active project. Does SER have some sort of “sleep mode” that requires 2 clicks to re-open the window after you haven’t clicked it in the while or something?

Ubuntu 18.04 File Explorer with Preview window like MS Windows File Explorer

Ubuntu 18.04 Gnome 3.28.2 – I have a ton of documents and images that I need to go through efficiently without having to open them or hit the spacebar. I just want to select them in file explorer and have a preview similar to what Windows File Explorer generates on the side. I am using Nautilus. I do have Dolphin but have other issues there like not seeing symbolic links and no previews there either. I don’t know how to obtain what I want.

Compiz: Fixed window placement, which alternative?

At login two windows are automagically opened. For the purpose of fixed location of these, I am trying CompizConfiguration Settings Manager, function Place Windows. The Fixed Windows Placement tab gives me three choices: Windows with fixed position, Windows with fixed placement mode, and Windows with fixed viewport.

What is the difference between these alternatives? I have tried to find an explanation, but miserably failed. Any light on the matter is gratefully received.

See also 1.

take-vector-screenshot: focusing the window before taking the screenshot

I am using take-vector-screenshot to take a PDF screenshot.

When I launch take-vector-screenshot, I have to click a button within its window in order to begin the screenshot process. I then need to pick the window to take a screenshot of.

A button is required to be clicked to start the process

In the process of clicking this button (pictured above), the focus changes from the window which I actually want to capture. Hence the screenshot I get is of an unfocussed window, which is undesirable.

I can use wmctrl -a $ WINDOW_TITLE to focus the window I want to take the screenshot of, but this doesn’t work if I precede it with e.g. a sleep 3.

Any ideas how I can get this to work?

unity weird window

There is a weird window on my desktop that is not going away. It happens occasionally, I think it is triggered by mouse action:

unity desktop

This window does not belong to any application. Window icons are blanked out as well:

icons, white

It appears on all desktops, I have no idea what this is doing. I am using Ubuntu 16.04


  1. how do I trigger this behaviour?
  2. what is its purpose?

what is crashing/exiting my gnome window session?

From time to time (but really too often) my desktop environment (for now xfce4) exits/crash itself and the system goes back to the login screen (gdm) silently.

In syslog I can see in correlation with the time of the exit a bunch of :

Oct  1 16:30:25 ultraviolet update-notifier[23392]: update-notifier: Fatal IO error 11 (Resource temporarily unavailable) on X server :2. Oct  1 16:30:25 ultraviolet gsd-keyboard[22021]: gsd-keyboard: Fatal IO error 11 (Resource temporarily unavailable) on X server :2. Oct  1 16:30:25 ultraviolet google-chrome.desktop[22244]: [22517:22523:1001/] X IO error received (X server probably went away) Oct  1 16:30:25 ultraviolet google-chrome.desktop[22244]: [22244:22244:1001/] X IO error received (X server probably went away) Oct  1 16:30:25 ultraviolet gnome-session-binary[21647]: WARNING: App 'org.gnome.SettingsDaemon.Wacom.desktop' exited with code 1 Oct  1 16:30:25 ultraviolet gnome-session[21647]: gnome-session-binary[21647]: WARNING: App 'org.gnome.SettingsDaemon.Wacom.desktop' exited with code 1 Oct  1 16:30:25 ultraviolet gnome-session[21647]: gnome-session-binary[21647]: WARNING: App 'org.gnome.SettingsDaemon.Clipboard.desktop' exited with code 1 Oct  1 16:30:25 ultraviolet at-spi-bus-launcher[21769]: XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":2" Oct  1 16:30:25 ultraviolet at-spi-bus-launcher[21769]:       after 1175 requests (1175 known processed) with 0 events remaining. Oct  1 16:30:25 ultraviolet gsd-xsettings[21987]: gsd-xsettings: Fatal IO error 11 (Resource temporarily unavailable) on X server :2. 

but my Xorg.log doesnt say anything during that time.

Where can I start to investigate ? What can I try ?

Thank you for any pointer 🙂

nb: not sure if this is relevant but this is a multiseats system.

minimizing/restoring multiple windows with one action instead of doing that for each window

I use Ubuntu 16.04 and have to build/run an Android application on multiple emulator at the same time to compare differences between them. This requires minimizing/restoring windows of multiple emulator for each test which is annoying. I want to know is there a way to do minimizing/restoring those windows with one action instead of doing that for each window? For example is it possible to merge multiple windows into one? Or can I group them?

Note: I do not want to do minimizing/restoring all windows, I want to do that for some windows.