Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What part is unclear?

aditya_#2 commented: how to get the username and password of same one together . +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Since split already returns an array of strings, why would you want to use individual variables? Surely it is easier to use an array of any length rather than scalars where you will eventually have one more string than you have variables.

Split splits by default on blanks so you could just code s.split().

For future reference, never code successive If statements like that. Use Select Case.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Concerning "efficacy", while the various vaccines differ in the efficacy rates (the ability to prevent infection), all of the vaccines are 100% effective in preventing death due to covid-19. Even with a vaccine efficacy of 67%, if you get the vaccine and subsequently develop covid-19 your symptoms will be mild enough that you will not require hospitalization.

Get the vaccine. The one you should get is the one you are offered.

rproffitt commented: The Polio Vaccine was (only?) 70% effective yet it changed the course of history. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Whatever basic you are using I suggest using a regular expression. The following expression will match any word of more than one letter (no apostrophes) as long as you use the ignore case option.

([a-z])[a-z]*\1

The first [a-z] matches the first letter in a word. Putting it in parentheses allows us to refer back to the matched letter with \1. The rest of the expression [a-z]* matches all remaining letters in the word. So the full expression is

  1. the first letter
  2. all other letters
  3. whatever the first letter was
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'd like to add a correction to my earlier post about mRNA vaccines.

Conventional vaccines contain a weakened or dead strain of a virus. Your immune system reacts the same way it would to a live virus by creating antibodies to attack the virus. The new covid-19 vaccines do not use a weakened or dead virus. The mRNA vaccines encode the spikes, but not the body of the virus. The spikes are what allow the virus to attach to cells and replicate. It is the body of the virus that is dangerous. Your immune system reacts to the spike mRNA by creating the same antibodies that would be created by the actual virus so when you are exposed to the actual virus, the antibodies bind to the spikes, preventing the virus from infecting cells and replicating.

Where most of the new vaccines use mRNA, the Astrazeneca vaccine uses double stranded DNA packaged in a chimpanzee adenovirus. This virus is used to deliver the DNA payload but cannot replicate in a human host. Double stranded DNA is less fragile than mRNA which is why the AZ vaccine can be stored at more normal temperatures.

As a side note, there is evidence (currently unverified by larger studies) that people who have suffered long term disability after recovering from covid-19 have seen imporovement after receiving the vaccine.

I get my shot on April 12.

rproffitt commented: (engaging joke mode) "I now get full bars on my phone." Last week was my second dose! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Suggestions:

  1. Store all values as cents (integers) to avoid conversion/rounding problems.
  2. Create a list of change denominations from largest to smallest
  3. Use a loop with that list
rproffitt commented: Good idea. Don't need a Superman III repeat. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

With new voting rights legislation proposed (supposedly including an end to gerrymandering) how about this as a simple guideline.

  1. The smallest rectangle that contains a district cannot be more than 1.5 times in one dimension than the other.
  2. The area within the rectangle must be at least 95% district.
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

One final suggestion. You could use wxPython to create an app with multiple frames and use a timer for each separate function. Each function could maintain its output in a dedicated frame/panel containing a multi-line textbox. Using this approach would allow you to trigger on timers as well as buttons/menus.

There are several wxPython tutorials on this site as well. I recommend wxPython over tkinter.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It seems to me that a simple solution would be to set up each script on a loop and put a pause at the end for the interval you want.

import os
import sys
import time

try:

    while True:
        #put your  processing code here
        print('tick')
        time.sleep(5)   #sleep for 5 seconds

except KeyboardInterrupt:

    #This gets triggered on CTRL-C from the keyboard
    #Put your clean-up code here
    sys.exit()

If you wanted to keep all your data in one place you could set up a sqlite database.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In the event that this is for work rather than for personal use I highly recommend adTempus. It is an excellent package for scheduling processes and supports a large variety or trigger types including folder events. I'm not paid to endorse it. I just used the product for several years and was impressed by it's capabilities and the quick response to any questions I had. It is also very reasonably priced. Just a suggestion in case you have an actual budget and the need for such software.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Depending on what the scripts are doing and how fast they need to react you could always build in pauses to reduce cpu loading. Or, if your processing depends on, for example, the appearance of files, you could implement a folder watch which would idle itself until a predefined folder event occurs.

I have a script that I run when I want to download a sequence of images from one or more websites. The main loop watches for the creation of a window titled "Save As". When this window is detected it scans the current folder for names like "Image ####.jpg" and auto-generates the next available number in the sequence. It then pastes this name into the filename box of the Save As window. It then clicks the "Save" button. It saves me a lot of useless typing and clicking. The main loop runs with a one second sleep so there is essentially no overhead when there is nothing to do.

