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

For everything other than the first if use elif.

For future posts, please use the code tool, </>, to insert code blocks.

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

I am quite familiar with Matthew 24. If you are going to quote text, please restrict yourself to fact-based texts. If the sun should darken I might take it more seriously but until then I prefer to ignore a book of fables written by ignorant and superstitious primitives who had little idea of how the world works.

And if you are going to accuse me of slander you'll have to do better than just shout j'accuse. Tell me where you think I am incorrect.

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

The White House just announced that the impeachment process is illegitimate and it will not participate.

Trump was talking about a coup. Looks like it just happened. Congratulations America. You no longer live in a democracy.

rproffitt commented: "Wish you were here." Also, someone should start a similar discussion on Hong Kong. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm an old style c programmer. I thought arrays were passed by reference, in which case you pass just the address of the start of the array.

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

If you are going to define a class for a player then you should define a changeroom or move method within that class instead of making it an external def.

I also want to mention that you should post code with the correct indentation (especially important for python code).

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

What are you trying to do? If you want to assign a value to a[10] you must specify only a single value. If you want to assign multiple values to an array you must do it when the array is declared as

int a[] = {2,4,1,9,0,6,5,7,3,8};

Also main would take only command line parameters like

main(int argc, char **argv)

You don't specify an array size in the parameter list.

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

The way I would do this is to make the tables more general. You have a table set up for a specific number of courses. If you need to add or remove courses you have to alter the table. Instead, you should have a table that maps courses to a course ID. Then you can have a table that tracks any number of courses. Adding a new course is simply a matter of adding a record to the mapping table, then adding one or more records to the tracking table. That gives you the ability to query the tracking table for how many times any value appears for any course without having to do the query for every course column.

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

Facebook has an ad policy that "prohibits ads that include claims debunked by third-party fact checkers". This was recently emended to specifically exclude political ads. Political ads can now out-and-out lie, even when those lies have been thoroughly debunked by credible sources. I guess Mr. Zuckerberg has decided that a few more million in ad profits was more important than a function democracy.

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

For future reference, code snippet is for posting a fully debugged and fully documented piece of code. Discussion/question is what you should have selected.

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

I changed this thread from code snippet to discussion/question. For future postings, code snippet is reserved for when you are posting a fully working and documented code snippet.

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

Still not properly formatted. Copy your original code into the clipboard then click on </> in the toolbar to paste it into your post. As a further note, C/C++ uses brace brackets, not square brackets. Indenting your code blocks would also help.

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

At least the OP used a Sharpie. As I recall, someone else like to use Sharpies. Hmmmm....

rproffitt commented: You made me think this is not "So wrong!" +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Glad to see new blood. Please take a few minutes to read the Daniweb Posting Rules and Suggestions For Posting Questions.

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

If you want help with code

  1. post valid code (properly formatted)
  2. take the time to explain what you want
  3. if you have a specific problem please state with what (and where)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I dont want to start an "I hate StackOverflow" discussion, but perhaps you could tell us what you don't like about SO that led you here.

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

great to get the hang of programming with the wxPython GUI.

That's kind of the entire point of a tutorial.

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

My guess is that WD wouldn't be flagging it unless it had a signature matching a known virus. As I said before, typically UAC intercepts any attempts to write to protected folders.

rproffitt commented: Above there's a passage "close the exe" so we're left to guess it is some executable. But what is it? OP needs to spill the beans. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

But if I were to write in system folders then I bet WD would complain.

That would result in a UAC popup rather than an alert/response from Windows Defender. I have written quite a few applications in c, vb.net c#, python, etc. I have never had to sign anything and I have never had a problem with Windows Defender.

rproffitt commented: cambalinho needs to share how we can duplicate the issue. Without details, I would be guessing but you can get WD to pop up under many conditions. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What have you tried so far, other than asking us to do it for you?

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

The trouble with that approach is that imaging the complete OS partition no longer gives you the ability to restore a system from an image. You now have parts of your system on two drives. If you go that route then you should only put apps on the "other" partition that do not requuire an install. Then if you restore an image youy may only need to recreate Start Menu links to the other apps.

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

Also, if you are getting a syntax error in your query, it helps to print out the value of the query after you have concatenated in the variable text part.

rproffitt commented: From memory we can add a debug.print to show it in Visual Studio. Also we can set a breakpoint on a line and mouse over the variable to peek at it. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Ambiguity. The devil's volleyball.

  • Emo Phillips
rproffitt commented: Clarity. That moment after you made a deal with the devil. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not even sure if this was optional when I installed VS 2019 but I made sure the Python support was installed.

