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

What have you done so far and where are you stuck?

In the mean time, please 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

Other common five letter words with a lot of vowels are adieu, audio, and ouija. Was it a five letter word you were looking for?

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

it'll only result the same

In order to avoid ambiguity please show us exactly what you want the query to return based on the data that you previously posted. In your first post your table had only three columns. Your last query had six. We can't give a complete answer based on incomplete information.

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

I'm speaking out of ignorance here because I know nothing (and care nothing) about SEO but it seems to me that the choice of browser has absolutely nothing to do with SEO.

Having said that, I'm seeing a lot of opinions here, a lot of which are not backed up by reasons. If you are going to state a preference then please give the reasons for doing so, otherwise it just seems like a popularity poll. This is applicable to much more than the topic of SEO.

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

try

SELECT Name, SUM(TotalPayment) AS Total, Date
  FROM mytable
  GROUP BY Date
Lieutenant_1 commented: it'll only result the same, +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Wouldn't it have been easier to google c++ explicit?

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

From Microsoft

The coordinate system for a window is based on the coordinate system of the display device. The basic unit of measure is the device unit (typically, the pixel). Points on the screen are described by x- and y-coordinate pairs. The x-coordinates increase to the right; y-coordinates increase from top to bottom. The origin (0,0) for the system depends on the type of coordinates being used.

The system and applications specify the position of a window on the screen in screen coordinates. For screen coordinates, the origin is the upper-left corner of the screen. The full position of a window is often described by a RECT structure containing the screen coordinates of two points that define the upper-left and lower-right corners of the window.

and

The system and applications specify the position of points in a window by using client coordinates. The origin in this case is the upper-left corner of the window or client area. Client coordinates ensure that an application can use consistent coordinate values while drawing in the window, regardless of the position of the window on the screen.

So if you are referring to an app you use client coordinates. When referring to the screen you use screen coordinates. There is no mention of a 7 or 8 pixel offset. It specifically states the origin is the upper-left corner of the screen

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

I'm going to weigh providing code for an assignment against giving an example of how you should be coding. The example wins out. Here is sample code for the isVariant function. Note that it indicates the expected types of the parameters (although this is not enforced via asserts) as well as the return type. It has a small but useful doc string. It also comes with some code to test it. The line that splits the first parameter appends a '.' to account for the case where the first parameter does not contain a '.'

def isVariant(a:str, b:str) -> bool:
    """Returns True if string <a> is a variant of string <b>

    <a> is a string representation of a floating point number
    <b> is a string of the form '#.#'

    <a> is a variant of <b> if any digit to the left of '.' matches
    one of the digits of <b>, and any digit to the right of '.' matches
    the other digit of <b>.
    """

    # Split a and b into digits left of '.' and right of '.'
    la,ra = (a + '.').split('.')[:2]
    lb,rb = b.split('.')

    return (lb in la and rb in ra) or (lb in ra and rb in la)

if __name__ == '__main__':
    a = '123.456'

    b = '1.4'
    print(f'{a=} {b=} {isVariant(a,b)=}')

    b = '4.1'
    print(f'{a=} {b=} {isVariant(a,b)=}')

    a = '1234'
    print(f'{a=} {b=} {isVariant(a,b)=}')
Bright_5 commented: a mistake in my first question. why does the your example output a false result if a=21.4 and b=1.4, +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Amazing. 447 lines of code and not one single comment. Since you are the second person to post this question I can only assume this is an assignment problem. As a former PA and marker I will tell you that I would have given this assignment a zero whether or not it produced the correct output. Programming is so much more than just producing code that works. Code must also be readable and comprehensible by humans. My rule of thumb is to assume that the person who will be maintaining my code is a psycho killer who knows where I live.

But I digress.

Having multiple methods named search_engine# is extremely poor design. At the very least I would expect one method with a signature like

def isVariant(a:str, b:str) -> bool:
    """Returns True if string <a> is a variant of string <b>

    <a> is a string representation of a floating point number
    <b> is a string of the form '#.#'

    <a> is a variant of <b> if any digit to the left of '.' matches
    one digit of <b>, and any digit to the right of '.' mstches
    the other digit of <b>.
    """

