command line – Run a piece of code in the background while using a script

Hey there I have a (for me atleast) complicated question.

I have a script that interacts with the plex (and sonarr but that isn’t important) api. I made it look and work like an interface. See the pictures:

I run the script and this is the first thing I see:

Home page

I choose to interact with the plex api and get to see the following page:

Home page plex api

There appears to be an update available for pms so I select “update”:

Updating but someone is using plex

But someone is watching a movie or series. So it doesn’t update because updating shuts down pms which would stop the stream of that person. So I made the script show that message when that happens (instead of updating). It shows it for 10 seconds and after that you go back to the menu in picture 2.

When nobody is streaming, it just goes through the update process and after that brings you back to Home page Plex API.

Now comes the question

I want to make an option called notify (an option like I could choose “plex” and “update” and now I want “notify”). So at the bottom of the message in picture 3, I would have exit | back | notify: (instead of sleeping 10s and going to Home page Plex API).

When I choose that option, it needs to run some code in the background. So it immediately goes back to Home page Plex API but in the background, it checks every 2 minutes if there’s still anybody watching. And when there isn’t anymore, it sets a variable to false.

But the problem for me is “in the background”. I want to run that piece of code in the background so that I could use the script in the mean time. So I choose “notify” and am then immediately able to use the script again. I can do (aka choose options/access parts of the api) anything I want, while in the background that part of code is running. And after it detects that that variable is set to false, it stops running in the background.

Do you have any idea how to do this?

Normally I’m already trying things and testing out if something works but with this problem, I really don’t know what to do/where to begin.

spyware – Possible screen share in the background by Bitdefender

Recently I was chatting with Bitdefender support through their support center and one weird thing I noticed was that the support person would be answering my questions right after I sent them without even taking the time to read or think about them and sometimes they would answer it before I even sent the question. So this raises my suspicion that they would somehow know what I’m typing through some sort of screen share. When I monitor my network usage there are constant connections by Bitdefender agents in the background. They frequently connect to the network. If it’s some update check shouldn’t it be done like every hour or so instead of all the time? I fear there is some sort of periodic screenshot share at play here. So can anyone give me any sort of assurance that nothing is being shared and that I am safe using their products?

photo editing – What is the importance of background color when removing the background?

While any color can serve you well, three ways have emerged that can help you:

White background

You simply have a white background and try to illuminate that so much, that the RGB value for this reaches 255/255/255 which means it is pure white.

Pro: Very clean image

Contra: Need to be careful not to overblow the background so much that the edges of the subject become blown out as well, if you have rim light on the subject, the edges are not that clearly defined anymore.

Chromagreen or Chromablue background

Similar with other chances and problems. As long as the color does not appear in your subject, it makes the whole process even easier, as you don’t need to exactly overblow the background and can have a variety of shades in here before it ceases to work.

Pro: Easier to pull off, does not need exact or even lighting

Contra: If there is not enough space between the subject and the background, you might end up with the chroma color shining onto your subject which pollutes the color on the edges of your subject. You can see that sometimes in older films when the telltale blueish rim spoils the special effects.

Variant: Grey Background

This one is a bit more work but with some advantage. If you want to insert a background texture anyways, a grey background lets you keep the natural shadows. You basically shoot the image with background, insert the final background and then blend the texture over your subject, masking out the subject itself. While this is technically not the same as killing the background, it might be an alternative in certain situations.

photoshop – How do I change the background layer default color to white?

I’m looking for a similar resolution, but with mine any new document I open, opens with a transparent background as default… but I’ve followed the answer above and checked the background contents settings and thats set to white…

also as well… for example I’ve created a shape (triangle) and in the layers panel for that triangle layer the thumbnail is showing a transparent checkered pattern across the whole thumbnail not showing the shape at all because it thinks the background is transparent.

I’m sure there’s a setting somewhere in the preferences perhaps (unable to locate it – hence why I’m asking) where you can set the defaults and tell photoshop every new document or new layer default to white, black or black background.

if you can help
Many Thanks

Matt

python – How can I change the background color of the image?

I’m trying to change my background image color, but somehow it doesn’t work.

I have provided my code below and hope you will be able to tell me how I should do this, and why my code didn’t work.

import pygame

class Wooden_Boy:

    def __init__(self, win_game):

        self.screen = win_game.screen
        self.screen_rect = win_game.screen.get_rect()

        self.image = pygame.image.load("alien_invasion/images/wooden_boy.png").convert()
        self.image.set_colorkey((0, 0, 255))
        self.rect = self.image.get_rect()

        self.rect.center = self.screen_rect.center

    def blitme(self):
        self.screen.blit(self.image, self.rect)

This is my second code which is connected with wooden boy:

import sys
import pygame
from wooden_boy import Wooden_Boy

class Window:

    def __init__(self):

        pygame.init()

        self.screen = pygame.display.set_mode((1200, 800))
        pygame.display.set_caption("Pygame Window")

        self.boy = Wooden_Boy(self)

        self.bg_color = (0, 0, 255)


    def run_window(self):
        while True:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    sys.exit()

            self.screen.fill(self.bg_color)
            self.boy.blitme()

            pygame.display.flip()

if __name__ == "__main__":
    win = Window()
    win.run_window()

photoshop – Wthat is the importance of background color when removing the background?

We are looking to make product images like this: https://prnt.sc/1067x5x . This is one of the best results that we have achieved with smartphone camera. Our process:

  1. Place an item on a grey background (works slightly better than white)
  2. Remove background automatically with Adobe PS + go through some spots manually to fix wrong cuts

My question is: what is the difference in backround colors, when it comes to automatic background removal? Like for example green being used in videography, will changing background to some specific color help automate background removal?

P.S. Any suggestion for software is much appreciated.

Firebase Cloud Messaging push notification not working in foreground, only background, on Android

I’m trying to create an app that can receive a notification when certain requirements are filled. I tried to set up a seperate project to make a simple cloud messaging system but no notifications show up when the app is running in the foreground, only in the background.

Here is the main MapActivity code:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
        Intent intentBackgroundService = new Intent(this,FirebasePushNotification.class);
        startService(intentBackgroundService);
    }

The firebase Messaging Class:

package com.example.traindetectionproject;

import androidx.annotation.NonNull;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

public class FirebasePushNotification extends FirebaseMessagingService {


    public FirebasePushNotification() {
        super();
    }

    @Override
    public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
    }
}

The manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.traindetectionproject">

    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the "MyLocation" functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Traindetectionproject">

        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>



    <service android:name=".FirebasePushNotification">
        <intent-filter>
            <action android:name="android.intent.action.RESPOND_VIA_MESSAGE"/>
        </intent-filter>
    </service>
    </application>

</manifest>

Thank you for any advice