rproffitt commented: So VP it is. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Also consider how long you plan to hang on to this computer. I have an old laptop that is severely under-rammed but I can no longer get RAM for it (at least not at a reasonabloe price). I wish I had upgraded the RAM when it was newer.

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

And how are we to know whether you forgot your password or you just want to break into someone else's computer?

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

Memory is cheap. I'd fill it up to the max.

MickeyD commented: Thanks, but that didn't really answer my question. And too, 32 GB of RAM from Crucial would cost me more than this very dependable refurb from Amazon. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For future reference, if your program is throwing an error, it is always helpful to say what line is causing it. It may have been obvious in this case, but some people post very large blocks of code. The more information you can provide the more likely you are to get a quick response.

Also, i see you are using r%2!=0 as your loop test. What this says is to execute the loop as long as r is odd. I don't think this is what you want. I also think your starting value is incorrect. According to your initial statement I think you want to start at one and increment by one, calcultaing the new values of power and factorial, but only adding in to the series total when r is odd. There is no need to call the pow function for each iteration of the loop when you can do a simple multiply.

Typically a series notation is read like for i equals 1 to n, sum of... so it makes sense to structure your loop like

for (i=1, i<= n, i++)

My preference is to keep everything out of the for statement that isn't directly related to the control of the loop.

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

The include had # as the first char so it was interpreted as heading, thus the big font. I fixed it and now you can see the target as <iostream>.

rproffitt commented: Much better looking. Thank you. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Here's how I get the media info via code (Python). Save this to a file with a py extension (e.g. mediainfo.py) then run it with the name of a video file as a parameter.

import os
import re
import subprocess

def execCmd(cmd=""):
    return subprocess.check_output(cmd, shell=True).decode().splitlines()

class MediaInfo(object):
    """
    Runs MediaInfo.exe and arranges the output in a more code-friendly way.
    Information is returned as key-value pairs in three dictionaries for the
    three sub-categories of inf which are General, Video, and Audio.
    """
    def __init__(self,file):

        self.General = {}
        self.Audio   = {}
        self.Video   = {}

        if os.path.isfile(file):

            for line in execCmd('mediainfo.exe "%s"' % file):

                line = line.replace('\r','').strip()
                flds = line.split()

                if len(flds) == 1:
                    if   flds[0] == "General": dict = self.General
                    elif flds[0] == "Video":   dict = self.Video
                    elif flds[0] == "Audio":   dict = self.Audio
                elif len(flds) > 1:
                    colon = line.find(":")
                    dict[line[:colon].strip()] = self.fixnums(line[colon+1:].strip())

    def fixnums(self, str):
        """
        Takes a string and removes blanks embedded in number. For example,
        the string '1 024 kb/s' is converted to '1024 kp/s'.
        """
        emb = re.compile(r'(\d+) (\d+)')
        str = re.sub(emb,r'\1\2',str)
        return str

if __name__ == "__main__":

    import sys

    info = MediaInfo(sys.argv[1])

    print("\nGeneral:")
    for key in info.General:
        print("    %s:%s" % (key,info.General[key]))

    print("\nVideo:")
    for key in info.Video:
        print("    %s:%s" % (key,info.Video[key]))

    print("\nAudio:")
    for key in info.Audio:
        print("    %s:%s" % (key,info.Audio[key]))
rproffitt commented: The more I use Python the more I use Python. It's addictive or additive. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I can't answer your question but I think you may want to check out Movie DB API. I use it to get movie info via code.

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

Sophos software has recent.y made their Sandboxie software free for personal use and will soon be making it open source. For anyone unfamiliar with Sandboxie, it implements an isolated enviroment where you can run programs (even install them) without fear of affecting your system. When you run a program from within a sandbox, any files, registry settings, etc. are made within the sandbox. For example, if you save a file to the desktop, it will appear in the Sandboxie desktop (with an option to move it to the actual desktop).

This is a much more convenient way to test new software than creating a virtual machine. It takes up far less space (and takes less time), and you can see how the software interacts with your actual system rather than a (not always identical) virtual one.

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

After verifying that a valid number has been entered you can do

For i = 1 To CInt(TextBox1.Text)
    ListView1.Items.RemoveAt(0)
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You're welcome.

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

Python or vbScript? This is the Python version

import os
import sys
import glob
import shutil
import datetime

for arg in sys.argv[1:]:
    for file in glob.glob(arg.replace("[", "[[]")):
        base,extn = os.path.splitext(file)
        newname = base + ' ' + str(datetime.date.today()) + extn
        if not os.path.exists(newname):
            shutil.move(file,newname)

