how to reset the keyring of stored email password in Visual Studio Code in Windows with yagmail? - visual-studio-code

I'm using knockknock to email myself when training a model is complete.
I am using VS Code. The first time I
use the #email_sender(recipient_emails=email_address), it prompted me for a password, which I typed in the wrong one.
Unfortunately VS Code stores the password in a keyring, and I cannot figure out how to reset this value. How to reset the password stored in the keyring?
VS Code apparently only prompts you for your email password the FIRST time you use knockknock's #email_sender decorator, but every time after that, VS Code does NOT prompt for the password, so I have no way to adjust/fix the password to the right one.
How to reset the stored password in the keyring? I think knockknock uses the yagmail library

It took me a while but I eventually found the solution:
import keyring
# to show the set password
print(keyring.get_password("yagmail", "your_email"))
# to change to the current password
keyring.set_password("yagmail", "your_email", "new_password")

Related

Selenium WebDriver - Datadriven testing

I am testing a website using Selenium Webdriver.
Eclipse has to fetch username from excel.
When the Username data in excel is xyz
my test enters the username value twice, xyzxyz, into the form.
How can I fix it so that the data is entered only once.
Code is:
driver.findElement(By.id("username")).sendKeys("xyz");
Add the following statement before the SendKeys line, so that the field is cleared before the filename is entered.
driver.findElement(By.id("username")). clear();
(Answer derived from a comment by #Subh.)

Why isn't psycopg2.connect checking the password?

I'm playing with psycopg2 for the first time today, and I'm trying to understand how passwords work... I have a test script which drops a table, recreates the table, adds a row, and prints the row. My question is why does the connect command work whether or not I give it a correct password? e.g. this line:
conn = psycopg2.connect(database="mydb",host="localhost",port=5432,user="amos",
password="asdf")
and this line:
conn = psycopg2.connect(database="mydb",host="localhost",port=5432,user="amos",
password="asdf123")
unexpectedly do the same thing, and the rest of the script completes with no error. Clearly only one of those lines should work regardless of what the password actually is. As expected, I do get an error if I try a user="amos123", since that user doesn't exist. If it matters, my PostgreSQL was installed with Postgres.app.
After some research, I discovered that login criteria are specified in a file called pg_hba.conf, which in my installation by default has this line:
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust
which according to this the trust value means it doesn't check passwords. I guess that was unintuitive to this newb because if that behavior was what I wanted, I wouldn't have set passwords in the first place. I'm posting it here to save future googlers some time.

Create event log entry with powershell and fill in user

I need to create entry to Windows Event Log (e.g. application log). I know how to do all the stuff beside filling in the user who performed the action.
Example:
I need to create a script, that writes some message into application log. I used this tutorial, which worked fine: http://blogs.technet.com/b/heyscriptingguy/archive/2013/06/20/how-to-use-powershell-to-write-to-event-logs.aspx
But I am not able to influence the "user". When adding entry in windows log, it always fills "User: N/A".
Any idea how to pass "user" argument to the "write-eventlog" cmdlet?
Thank you for your help.
Even though (as far as I'm aware) Write-EventLog does not provide an option to write directly to the "User" field, you have two workarounds:
Use built-in standalone exec "EventCreate.exe" (type in eventcreate /? to see the manual)
This one does support providing the username field. I'm not sure, but it may require a password for that user too.
Second workaround would be to pass $env:USERNAME to the "message" field of Write-EventLog. This way you will still obtain the environment's current user.
I hope that helped.

reading password protected excel file using matlab

I am trying to read a password protected excel file, the problem I am having with the following code is it does not take care of password, but instead excel application opens but user has to go to taskbar and click excel app to see the password query.
path = fullfile(pwd,'tests.xls')
e=actxserver('excel.application');
eW = e.Workbooks;
eF = eW.Open(file3,'GSL');
[num,txt,raw] = xlsread(file3, 1);
I can think of two ways to solve the problem. I don't have access to a Windows machine so you'll have to figure out the details yourself:
Use Matlab's GUI functions to ask the user for the password. Then, supply that password to the Open method along with the filename (Excel Open method documentation).
After calling actxserver try to bring the Excel window into focus so that when you open the file, the password dialog box is visible. Something like described here should work.

Get contents of password variable in response file

I'm evaluating install4j. The installer I'm trying to create uses a passwort text field. The value of this field should be written to the response var file as encoded value. Additional the installer must allow two installation paths:
a normal path ("advanced") that allows the user to see every screen and check/enter every value - using this path, the password field works fine.
a simple path that should use all values of a former installation that was succesful, to allow the user to start an update installation without seeing all screens.
Using the simple path (without showing the screen that contains the password field) it seems that at installation time only the encoded variable ("passwordField".encoded) is available but not the "real" password variable. Is there a chance to get the "real" password variable without showing the screen that contains this variable - maybe by using some kind of "decoding method"?
Thank you very much for your help!
Frank
Add another password component with the same variable to a screen that is shown on the simple path and set its visibility expression to "false". Then that invisible component will update the variable with the decoded value.