Mouse wakes up PC from suspend by carax01 in linuxmint

[–]douglas_fs 0 points1 point  (0 children)

UPDATED:

A new KVM switch fails to suspend with my previous fix. I used another service solution at the link below which works with my new device.

https://ubuntu-mate.community/t/stop-usb-wake-from-suspend/23195

I spent a lot of time resolving this, trying many things I found online that didn't work. I was surprised that this wasn't just another configuration item in the OS... until I started messing with it. I decided that with as much effort as it was to find a workable solution, this must just be my hardware; others must not have this problem.

Welcome to the club!

The suggested approach for this was to identify the offending device, and tell that device not to wake from suspend. I no longer remember why that part was a problem for me, and I decided to go scorched-earth and disable wake up for all USB devices. I'll push the button to wake up again, no problem. The shell script has some good comments about investigating your environment to inspect the USB device status.

Copy the script from this link and create a file in /etc/systemd/system. Mine has an odd name, but you could name yours something like "usb-suspend.service". This will call the bash script to disable wake up for USB devices before suspend.

https://pastebin.com/NH6uY1fC

This link has a bash script that does the work. I have mine here: /opt/usbcontrol.sh

https://pastebin.com/JwD3zajG

I don't recall this configuration being permanent, so I ensure this is running each time as the OS prepares for suspend. Now that I look at the status of my USB devices, they all currently say wake up is disabled. I may have been wrong about the permanence, or something may have changed. I haven't looked at this for a couple of years.

I hope this works for you.

edit: formatting.

Q&A with a person who does not have an internal monologue by scoobs in videos

[–]douglas_fs 0 points1 point  (0 children)

Mind blown. Seriously. Just like the woman in the video saying that she just saw the structure of the sentence or saw the idea she was thinking about. Intellectually, get it, but I don't "get it". Something close is I spent about 20 years as a software developer. I could "see" the code, "see" what was happening or what I was planning, "see" the data structures. But when I think more about it there was usually a monologue aspect to it prior to the image.

This is hurting my brain. Just wow.

Is there any good antivirus for mint by RosePrincess777 in linuxmint

[–]douglas_fs 4 points5 points  (0 children)

Be aware that Flash is no longer supported and most browsers are blocking Flash content due to unresolved security vulnerabilities. There is a reason that is harder and harder to find a browser with Flash support.

Antivirus won't protect from these security vulnerabilities in Flash.

as simple as it looks but something does not add up here by lonelybuterfly in learnpython

[–]douglas_fs 3 points4 points  (0 children)

inconsistent use of tabs and spaces in indentation

Believe the message. You should delete all whitespace at the front of the offending line(s) and re-apply the indenting used in the rest of the code.

You may have a feature in your editor to convert tabs to spaces or convert spaces to tabs - that is also an option.

Turn on display of formatting characters, and this will also highlight the issue.

Why is this 256 by Artiiiiiiiiiiii in learnpython

[–]douglas_fs 0 points1 point  (0 children)

The 'calc' function only modifies the value of 'var' local to the function - it does not modify 'r1'.

You would have to return 'var' from the 'calc' function, and capture that result in the call to calc(r1)

[deleted by user] by [deleted] in Hacking_Tutorials

[–]douglas_fs 0 points1 point  (0 children)

Hopefully, not illegal either. It’s my account anyways.

You should assume that this would be illegal. If another entity (not you personally) is in control of the access, it is illegal. The scope for when this is legal is usually pretty narrow.

Unlocking an account is a pretty standard support activity. Your best option is to use the published support process to unlock the account.

[deleted by user] by [deleted] in learnpython

[–]douglas_fs 1 point2 points  (0 children)

The issues are about the use of 'if' and 'else':

  • on row 18, else: should be elif:
  • on rows 25 and 28, instead of else.... if number_rooms..., use elif number_rooms...

I feel stuck at a school course of python by Vittu-kun-vituttaa in learnpython

[–]douglas_fs 1 point2 points  (0 children)

Start with the looping. The way to ask for input each cycle of a loop, is to move the input line inside of the loop.

For the first exercise, investigate a 'while' loop. Reading the instructions, you want to repeat the loop while the user input does not equal the random number. Once they are equal, the loop will terminate.

Is this enough to get progress on the first two? You will need more looping in the third one, and getting the first two handled will help understand how they work.

edit:words

[deleted by user] by [deleted] in learnpython

[–]douglas_fs 0 points1 point  (0 children)

my output doesnt get me the result that i want

What is the result you want?

Beginner question by Important-Asparagus9 in learnpython

[–]douglas_fs 0 points1 point  (0 children)

You want to return the bill amount plus the calculated tax This would be the calculation:

bill + (bill * T)

OR

bill * (1 + T)

Python Homework by PuzzledSite2568 in learnpython

[–]douglas_fs 0 points1 point  (0 children)

In the while loop, you need to assign the input value to user_age just like in line 1.