Save it in a file like appenddate.py and run it by

appenddate file [file...]

where file is a file name or pattern (Windows wildcards * and ?) as in

appenddate *.jpg *.txt

That weird replace in the glob line is to account for [ and ] being valid Windows characters in file names but something else in a glob call.

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

I would create a function IsPalindrome that checks any string, then pass it a number converted to a string. Why bother with numbers at all? Actually, I did this and the function was four lines including the header.

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

First off I wouldn't use Settings variables. They are stored in clear text. Plus, you are limiting yourself to only one user. I would set up a small database (I suggest sqlite) and encrypt/scramble the username and password. If you don't want the user to access other parts of the program without registering, just don't display those forms until they have registered and logged in.

On second thought, because you are a beginner I suggest you stick with the Settings variables and clear text until you have the kinks worked out. Just make sure to put your username/password code in a module so that you can later change to a database with encryption without breaking the rest of your application.

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

If you like to use Sticky Notes, do yourself a huge favour and stop using the Windows 10 Sticky Notes tool. Instead, go to Zhorn Software and download Stickies by Tom Revell. It works much better, has more features, is very well documented and is very intuitive. You can also download a Skinner Tool if you want to design your own interface, or you can use one of the many prebuilt skins (although I prefer the one that came with an older version which is attached here).

I've been using it for several years and I freaking love it.

To use the attached skin, save it to the skins subfolder of the stickies install folder and rename it to stickies8.ssk (Daniweb doesn't allow uploading of ssk files).

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

It seems to me that if you have something that really needs to be hidden, instead of creating a complex workaround to try to hide stuff in (sort of) private properties (resulting in something that may be impossible to maintain), you'd be better off writing the critical stuff in C/C++, compiling it, then adding a wrapper the same way that wxPython is a wrapper for wxWidgits.

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

It's a simple program. Show us what you have tried so far.

ASAP: Short for "I left my homework until the last minute and now I want someone to do it for me."

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

You are spending too much time on Facebook (like).

To understand an algorithm, work through an example with pencil and paper. Then code it up. Then step through it using a debugger while following your paper and pencil example.

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

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • M. Golding
rproffitt commented: When I wrote this code, only God & I understood what it did. Now only God knows. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Welcome aboard. Please take a few minutes to read the Daniweb Posting Rules and Suggestions For Posting Questions.

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

I've been developing software since the mid 70s (retired since 2008) and I recently switched from vb.Net to Python/wxPython. I know you wanted to develop to exe but there is a tool that will generate an exe from Python. While creating a GUI with wxPython is more challenging than with vb.Net and Visual Studio, writing and debugging the actual code is much easier with Python, although Visual Studio still kicks ass for interactive debugging (I'm using VS 2019 with Python). Also, with Python/wxPython you only have to install them once (easy) and ypu'll never have to set up a separate installer. I believe Python will handle integer math to your requirements. If it can handle math.factorial(1000) it should do.

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

I see a lot of unnecessary code. For example, every one of your

If cmbModel.SelectedItem
    .
    .
End If

blocks clears the value of txtDate.Text before setting it to a new value. You don't have to clear it before assigning a new value. Furthermore, no matter what the user selects you have to execute every If block. Replace these with a Select Case.

Alternately, you could create a dictionary where the key is the selected item text and the value is the desired value of txtDate.Text. A little extra work up front but it requires only one line of code to set the value of txtData.Text. That's a saving of about 400 lines. It's a lot easier to type in and maintain and a lot less prone to typos.

rproffitt commented: I should tell a story about 6 sigma and the code was too small and therefore was unacceptable (Motorola days.) +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't see a question.

rproffitt commented: While I was commenting on the code you were busy correcting. Not everyone understands my humor. At least my code is far more understandable. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

And of course we have to ask the obvious - what, specifically do you need help with?

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

Still another improvement. I added a Web button. When you click on this, a randomly generated "evil" level puzzle is automatically downloaded from websudoku.com.

I also changes the Tile.py class to speed up Undo. Now it will only refresh tiles that have changed.

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

I don't believe so although I have little experience with Android Studio. You could set up a batch file on the USB drive that would set an environment variable before starting Android Studio. You should be able to specify that environment variable in the A.S. configuration.

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

I wish all the pointless threads on SEO, BACKLINKS, etc. would go extinct.

rproffitt commented: I wish that too. Why folk post to such old threads with low value answers is well, my bet is they have future plans. Bad plans. +0