The method name gives me an indication of what it does. search_engine3 just tells me it searches something for something else.

Because floating point numbers can not be stored exactly as typed, you should be treating all numbers as strings. For one thing, this makes splitting numbers into "digits to the left of the decimal" …

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

This is essentially the same question as posted here. You get the same answer. Show us what you have so far, and where you are having problems. You said you attached the code but I don't see it. Please post it inline using the code block tool </>. This makes it easier for us to look at the code, and that makes it more likely you will get an answer.

Based on your description of variant I don't see how 14.31 is a variant of 1.4. It has a 1 to the left of the decimal but not a 4 to the right. Be more specific as to what defines a variant. Doing it by example is not a complete definition.

Bright_5 commented: i will try it again +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When I create a new topic and enter the mandatory tags, the tag dialog box sometimes overlays the "Continue to the Last Step" button leaving only the merest sliver of a button to click. Could the tag dialog be aligned left to avoid this?

rproffitt commented: I've seen that too. Explains why folk add non-appropriate tags +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

This is yet another thing that everyone just accepts, but nobody can tell me why this decision was made.

Everyone is familiar with the Windows screen coordinate system where x and y values increase to the right, for x, and down, for y. What is not noticible until you start programming window positions is that the upper left corner of the screen does not have the coordinates (0,0) as you would expect, but (-7,-7). Even more curiously, using the Windows Info tool that comes with AutoIt, if you maximize any window you will indeed see that the window is positioned at (-7,-7) but if you move the mouse cursor to the top left corner, it has coordinates (0,0).

This makes absolutely no sense to me so if anyone has a reasonable explanation I am more than willing to shout it down.

I'm also curious if this is the same on Linux. I have no easy way of checking it out. I program apps using wxPython nd one of its features is being multi-platform. If Linux doesn't use the same coordinate BS then apps would not truly be portable.

dark404 commented: Common coordinate systems Number line. Cartesian coordinate system. Polar coordinate system. Cylindrical and spherical coordinate systems. Homogeneous +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The first thing I would do is look up the definition of a table. It usually has both rows and columns. Your example has only a list. The second thing I would do is write and debug the code for isVariant(a, b) which should return True if a is a variant of b, False otherwise.

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

    Thread.py

Description:

    Simple (I hope) example of how to run a piece of code in a separate thread.
    This code is the result of a question from a user who needed to generate
    many random numbers, but found it was slowing his application down.

    Random_Pool subclasses threading.Thread. To create a self-filling pool of
    random numbers you create a Random_Pool object, giving it the maximum pool
    size, and the minimum and maximum integer values you want to generate. You
    can also give it a name.

    To start auto-generating random numbers you use the start method. You do
    not call run directly.

    To get a random number call get_num()

    The test for whether the pool is less than full runs on a 0.01 second
    sleep loop.

    When you are done with the pool you have to tell the run method to complete.
    You do this by calling the set_done() method. Following that you must join
    the pool thread to the main thread by calling join().

    Comment out the print statements for production code.

Audit:

    2022-07-08  rj  original code