What is it your scripts are supposed to do? Perhaps I can offer some suggestions. The majority of what I did before retiring involved automating real time processes that had to run continuously.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You sound like a Jordan Peterson clone or someone who has stumbled across the BS Generator site. If you are trying to make a point you have totally obscured it with meaningless jargon. Instead of trying to impress us with your mastery of buzzwords why don't you try again in plain English.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Is there a reason you need to run the scripts from within idle as opposed to just running the scripts directly? If so then I suggest you look at AutoItX. I've been using AutoIt for years in both a corporate and home environments, originally from vbScript but now from Python. While the splash page says "basic like scripting language", it also installs a scriptable (from vbScript/Python) component that you can create by

import win32com.client
aut = win32com.client.Dispatch("AutoItX3.Control")

There is an AutoItX help file that you can refer to after installation to get details. In includes extensive controls for window and mouse manipulation (and a lot more).

It's free.

rproffitt commented: That looks like a "way of achieving this" to me! +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Typically you'd want to give as few of each unit of change as possible. Start with a list of denominations from largest to smallest and cycle through them in turn, extracting as many of each denomination as possible. Stop when there is no more change to give.

For extra credit you can use a dictionary to include the descriptive unit words (like "quarters", "nickels", etc.).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I can only offer generic advice but I would recommend wxPython over tkinter. There is excellent help available through many wxPython books and a user forum. I've also posted several step by step wxPython projects on Daniweb.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Plus your link to the code requires a login. Not a great way to start.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you already know how to program well in another language then learning to program in java should be "easier". However, learning any new skill takes time and effort in spite of all the "Learn X in 21 days" books available. If you don't already know how to program then it becomes exponentially more difficult. You probably couldn't learn to play the piano (certainly not anything even moderately difficult) in a short time. Don't expect programming to be any different.

They say practice makes perfect. In my experience it is even more true that malpractice makes malperfect. Unless you first learn the basics of good design you will likely develop bad habits that will just get reinforced the more you code. Learn the basics before you try anything major.

A few starting tips

  1. Always strive to write clear code. Obvious is always better than complex, even if complex is a little more efficient.
  2. Include comments that say what the code does, not how it does it.
  3. Write code with the assumption that the person who will maintain it is a psychopath who knows where you live.
JamesCherrill commented: Welcome back! +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Further...

The problem with the flu is that because it takes time to create a large number of vaccines we have to hope that we guess correctly which strain will be predominant in a given season.

The flu virus, like covid-19, has stalks with a head. Mutations generally occur in the head and this is why we need a new flu vaccine every year. Antibodies for one strain attack the head. The stalk generally stays unchanged. New mRNA vaccines are being created to tell the immune system how to make antibodies that attack the stalk. This means that we could soon be able to create a generic flu vaccine. Even if it would still be required yearly, it would mean that the vaccine would be effective against all strains, not just the one we think is most likely to be the dominant strain in a given year.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Quick biology lesson <edit - please see my post later in this thread for a correction>

Cells are made up (mostly) of cytoplasm. The cytoplasm creates proteins using instructions from messenger RNA (mRNA). When you get a virus your immune system creates mRNA to tell the cells how to create antibodies.

Most vaccines contain a weakened or dead strain of a virus. Your immune system reacts the same way it would to a live virus by creating antibodies to attack the virus. The new covid-19 vaccinations do not use a weakened or dead virus. Instead they bypass the first step and use mRNA created in a lab to tell the immune system how to create the antibodies. Sufficient testing has been done to ensure that the risk of taking the vaccine is far lower than the risk of dying from covid-19.

We have all heard about the rare case where someone has died because they were wearing a seatbelt (stuck in a submerged or burning vehicle). However, as with the vaccine, your chances of dying because you were wearing the seatbelt are insignificant to the chances of dying because you were not wearing it.

And consider this, your not wearing a seatbelt in no way affects my health or the health of your friends and family, but your not getting the vaccine does.

Get the vaccine.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The reason the try/except is there is because it stops the page from crashing if there are no arguments present, as well as the session.pop()

Then you should add an except clause for that specific exception. By having a generic exception handler you mask all other errors.

Let's try a real world example. You do your banking online but you don't want to get notified every time you do a transaction so you disable all notifications. Now you aren't getting emails for each time you use your debit card. But you also won't get a notification when someone gets access to your account and transfers out $50,000.

Incidentally, my account lets me specify "only notify me for transactions exceeding $x".

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You should never (ever) have an unqualified except. Doing so masks errors. Remove the try/except and let the error crash your code so you can see what the problem is.

Nether_1 commented: The reason the try/except is there is because it stops the page from crashing if there are no arguments present, as well as the session.pop() +1
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

