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

It is a direct violation of privacy to publicly publish someone’s IP address.

Even if it is in the private Moderator's forum where I thought I was posting it? I'll assume it is private since it wasn't redacted. As you can see, instead of doing anything with the posts I just pointed them out semi-privately and asked.

rproffitt commented: I made this mistake. It was in the clear and again, my mistake. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My mistake. Val will not throw an error.

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

Just realize that there is nothing to stop the user from entering a value that will throw an exception when you try to convert it to an integer. Either check that the string is an integer-equivalent, or put it in a Try block to trap the error.

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

When my wife says, "can you find me the picture of Adam and Cooper at Shebandowan" I can bring up an "Everything" search window and type in those three terms. It immediately shows me all pictures that have those terms in any order in the file name. Try doing that without file tagging.

Think of it like hashtags but for local files.

rproffitt commented: #usefulthings +16
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Frankly I've written off MS-Access for decades.

Fer sher. I'd recommend sqlite.

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

And here it is:

    """
        Name:

            SideBySide.py

        Description:

            Given two video files, runs them concurrently in two side by side
            instances of ffplay. Ths is very useful when you have processed a
            video and want to compare the original with the processed version.

            If you want to test a process (e.g. a filter) before processing the
            entire video, run the script by specifying -same as the second video
            as in

                SideBySide video1.mp4 -same  -vf smartblur=5:0.8:0

            Try the following filter to increase the contrast

                -vf colorlevels=rimin=0.2:gimin=0.2:bimin=0.2

            Convert to greyscale

                -vf colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3

            Convert to sepia

                -vf colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131

            adjust gamma/saturation

                -vf eq=gamma=1.5:saturation=1.3 

        Requires:

            Python version 3.8 or later
            ffmpeg (which includes ffplay)
            autoit (version 3)

        Usage:

            SideBySide video1 video2

        Notes:

            Regardless of the dimensions of the input videos, they will always be scaled so that
            they can be placed side by side, each filling just under half the width of the display.

            I haven't verified this, but I'm assuming that manipulating windows by handle rather
            than by name is more efficient which may be a consideration because I do it repeatedly
            in the wait loop at the bottom.

        Audit:

            2021-08-31  rj  original code

    """        

    import os
    import re                   #needed to extract video frame size
    import tkinter              #needed to get display size
    import win32com.client      #needed to create the AutoId com object
    import subprocess           #needed to run ffprobe.exe
    import sys
    import time


    def DisplaySize():
        """Returns the monitor display resolution as (width, height)"""
        root = tkinter.Tk(None)
        return root.winfo_screenwidth(), root.winfo_screenheight()

    def VideoSize(file):
        """Returns the frame size …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Requires:

  1. Python version 3.8 or newer
  2. wxPython version 4.0 or newer
  3. exif module
  4. Windows with NTFS file system

To ensure you have the required packages please run the following

  1. python -m pip install --upgrade pip
  2. pip install exif
  3. pip install wxPython

I have lots of digitized photos on my computer. To keep track of them I use two programs. The first is called Everything Indexer. It's free, fast, and I use it daily. It maintains, in real time, a database of all files on your computer. The search window allows you to see a list, updated as you type, of all file names containing strings that you enter. Filters allow you to easily restrict the results to files of several pre-canned types (pictures, videos, executables, documents, etc.). Like Windows Explorer, it also supports a preview pane. I literally cannot say enough good things about it.

The other program is one I wrote myself. Without it (or something similar) Everything would be pointless (sorry for the pun).

Several programs are already available for tagging files, but most, or at least the useful ones, maintain a database in proprietary format which makes moving to another program difficult if not impossible. I used ACDC for years until it just got too bloated. I now use FastStone Image Viewer. It's small and fast, and except for rare cases (for which I use gimp), it handles all my imaging needs.

My program displays a list of all image files …

pritaeas commented: Nice! +17
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Comparing two videos side by side

I have been creating walk-through videos on the cheap by just wandering through an area with my little Sony camera. Lacking a steady-cam I just try to hold the camera as steady as possible. Fortunately, with the proper (free) tools I can still end up with a reasonable result. It's nice to be able to compare before and after videos so I'll describe the application I put together, and the tools I used to build it.

First the tools (again, all free)

  1. ffplay (included with ffmpeg version 4.2.3) download
  2. ffprobe (included with ffmpeg)
  3. AutoIt (version 3) download
  4. Python (version 3.8 or newer) download
  5. VirtualDubMod (optional - version 1.10.5) download

At the heart of it all is ffplay.exe which comes bundled with ffmpeg. Ffmpeg is a free and open source command line video suite that with a little effort (warning - there is a learning curve) is unbelievably versatile. While ffmpeg.exe is the main engine that you'll use to apply complex filters or convert formats, ffplay.exe offers a small, simple playback utility as well as a way to preview effects in real time.

ffprobe.exe is used to get the frame size of the video.

AutoIt (or more specifically AutoItX) is used to control windows/applications from within Python. In this case, I use it to resize and place the playback windows which will be approximately half the screen wide, and placed side by side (thus the name of the application).

rproffitt commented: Double plus good! +16
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.

Short version:

  1. Don't hijack threads. Start a new on with your question.
  2. Don't resurrect old threads.
  3. Show what you have done so far and where you are stuck.
rproffitt commented: +1 +16
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't use tkinter. It is sadly out of date. Instead I use wxPython, a python wrapper for the wxwidgets tool set (a cross platform library that renders controls using the native OS). If you are interested I suggest you have a look at this article that I posted some time ago. It embeds VLC Media Player in a wxPython/Python application. The article is posted as a tutorial and includes all code necessary to run a small app. If you decide to go the wxPython route feel free to post questions.

While I am thinking about it, if you are doing Python development you might want to have a look at the free version of Wing Professional IDE. I recently started using it and find it much better than idle or idlex.

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

Got it. The solution was

SELECT DATE('1899-12-31','localtime','+'||day||' days') AS day
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm all in favour of higher quality, particularly higher quality posts.

rproffitt commented: ⭐⭐⭐⭐? 5 Stars. +16
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Where are you stuck and what language are you working in? Is the app command line based, or does it require a GUI?

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

OK. Done.

rproffitt commented: ? +1. +16
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As to Jon Stewart, I thought he was pulling our leg.

After four+ years of outrageous statements followed by "just kidding" you'd think he would know better. Some jokes are just not funny.

rproffitt commented: Not to mention the guy who suggested nuking a hurricane. 'I got it. I got it. Why don't we nuke them?' +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There are as many idiots on the left as there are on the right.

True, but the levels of crazy manifest in much different ways on the two sides. Also, one side seems to have all the guns and the willingness to use them.

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

In spite of what certain politicians and right-wing talk show hosts are saying/screaming, requiring proof of vaccination to fly, or requiring the same, or a mask to enter a private business is not an infringement on anyone's rights. It is not discriminating against an identifiable gropu (race/religion/etc). You have the right to take your business elsewhere if you disagree.

jwenting commented: nor are vaccine passports new. I've had mine for 10 years from when I needed several vaccines for tropical diseases to enter various countries. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It looks like <\>

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

You are using things both as functions and variables. Compare the following with your code

class Employee:

    def __init__ (self, name, basic, house):

        self.name = name
        self.basic = basic
        self.house = house 
        self.nhif = (2/100)* self.basic
        self.tax = (30/100) * self.basic

    def gross_income (self):
        return self.basic + self.house

    def total_deductions (self):
        return self.nhif + self.tax

    def net_salary (self):
        return self.gross_income() - self.total_deductions()


employee1 = Employee ("Peter", 50000, 12000) 
employee2 = Employee ("Mary", 60000, 15000)
employee3 = Employee ("Juma", 45000, 12000)


print ("Employee name:", employee1.name, "Gross pay: ", employee1.gross_income(),"Net_salary: ", employee1.net_salary())
print ("Employee name:", employee2.name, "Gross pay: ", employee2.gross_income(),"Net_salary: ", employee2.net_salary())
print ("Employee name:", employee3.name, "Gross pay: ", employee3.gross_income(),"Net_salary: ", employee3.net_salary())

I suggest you have a look at lists as the following illustrates:

employees = [Employee ("Peter", 50000, 12000),
             Employee ("Mary", 60000, 15000),
             Employee ("Juma", 45000, 12000),
            ]

for employee in employees:
    print ("Employee name:", employee.name,
           "Gross pay: ", employee.gross_income(),
           "Net_salary: ", employee.net_salary()
           )
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Start by googling "gaussian elimination".

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

You can get all other kinds of fake ID online. Why not vaccination cards as well. I just wish when they announced the v-cards they also mentioned the massive penalty for making/carrying a fake one. That was one of the big reasons Manitoba became the US/Canada hot spot. They made all these restrictions against public gatherings, which shops could stay open, how many people could be in a store at one time, etc. Then they made the penalties for violating the public health order way too small, and handed out more warnings than actual fines. With very little chance of actual consequences (other than getting sick and dying), too many people just went on with business as usual.

Of course, it didn't help that public figures like Jason Kenney (premier of Alberta) very publicly flaunted his own rules (then lied about it).

rproffitt commented: Right or wrong, I am lumping politicians who are anti-mask/anti-vax into the group we call mass murderers. There, I've written it here and elsewhere. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Huh. You'd think if it was that easy to remove fake followers that Twitter would do it automatically. Or am I just being naive?

rproffitt commented: It appears fake leaders can be removed! ? +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Sure thing. Here it is in APL for any rank of arr

z ← Zeroes arr
z ← +/0=,arr
rproffitt commented: 1 liner in Numpy: numpy.count_nonzero(a, axis=None, *, keepdims=False) +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You start by reading a book or tutorial on programming. Google will help you find something. I suggest you start with Python. It's a good language to learn the fundamentals.

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

Question: What is the third letter of the alphabet?
Answer: c

rproffitt commented: Is this true for most alphabets? Also, great answer. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My guess is it's one of those pointless intro exercises, like "add two numbers using only bitwise operations" that some professors think will teach you something useful. The only thing it teaches is how to do something in the least efficient possible way.

rproffitt commented: I really should have used numbers that have the digit 2 in them. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What part are you having trouble with?

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

I did just that in this project. If you have any questions please post them in that thread. The code is posted there.

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

It's like giving some directions on how to get to a destination. The directions depend entirely on knowing the starting point.

rproffitt commented: Yes, I've been there. The "Where are we going and why am I in a handbaket?" moments. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The command doesn't show a product key

Works just fine for me.

rproffitt commented: Works fine here but it is a fairly long command, easy to mistpye. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Meaningless collection of buzzwords. But if you want to have a discussion in English I'm up for it.

Doonesbury_buzzwords.jpg

rproffitt commented: Bees go buzz buzz. +1! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are going to print out y = a^x + b, and you are going to prompt for a, b, etc, then you might as well use a and b as the variable names.

If you are going to go to the trouble of creating an integer input function then you might as well use it. And on that note, your input function should have a descriptive name. I suggest

def getInteger(prompt='Enter a number: '):
    while True:
        number = (input(prompt))
        try :
            return int (number)
        except ValueError:
            print("That is not a number. Try again.")

Note that getInteger accepts the prompt as a parameter.

The line

while jarda <= 0 or jarda == 1:

can be replaced with

while jarda <= 1:

since jarda is an integer value. And if you are going to restrict the input to integers > 1 you should tell the user what is expected. I suggest

while jarda <= 1:
    jarda = getInteger("Enter an integer value > 1 for a: ")

I think this is a typo. Change

barca = b()

to

barca = getInteger("Enter an integer value for b: ")

Replace

A = int (input("zadej pocátecní hodnotu def.oboru "))
B = int (input("zadej konecnou hodnotu def.oboru "))

with calls to getInteger

You are using jarda0 without having initialized it.

Start with this and get back to us with further questions.

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

Ditto for me, another dinosaur. Let me just add an analogy. Learning to play the piano well isn't just a matter of remembering which keys to press, and when. It's also learning a lot of technique and theory, and of course, practise, practise, practise.

A gentle reminder - when you start to learn, don't make the mistake I see all too many people making here on Daniweb. Don't post your homework hoping someone will do it for you. That will benefit you as much as paying someone to go to the gym for you.

One more little bit of advice - learn to communicate clearly and concisely. Whenever I am asked "what language should I learn first?", my answer is always "English".

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

And please look into parameterized queries. The way you are doing it leaves you open to SQL injection attacks. You might as well learn to do it the safe way now. Bad habits are hard to unlearn.

Malpractice makes malperfect.

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

42

rproffitt commented: And now for some Vogon poetry. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Or use gimp for free.

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

Keep in mind that indentation in Python is critical to understanding the program flow. The way this code was posted (without indentation) renders it useless.

rproffitt commented: That too! +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's not pseudo code. For the record, neither is this

Do my homework for me
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not sure I follow. Can you please specify the exact output you want for the given input?

Incidentally, an easier way to initialize that list is

myarray = 'G o T , I t B , M N R , K F P , M F I H , A H ,'.split()
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

input always returns a string so the test is not necessary. In your case the result of type(age) != int will always be True so the first part if the if will always be executed. You can test age by converting to int and trapping the ValueError exception with a Try block.

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

Try putting a double quote before SELECT.

ShishiLearn commented: Hello. Thank you for your help reverend Jim. I appreciate you and God bless ! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Then write everything as if it's going to be you who will have to maintain it in 10 years time.

I always overestimate my ability to understand code I wrote even a few months back so I assume that my code will be maintained by a psychotic programmer who knows where I live. That usually motivates me to refactor and document.

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

It's like asking "what's the best tool I need to learn to be a carpenter". It depends what you want to build. Different languages excel in different areas. As in most disciplines, there are fundamentals than need to be learned and these can be learned regardless of the language. However, some languages make it easier to learn these fundamentals. I suggest that for starters you look at Python. It is free, and relatively easy to get started, and there are a ton of free resources available. Just remember that you have to learn to crawl before you can walk or run.

rproffitt commented: Have you met mostly new programmers that think they only have to learn one language? +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There have been concerns, first with the Astrazeneca vaccine, and now with the J&J vaccine, that they may cause blood clots in some people.

  1. It has yet to be proven that the vaccine was the cause of the clots
  2. The chance of getting blood clots if you get covid-19 are exponentially greater
  3. Birth control pills carry a much higher risk of blood clots (and people still take those)

Even without covid-19 and the vaccines, a certain number of people are still going to get blood clots. Without proper studies we shouldn't jump to the conclusion that A causes B (post hoc ergo propter hoc).

jwenting commented: they also ask here if you are on anti-trombosis meds and will not vaccinate you if you are, pretty much preventing any clotting problems. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try removing the battery and powering it up on AC only.

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

We are happy to help if you are stuck with a particular problem but we don't do homework. Please post what you have done so far and where you are having problems.

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

Just got back from my shot. I walked in at 12:40 and was out by 1:30. It was like a trip to Disney World without the fun. No soreness, no tiredness. Nothing.

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

I'm due on Monday - also in the post 65 crowd. I've got PHPT (pains here, pains there) so one more in the short term won't matter. Unfortunately, we are due for 12-15 cm of snow that day so whoops.

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

You're counting hooves and dividing by four. Why not just do

Dim Search As String() = s.Split()

Then instead of referencing the words as

Search1
Search2
.
.
.

You can just do

Search(0)
Search(1)
.
.
.

Plus Search is iterable.

rproffitt commented: So, "strategic overcounting."! +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Typically you would create a dictionary where the username is the key and the password is the value (hopefully, encrypted).