"""

import threading
import random
import time


class Random_Pool(threading.Thread):
    def __init__(self, name='pool', max_size=100, min_num=0, max_num=1000):
        threading.Thread.__init__(self)
        self.name = name

        self.pool  = []         # a list containing the generated random numbers
        self.size  = max_size   # maximum number of random numbers at any given time
        self.min   = min_num    # minimum random integer to generate
        self.max   = max_num    # maximum random integer to generate
        self.done  = False      # when True the run method will complete …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That sounds like the perfect scenario to create a thread that generates the random numbers. That would allow the generation to be done concurrently with your game. The thread could maintain a queue of n random numbers, automatically generating new numbers to maintain the pool as you make pull requests. If you don't know how to do this I could help you out. Coincidentally I am currently making my way through "Quan Nguyen - Mastering Concurrency in Python".

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

Easiest way to find out is to google things like

mysql python
sqlite python

I've used it with sqlite only. Connection is easy. For a step by step check out this tutorial. If you are more into video tutorials you can watch this one.

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

Plug in a few test numbers. What happens if only 35 hours are worked? In that cast the overtime is -5 hours and you get a negative OT pay. Write your program in pseudo-code. Write out the steps you would do if you were doing the accounting by hand. Try out a few numbers like 35, 40, and 45 to see if you get sensible results.

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

Welcome.

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

Please keep in mind that if you ask politely for help you are more likely to get an answer. Look at it this way. If you were to ask someone if they could babysit your dog for a few days while you were out of town, which would be more likely to get you what you want?

  1. I have to leave town for a few days. I would really appreciate it if you could take care of my dog for me while I am away.
  2. Take care of my dog for me.

Get the point?

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

I can't recommend a course but I highly recommend the book Beginning Python: From Novice to Professional by Magnus Lie Hetland.

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

Assuming Windows, have you tried opening a command shell and typing

pip install pygame

That is how most packages are installed. If this is what you tried, what was the output?

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

Why not just get another 8 gig of the same memory you already have?

lewashby commented: Because all I know is that it's 8GB ADATA XPG, I know nothing else. +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

im using pycharm community v2022.1.1

That doesn't tell me what version of Python you are using. Go to a command shell and type "python". It will respond with a python shell including a python version number. It will likely be 3.something.

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

There are so many things wrong with this post.

  • You posted a demand for a solution
  • You didn't actually post a question
  • You didn't show the work, if any, that you have done so far
  • Read the forum rules and try again

Please 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

What have you got so far, and what version of Python are you using?

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

Wee_396 commented: im using pycharm community v2022.1.1 +0
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.

What you probably want is a login form that is presented to the user before allowing the main form to display. You'll either have to maintain a database of user roles, or if you are working with a Windows Domain, a domain group for admins and users.

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

Let's try a kinder, gentler tone. Why are you taking programming? Is it your intention to become a programmer, or is this just a side interest?

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

Ditto rproffitt, but have you considered there is a possible third state? What if the array is not sorted at all? What happens then? If you are guaranteed that it is sorted then you only have to check the first two elements, or the first and last to determine the direction, assuming the items are unique. If the number of elements is one or zero then the problem becomes trivial.

But you'll still need to implement a sort.

Ahmed_217 commented: well if its not sorted the output should say "array is not sorted" and if it is it should say that then reverse the direction +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You want a high mark but you don't want to actually do the work or learn anything. Would you also pay someone to go to the gym for you and expect to get ripped? That's not how life works.

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

You tagged this thread with "C". I added "Python" as a tag and removed "C".

Is your problem with the actual logic of the code (which we won't write for you), or is it with the scheduling (which you can do with the Windows Task Scheduler), which we can help you with?

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

Seriously? After Ukraine and numerous cyber attacks you'd trust anything Russian? Shame on you. Time to resort to your backup. If you don't have a backup then double shame on you. You should have a backup image of your system partition for just this event (I recommend Macrium Reflect). At the very least, a Macrium Reflect bootable recovery USB stick would allow you to access/recover all of your data files.

rproffitt commented: Also want to note that what comes with Windows seems to be good enough for an antivirus. +16
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Start with Python.

  1. It is easy to learn the basics
  2. There are lots of online tutorials
  3. There are people here who can help
  4. It is not a niche language
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.

Nobody here will do your homework for you. If you want to ask a question I suggest you state it as a request rather than a demand.

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

"Thing is, not all documentation is created equal. And if I’ve learned anything over the past five or so years, it’s that depending on official documentation is like depending on a shoe to make you breakfast."

  • Jack Wallen (software developer)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I discovered, after upgrading to Python 3.10, that wxPython no longer worked. Fortunately, a kind soul at wxpython.org suggested I try installing a snapshot build of wxpython via the command

pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython

So far my existing wxPython scripts run just fine. If you are wondering why the rush to go to python 3.10, the newest version finally introduces a case clause and improvements to error messages. More details can be found here

Note that like everything else in python, the patterns allowed in match-case can be abused to make the code unreadable. A tutorial on patterns can be found here

tmorar commented: Thank you. It works with my Python 3.11.0b3 +0
Rohit_62 commented: Thanks a lot! I've been looking for this solution for the last 1 hour. It is working with my python version 3.10.5 as well. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Google tutorial vb.net splitters and watch the top hits.

Android Oyunlar commented: I cant find solution everyone is using splitters for 2 splitcontainer.panel (even microsoft) +0
rproffitt commented: That worked for me. Thanks. +16
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 found Plex to be like using a cannon to kill a fly. If you want something with a small footprint and not overburdened with options and features you'll never need try the Universal Media Server I mentioned earlier. I had it installed and configured in minutes and it does everything I want.

I may be mistaken, but I seem to recall you need to create an account (free) to use Plex, and log in. UMS runs locally with no required account or login. You can also run it as a Windows service (which I do not).

lewashby commented: That sounds just about like what I'm looking for. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm about to have a look at https://www.universalmediaserver.com/. You might want to look as well.

lewashby commented: That last comment was to your first commend about VLC. The UMS looks very interesting. +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could try the free DivX Media Server

It's not quite standard (whatever that means) but it might do the trick. I use it for casting to my ChromeCast. However, it is non-standard enough that I can't use it to stream to my Oculus Quest 2 using BigScreen.

As a side note, I discovered that I could use BigScreen Remote Desktop to accomplish essentially the same thing.

lewashby commented: I looked up DivX Media Server, it's not available for Linux. Thanks for the suggestion though. +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You may get a kick out of Don't Hit Save

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

In 1971 (almost before the invention of tech) I was in first year engineering (was going to be chemical) and I sucked at physics labs. A professor let me use his computer account to tinker with BASIC and I ended up writing some code to generate my physics lab results. The next year I switched to computer science. Third best decision of my life (behind getting married and having kids).

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

I've been running nothing but Windows Defender on all the machines I've set up for many years now with no problems. I HAVE updated several friends' anti-virus when they complained about high CPU load when running:

  1. Trend Micro
  2. Norton Antivirus
  3. McAfee
rproffitt commented: Norton. "Hey, we'll mine bitcoin for you!" +16
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Any GUI programming I do in Python is done with wxPython, which is built on wxWidgets. This is a cross platform set of components which causes all controls to be rendered in the target system's control set. That means that the application will look like a native application no matter what platform it runs on. There is also a free tool, wxGlade, which will help you develop your GUI.

Unlike tkinter, wxPython/wxWidgets is regularly updated. Unless using tkinter is a requirement (for example, for course work) I strongly suggest you consider using wxPython. If you decide to go this route I will be happy to answer any questions to the best of my ability.

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

My guess is that it was removed because it is provably B.S.

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

If you can afford it, and you think it will encourage worthwhile posts, then by all means. As in the past, I will not redeem any bonuses earned. I do it for the love of the craft.

pritaeas commented: Agreed. If you you can but don't try, you've already failed. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The following may, or may not work depending on the scope of num1.

Private Sub btneqClick(sender As Object, e As EventArgs) Handles btneq.Click

    num2 = Convert.ToDouble(Display.Text)

    Select Case op
        Case "+"
            ans = num1 + num2
            num1 = ans
            Display.Text = Convert.ToString(ans)
        Case "-"
            ans = num1 - num2
            Display.Text = Convert.ToString(ans)
        Case "÷"
            ans = num1 / num2
            Display.Text = Convert.ToString(ans)
            If num2 = 0 Then
                Display.Text = "error!"
            End If

        Case "×"
            ans = num1 * num2
            Display.Text = Convert.ToString(ans)
    End Select

End Sub
DAVE_44 commented: what should be the scope of num1 for this to work? hahahaha it did not work on my code +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As a further note, if you see the same line of code in every if-else block, that's a good sign you should move it out of the block and put it just once at the end. You also might want to look into the select statement. It's a little cleaner.

DAVE_44 commented: I already done this one but I cannot code the one you mentioned on the other comment +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You have to adjust the value for num1 so that the next time you click = you get the correct answer. If you want ans to be the sum of num1 and num2 the first time, then num2 and ans the next time, you'll have to assign ans to num1. That way each time you click = you will add another num2 to the result.

DAVE_44 commented: I understand what you mean but I do not know the code of that. I am sorry can you type it in Visual Basic Language? +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Welcome to Daniweb