This is the code I am using in my timer app and it works perfectly.

    # Stop timer and sound alarm if timer expired
    if self.txtRem.GetValue() == '00:00:00':
        self.Stop()
        winsound.PlaySound('alarm.wav',winsound.SND_FILENAME | winsound.SND_ASYNC)
        if self.chkPopup.IsChecked():
            dlg = TimerMessage('Timer Expired', self.txtDesc.GetValue())
            dlg.Show(1)

Does your wav file play properly in another app like vlc media player?

mangle200 commented: yes it does and it works in python only if i don't add the SND_ASYNC yet it does outside the dictionary +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try winsound.SND_FILENAME | winsound.SND_ASYNC for the flags

mangle200 commented: i have tried this already +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Nope. I never found another place that felt as comfortable as Daniweb.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My older son is a bio-physicist and assures me of the safety (barring a rare allergic reaction) of mRNA vaccines, particularly for me because I cannot be given live vaccines. As someone who has the trifecta of risk factors (old, cancer, depressed immune system) I will likely qualify for the second wave of vaccinations. It can't come too soon.

rproffitt commented: (joke) "Is it safe?" I don't know Jimmy, I'm not a Fox news anchor person. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Got the full version of Beat Saber (sic). It is worth every penny. My arms ached for two days but have since adapted to the frantic flailing. Warning - you really need to make sure you are out of arm's rach of any walls or furniture. I'm finding the "hard" setting just too challenging enough. If you pick party mode you can keep high scores for multiple people. You'll definitely be needing the wrist straps to keep the controllers from flying across the room. If we ever get enough snow to go cross country skiing my arms will be ready.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You're most of the way there. All the code under def ModFalsePos has to be indented to belong to that function, and you have to do a little initialization of some variables. That and fix a typo or two.

def f(x): 
    return -0.6 * x * x + 2.4 * x + 5.5

def ModFalsePos(xl, xu, es, imax, xr, ea):

    iter = 0
    iu   = 0.0
    fl   = f(xl)
    fu   = f(xu)

    while True:

        xrold = xr
        xr = xu - fu * (xl - xu) / (fl - fu)
        fr = f(xr)
        iter += 1

        if xr != 0.0 :
            ea = abs((xr - xrold) / xr) * 100

        test = fl * fr

        if test < 0.0:
            xu = xr
            fu = f(xu)
            iu = 0.0
            il += 1

            if il >= 2:
                fl = fl / 2.0

        elif test > 0.0:
            xl = xr
            fl = f(xl)
            il = 0
            iu += 1

            if iu >= 2:
                fu = fu / 2.0
        else:
            ea = 0.0

        if ea < es or iter > imax:
            break

    return xr

if __name__ == '__main__':
    result = ModFalsePos(xl=2.0, xu=6.0, es=0.001, imax=1000, xr=1.0, ea=0.0001)
    print(f'{result=}')
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There are a couple of problems.

The spec says to run for xl=2 xu=6 es=0.001 imax=1000 iter=1 ea=0.0001. The problem is that iter is not a parameter. Should this be xr=1?

You don't need to import numpy. Remove it.

You have to define the function f(x), likely as

def f(x): return -0.6 * x * x + 2.4 * x + 5.5

then indent the rest of your code under modfalsepos (define it with the same capitalization as in the spec).

Take out lines 6-11.

Take out the brace brackets. You are not writing c/c++ or java. This is Python and brace brackets are used for dicts and sets.

The line

xrold == xr

compares xrold and xr. It is not an assignment statement.

You may run into a problem with iu. If the code for elif test > 0.0 executes before the code for if test < 0.0 then iu will be undefined when you try to increment it.

In Python you don't assign a value to the function name at the end. You just do

return xr

Finally, you need a mainline to actually call your code. Add

if __name__ == '__main__':
    result = ModFalsePos(xl=2.0, xu=6.0, es=0.001, imax=1000, xr=1.0, ea=0.0001)       
    print(f'{result=}')

at the end

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've been a member of Daniweb since 2010 and a moderator for most of the last ten years. I had the great pleasure of meeting our illustrious founder and leader in 2015. I've enjoyed many interesting discussions, particularly the ones which caused me to re-evaluate some of my own opinions. I've had a great time answering questions, and hopefully I've managed to help a few people. But it seems there is nothing left to do on Daniweb but whack spammers so I'll be saying goodbye. If anyone has announcements, or if you just want to drop a line from time to time I can be reached at rjdegraff@shaw.ca.

It's been fun but nothing lasts forever.

Good luck and stay safe,
Jim de Graff

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

...slain; slain, after all man’s devices had failed, by the humblest things that God, in his wisdom, has put upon this earth.

  • H. G. Wells - The War of the Worlds
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If he has to quarantine for 14 days he'd have to skip the next debate. Suspicious? Especially so since the debate committee has ruled that the moderator will have the right to mute microphones to keep the debates orderly. That pretty much robs Trump of his only weapon.