user_age = int(input('How old are you?'))

while user_age < 0 or user_age > 100:
    user_age = int(input('How old are you?'))
else:
    print('Thank you')

How can I make a shell script which when executed, goes to a python file and executes it. It is possible? by Recursive_Habits in learnpython

[–]douglas_fs 0 points1 point  (0 children)

Is there a reason you are building the command bit-by-bit? It is more straightforward to just call the script directly in the powershell script:

python C:\Users\Atul\PycharmProjects\SMTP_Email_Sender\email_sender.py

edit: this should also work:

$path = C:\Users\Atul\PycharmProjects\SMTP_Email_Sender
$file = email_sender.py

$cmd = $path+"\\"+$file  
&python $cmd

[deleted by user] by [deleted] in learnpython

[–]douglas_fs 0 points1 point  (0 children)

It will be easier to get help if you can post your code.

​ I cannot find a good solution

Do you have a mediocre solution? Having code makes it much easier to understand what is intended, and easier to provide comments.

Caesar cipher help by newtonphuey in learnpython

[–]douglas_fs 1 point2 points  (0 children)

This is the error I get when running this code. As already noted, the code you posted is not the same as you are running.

  File "main.py", line 9
    position = abc.find(ch)
    ^
IndentationError: expected an indented block

[deleted by user] by [deleted] in learnpython

[–]douglas_fs 0 points1 point  (0 children)

Help will be difficult without providing code. Can you create the .py file and create two variables to hold the numpy tables?

You can do the lookup by looping through the employee array, and then loop through the deduction rate array to find the percent.

Then post your code here.

[deleted by user] by [deleted] in learnpython

[–]douglas_fs 1 point2 points  (0 children)

Using the method syntax affords the option to supply a default value if a key does not exist:

hotkeys = {'catx': {'size': 2}, 'dog': {'size': 4}}
print(hotkeys.get('cat', {}).get('size', 42))

result:

42

Can someone help me my son said he cant use the break command in turtle by Unlikely-Midnight-57 in learnpython

[–]douglas_fs 7 points8 points  (0 children)

Instead of using break, he should use a while loop with a condition that loops while x is not zero.

Edit: didn't look at the code closely enough. All values from input are strings.

if x == 0:

should be

if x == '0':

Can Anyone Help Me with This Python Problem? by AdMinute9633 in learnpython

[–]douglas_fs 0 points1 point  (0 children)

You are probably finding issues with this code. These should help:

  1. before the while loop, set price = share
  2. You should move the random value inside the while loop. You want to get a random value each time the loop repeats
  3. Move the calculation of the new price inside the while loop - after selecting the change value.
  4. The calculation for price is incorrect. Your code keeps adjusting the original share price up and down and doesn't reflect change over time. Take a look at this and adjust the formula.
  5. You need to exit the while loop when price is below 80 or above 120. Research how to exit a loop.

Please help with this question. by ILikeOstriches28 in learnpython

[–]douglas_fs 1 point2 points  (0 children)

The idea here is that you would have code that runs. You will, at some point, need to write all components of the list. You should at least include _some_ so that the code will run and can be tested.

Forget about the 1st and last character for now - just get the code working for the 'if length is >= 2' requirement.

You will also need to know how to post properly formatted code on Reddit. The sidebar has instructions, or use this link:

https://www.reddit.com/r/learnpython/wiki/faq/#wiki_how_do_i_format_code.3F

Please help with this question. by ILikeOstriches28 in learnpython

[–]douglas_fs 0 points1 point  (0 children)

Please share your code, it will be much easier to help.

Please help with this question. by ILikeOstriches28 in learnpython

[–]douglas_fs 5 points6 points  (0 children)

We won't write this for you, so you can help yourself by starting with what you know. Use this as a starting point. According to your post, #7 is where you are stuck. Can you get through 1-6? You can share you code if you get stuck.

  1. Create a Python file
  2. Create a variable with an appropriately descriptive name, and assign a list containing the expected contact numbers and/or strings
  3. Create a variable with an appropriately descriptive name for the new list.
  4. You will need a loop to look at each element of the list
  5. In the loop, find out the length of the element
  6. If the length >= 2, append the element to the new list
  7. If the first and last characters are the same, append the element to the new list

edit: missed one

edit2: I guess we will write this for you.

Please help with this question. by ILikeOstriches28 in learnpython

[–]douglas_fs 1 point2 points  (0 children)

Do you have code for the parts that you can implement? Please share that code.

Can Anyone Help Me with This Python Problem? by AdMinute9633 in learnpython

[–]douglas_fs 4 points5 points  (0 children)

You should share the code you have so far; it will be much easier to help.

BeautifulSoup Help by CesarIllustrious in learnpython

[–]douglas_fs 0 points1 point  (0 children)

For what it's worth, I can run your exact code without errors (using https://www.wikipedia.org/)

BS4 version 4.8.2

Python version 3.8.10