rproffitt commented: There's also lies, damn lies and whatever is more than a lie. Then again, he could be lying about being infected. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'll take a crack at this even thouh my c is a tad rusty.

If you are storing references to strings in your stack then the struct should look like

struct stack {
    char *data;
    struct stack *next;
}

otherwise all you will be able to store is a single character rather than a pointer to a string. Likewise, your pop function should return an address (pointer) rather than a char.

Because you are passing an address to push, your assignment (with the new struct def) should be

newnode->data = element;

Check the rest of your code to make sure you are consistently using pointers. One of the biggest mistakes in c is mixing pointers with non-pointers. It's the reason I gave up on c.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think your problem can safely be narrowed down to:

  1. A hardware problem
  2. A software problem
  3. An earthquake

depending on what you mean by "keels over"

You do realize, I hope, that nobody can diagnose your problem without details.

rproffitt commented: When I deal with servers I always check "The Disaster Plan." Some companies don't have one. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Please read the Daniweb Posting Rules and Suggestions For Posting Questions.

We don't do your homework for you, but we will help if you show what you have done so far and where you are having a problem.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I want to be here in good standing!

Please start by reading the Daniweb Posting Rules. Questions like this one that are several years old rarely need reviving.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

No driver is going to make a difference as to where appliction programs are installed.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It would help if you told us what OS you are running. Assuming you are running Windows, I have never found it necessary to use anything other than the anti-virus that comes with WIndows 10. In fact, on the computers I service for friends and family I frequently remove third party anti-virus software because of performance issues. I have never had to delouse a computer because of a virus. Having said that, I have had to remove crapware, but no anti-virus software will prevent a user from installing crap.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For starters the line

cout << "Welcome " << name << " You can come into the bar!" << 

is incomplete. And

    char answer,

is also invalid. Your compiler would have complained about this. Fix your syntax errors (there are many others) and get back to us if you still have a problem.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I had an external drive "go" on me and it ended up being the controller on the drive enclosure. I got a new (NexStar) external bay, popped in the drive and it was fine. My local computer shop (Itech Computers) has several open external mounts in their service area. They were able to slide the drive in and check it in under 30 seconds. Any reputable place should do that for free.

Carsten_1 commented: Thanks +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The first obvious steps:

  1. reboot
  2. try a different cable
  3. try a different USB port
  4. try a different computer
Carsten_1 commented: Tried new computer too. Nothing. Does this mean my drive is bad? +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think he just want to demotivate Biden voters to the point where they will say "F**k it. He's just going to steal the election so what's the point in voting?"

rproffitt commented: I'm hoping his followers take his advice and vote twice. (Mail in and in person!) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In 2000, The New York Times published an article by David Barstow and Somini Sengupta. It stated...

"The president of Florida’s Senate said today that Gov. Jeb Bush had indicated his willingness to sign special legislation intended to award Florida’s 25 Electoral College votes to his brother Gov. George W. Bush of Texas even as the election results were being contested".

The leader of Florida’s House Democrats in 2000, Representative Lois Frankel, told the Times, "He’s saying, 'If my brother [loses], boys, go ahead and we'll get him elected another way.'"

Source

A number of states are still lacking legislation requiring that Electoral College votes be cast for the candidate getting the most votes in that state. However, several states have passed legislation that states that the candidate receiving the highest vote nationwide automatically gets that state's Electoral College votes. If enough states pass this legislation it would effectively do away with the Electoral College without requiring a constitutional amendment.

rproffitt commented: DJT and company working hard to throw doubt on the election and process. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Ah, yes. But what brand of Root Beer? Hires, Barq's, A&W?

Northern Conservative Baptist Great Lakes Region Council of 1879, or Northern Conservative Baptist Great Lakes Region Council of 1912?" He said, "Northern Conservative Baptist Great Lakes Region Council of 1912." I said, "Die, heretic!" And I pushed him over.

  • Emo Phillips
rproffitt commented: Root beer is complicated. A&W decades ago at the drive-in tastes nothing like the canned swill today by same name. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Is there perhaps a visible property you could set to false?You could use a timer to set it to true after 10 seconds.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Who are "we"?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

How about something to back up that opinion?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Well, there is this...

How_to_Fix_Any_Computer.jpg

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Please read the Daniweb Posting Rules and Suggestions For Posting Questions. You have to show proof of effort to get help.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Which would be illegal.

rproffitt commented: With a friendly Attorney General, there's a lot less risk for illegal actions committed by friends of DJT. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The problem with learning a new language is that you tend to thing in your previous language. In this case you used 8 lines when you should be thinking in Python and using

list(range(start,stop+1,step))