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

Here's a gotcha from years past:

Our AGC/SCADA system was written mostly in FORTRAN. While making a very small modification to a piece of code I did a small reformatting to correct bad indentation. In the process, one line became one character longer. In those bygone days, columns 73-80 were reserved for line numbers (at one time punch cards used this formatting) even though line numbers were not used on disk based files.

Assembler modules could be called with missing parameters by using commas with no values such as

CALL SOMECODE(p,x,v,,,,,,,,m)

Unfortunately, in my case, the call was very long and spanned two lines so one of the commas got pushed into column 73 and was therefore ignored by the compiler. That completely broke the code in a way that took two weeks of debugging to figure out (a visual inspection showed nothing wrong).

Short version - be very careful when refactoring.

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

Since comments are supposed to reflect what the code does, I have gotten into the habit (over many years) of writing my comments first and then adding the code. If the code is obvious, comment it anyway. What is obvious to you now may not be obvious to you (or someone else) down the road.

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

deflare -> deflate

rproffitt commented: Deflare is Latin but when I've used it, no one seemed to correct me. "deflatum" also is there. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

realize -> recline

Dani commented: Now why didn’t I think of that?! :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Having spent years maintaining and rewriting abominable code by supposedly professional programmers (the company had actually been paid several million dollars for their system) I tend to occasionally go ballistic when I come across bad code so I sincerely apologize for over-reacting. I do not know your level of expertise and I forget what it was like when I was just starting to code (many many many years ago).

Dani is quite correct. Instead, I could have just as easily said "there is a much better way to do this, and here it is."

You have a number in the range 1-15. Instead of testing for every possible number, convert the int to a hex string. The code below may not be exactly right because I have not programmed in C/C++ in many years but it should give you the basic idea.

void setcolor(int color) {

    char s[9];

    if (color >= 1 && color <= 15) {
        sprintf(s, "color %02x", color);
        system(s);
    }
}
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've tried EqualizerAPO, and while it has a lot of features, the UI is complete crap. Can I suggest something simple? Why not put the headphones on backwards? I have Bluetooth headphones and they fit the same either way.

rproffitt commented: Most likely because the L and R labels would be on wrong. +16
koreydeluca commented: Well that would work but my headphones are fitted and feel funny backwards, +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What kind of ads you would not mind seeing on a searchengine

Let me be a little more precise. It's not so much the ads I mind, after all someone has to pay for the service. I would just like to see them separate from the search results. When I do a search I don't want most or all of the first page to be links prefixed by Ad. The ads may be relevant to the search, and they may even be the most relevant, but for all I know they may be there only because google was paid to put them there.

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

The first thing to do with any infrastructure you set up is to change the default passwords. You'd be appalled to find out how many breeches occurred because a sysadmin left admin/password as the defaults.

rproffitt commented: "One, two, three, four, five? That's amazing. I've got the same combination on my luggage." +16
nancykhoo58 commented: Make sense ! Thanks ! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

May I suggest that instead of asking us to look it up and explain it, you take the time to google "what is click fraud" and read the results. Feel free to post follow up questions if the answer is still unclear.

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

neither ChatGPT, nor any AI, for that matter, has a "soul" or capacity to understand the nuance of emotion

Voice of Fire is a piece of "art" purchased by the Canadian Government for 1.8 million back in 1967. It is three vertical bars, two blue and one red. It is a soul-less piece of crap. I'd take just about any AI created art over that. A piece of art does not have to have a soul to be beautiful. Who knows what was in the heart of an artist at the time of creation?

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

The big argument, as I understand it, is that this takes away opportunities for real artists/musicians/etc. to earn a living from their work product. While true, that argument has often been used to try to halt the use of any automation. Technology progresses and certain jobs get left on the garbage heap of history. Go to youtube and watch some of the "how it's made" videos to see how machines make things much more efficiently than humans. Nobody makes industrial chains by hand anymore. And nobody makes buggy-whips at all. I don't recall ever seeing a blacksmith shop other than at a historical theme park like the fortress at Louisbourg (Nova Scotia). I remember when musicians unions came out strongly against synthesizers, fearing that they would be out of work as electronic music evolved.

Then there is the argument that AI will put coders out of business. Even long after the introduction of personal computers into the workplace, most code had to be developed from scratch. A lot of that was grunt code that was time-consuming and tedious to write. Now we have packages for just about everything. These packages are generally well written and highly optimized. When developing a Python app for managing my photo collection, instead of spending weeks or months researching digital photo manipulation in order to look for similar images, I can import pyPIL and code up something to do the comparison in just a few hours. I don't find this a threat. I find it …

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

So should discussions of AI applications be banned altogether on Daniweb?

By implementing such a rule we would be unable to have this discussion.

rproffitt commented: From what I last read, the AI that can't be named would be a rule violation if written here. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

G'day and welcome to Daniweb.

Cargen commented: Thank you, have a good day +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The comment tool should be used to add a brief comment to a post. If you are asked to provide further details or code you should add a new post to the thread. In your case in particular, posting code in a comment results in truncated and unformatted code.

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

I believe that you need the drop column command, not a delete.

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

#1142 - DELETE command denied to user 'pma'@'localhost' for table 'pma__column_info'**

I've done very little SQL since I retired so my skills are quite rusty but it just sounds like a permissions problem.

I am trying to delete two cols in my mysql tbl:

Actually, you are trying to delete rows which is a data modification (deleting data). Deleting columns would be a schema modification (changing the structure of the table).

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

Can you please post a screencap of the disk manager showing the problem drive? If you don't mind losing what's on the partition (I am assuming when you say three drives you mean three partitions), you could always use disk manager to delete the problem partition and then recreate it or expand the adjacent partition to use the new space.

In some cases where disk manager does not work you can use either DISKPART.EXE in an admin command shell, or the free version of easeus partition manager.

andrewecook commented: ok thanks a lot! Whenever i install easeus it says administration permission.in this case how can i resolve this? +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I hope that even my worst critics remain on Twitter, because that is what free speech means

  • Elon Musk in April 2022

Thursday December 15, 2022 Elon Musk conducts a banning spree of journalists from The Washington Post, The New York Times, Vox, CNN, Mashable, and The Intercept. All were individuals who covered him.

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

Definitely a case problem. Use csv.writer (lowercase). You'd have seen this if you were using an intellisense capable editor. Even idle would have pointed this out.

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

I don't often rave about software (ok, other than my own), but I have to give two big thumbs up to the latest release by Topaz Photo AI.

I have a very large collection of family photos reaching back to the turn of the last century. I long ago converted them to digital but I have always been disappointed that so many of them were fuzzy. Through one of my many newsletters I came across the latest release of Topaz Photo AI. While there are many packages that allow tweaking of digital images, I have yet to see anything that is so easy to use (with default settings) while producing outstanding results.

The package, which retails for just under $200, includes three modules that if purchased separately would cost around $250. The modules are

  1. gigapixel (for upsizing)
  2. denoise (noise removal)
  3. enhance (facial recovery and sharpening)

The software, as downloaded, is fully functional, lacking only the ability to save the results. If you want to save your work you have to pay. Sort of. When you drop an image onto the interface and scroll via mouse-wheel until the image is fully displayed, the AI engine immediately goes to work analyzing the image. Depending on the complexity and size of the image and the capabilities of your system, the processing could take up to 30 seconds. Photo AI offloads as much processing as possible onto your GPU so a good graphics card really helps.

After the processing is complete, …

pritaeas commented: Those are some impressive results +17
tarael1 commented: Remarkable. Thank you for sharing. +2
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.

Please be advised that we are not a homework assignment service. You should not expect to learn anything if we do your work any more than you would expect to get fit if someone else exercises for you.

fouad_4 commented: Because of the lack of time, I can no longer do the project. I am in a great hurry to deliver tomorrow, and I cannot do it +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Assuming this is assignment, as a former marker I would deduct points because of a complete lack of useful comments. You should get into the habit of providing a blurb for each function/method. Even if it's only for yourself, future you will thank present you for going to the effort.

Thao_14 commented: thank you for respond, can you tell me where are those useless comments please, I need to fix this program +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

which language should somebody need to start developing a game?

I would suggest the language you know, assuming it is appropriate for game development. Getting back to my 3D Breakout game, if I had tried writing it while I was learning python I would have made a large number of bad design decisions. A few years later I wrote a Sudoku application. It was actually a port of an earlier version I had written in vb.NET. The structures of both versions were radically different just because of the different languages. By the way, it was much much easier writing it in python.

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

Popular doesn't mean best, and best can depend on many factors:

  1. speed of game play and complexity of calculations
  2. speed and ease of development
  3. available resources
  4. skill and number of developers
  5. type of game (first person shooter, puzzle, etc.)

Years ago I wrote a 3D breakout game in python. Given the tools available today I'd likely pick python again.

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

Um... you are welcome?

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

I don't know about vb.NET but I do know that there is a python library available to create & decode qr codes so I would imagine it is doable (probably not as easily) through vb.NET.

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

We can't all know everything (except for my engineer brother who has assured me that he actually does). We can always use another member who has both the time and the expertise to help.

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

My problem was the order in which you decided to look for problems.

Well now I guess you don't use your computer much

Only 6+ hours a day. What do you define as "not much"?

Plus more than 30 years of (aside from my regular job of developing/maintaining software) desktop troubleshooting and support. This goes all the way back to when we had to worry about IRQ conflicts and stone-age parallel and serial ports. And the troubleshooting always consisted of looking for the simplest option first.

  1. Try another mouse
  2. Try the mouse on a different computer
  3. Try a different device in the same port
  4. Run diagnostics
  5. Boot into another OS from CD/USB stick
  6. Find out what has changed since the mouse last worked

Cleaning the registry

Even automatic Registry cleaners have been known to incorrectly identify and delete important Registry values. While the registry may accumulate cruft after years of use, it likely will not impact performance. For all but experienced users (who always back up the registry before making changes), this should be left alone.

Startup apps

Generally speaking, having too many applications start automatically will impact startup time. If the system is short on RAM it could impact performance (excessive swapping), but this would exhibit itself in all areas, likely not mouse.

Hard drive

Would likely show up as file I/O errors, or, in cases of system file corruption, system crashes. Running the system file checker and checkdisk could narrow this down. Checking the …

rproffitt commented: This is the way. The number of times it's been Windows (as in stock Windows) has been zero in decades. +0
CurtisUN commented: I may have not stated it in the order I use but the basics was there. +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think that people should do their own homework. Services that do homework for others:

  1. Add to already overwhelming student debt
  2. Rob students of the education they already pay too much for
  3. Cheapen the degree the rest of us honestly earned
  4. Deceive employers who hire graduates
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The question was never answered because a question was never asked. The OP just posted a homework assignment.

That's basically saying "Here's my homework. Do it for me." That never goes well.

cyrennex commented: So How can I find the correct answer for this?? +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Follow-up question - what happens when the "new twitter" decides that anything goes except

  1. negative comments about Tesla
  2. negative comments about SpaceX
  3. negative comments about Elon Musk
  4. comments that run contrary to Elon Musk's political views
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As our men of business become more prominent and wealthier, they enter a feedback loop. Sycophants flatter instead of challenging them. This impacts their ability to hear criticism. And that leaves them more likely to cling to toadies who feed their now inflated self-image. All too often, the end result is ever larger mistakes and more ethically dubious behavior.

  • Helaine Olen (Washington Post)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Let me ask you this. What about twitter needs to be torn down and rebuilt? Is it the code base? What about that is the problem? It seems to me that, societal impact aside, the problems with twitter are:

  1. content
  2. moderation

What exactly requires the mass layoffs and excessive work hours from the remaining staff to fix? How exactly would a "rebuilt from the ground up" twitter differ from present day twitter?

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

freedom of speech, but not freedom of reach

You can't have one without the other. In any case, freedom of speech is not what you think it is. It just means the government can't censor what you say (which Ron De Santis just found out in Florida). Since, twitter, Facebook, Reddit, etc. are app non-government platforms they are well within their rights to determine what ma, and what may not be posted.

And something that should go without saying (but apparently very much needs to be said), freedom of speech does not mean freedom from responsibility for what you say.

rproffitt commented: Queue Alex Jones and what it will cost him! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The point I was trying to make is that there is functionally little difference between

if condition
    exit
else if condition
    exit
else if condition
    exit
else
    something

more code

and

if condition
    show_error()
else if condition
    show_error()
else if condition
    show_error()
else
    something

more code

They all short circuit the structured code. But at least in the first case the short-circuiting is explicit. In the second case a casual reader would assume more code will always be executed. The second case is extremely misleading and should never be used.

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

If exit does what I think it does then aren't you still short-circuiting by wrapping it in another function?

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

In other words, if it ain't broke, don't fix it.

Then I recall the quote from Dr. McCoy in the first Star Trek movie. "You know engineers. They just love to change things."

rproffitt commented: "Damn it Jim, I'm a doctor not a social media company CEO." +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Might as well put a sign over the door that says Abandon all hope ye who enter here.

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

Musk has also just announced that parody will not be tolerated. So much for his free speech declaration.

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

Based on Musk's inability to verify accounts so far, and his apparent willingness to let everyone say anything I'm not hopeful. Facebook also just announced that they will not fact-check political posts. Just in time for Trump 3.0.

Heavy sigh

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

What part are you having trouble with? By the way, the formula, in Python terms is

35.74 + 0.6215 * t - 35.75 * v ** 0.16 + 0.4275 * t * v ** 0.16    
Nick74 commented: I'm having trouble with the windChill function and the def Main() +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you put a little more effort into clarifying what you are looking for you might find people willing to put in some effort in answering it.

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

If the numbers only differ at the 18th decimal, unless the numerator is sufficiently small, dividing a number by the difference could generate an overflow.

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

To illustrate in Python

>>> a = 15638.3627834621516782673486583
>>> b = 15638.3627834621516782672736583
>>> a - b
0.0
>>> a == b
True
>>> a
15638.362783462151

You can see that Python does not keep all the digits.

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

I wouldn't. I'd write the pseudo-code first, then make it into comments, then write the code.

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

I've been using only the Microsoft Defender software for years on a dozen or so computers and not one virus yet.

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

First of all, you don't need a to_numerical function. Instead of doing

for char in string:

do

for char in string.lower():

and if you have a const string 'abcdefghijklmnopqrstuvwxyz' you can find the one-relative value of the char by doing 'abcdefghijklmnopqrstuvwxyz'.find(char) + 1. That expression will evaluate to zero if the char is not a lower case letter.

The resulting get_numeric_value function is only five lines with no if statements required. Now all you need is to add a variable inside the loop to keep track of the total.

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

Show us what you have so far and where you are stuck. Also, because of the ambiguity of the spec, please state what output you expect.

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

OK. Found my problem. I was using the wrong graphics.py. Once I had the correct one I was able to run the code. First suggestion is learn how to use loops instead of replicating the code. You can replace

p1 = win.getMouse()
p1.draw(win)

distance = sqrt((p1.getX() ** 2  + (p1.getY())  ** 2))        

p2 = win.getMouse()
p2.draw(win)

distance = sqrt((p2.getX() ** 2  + (p2.getY())  ** 2))

p3 = win.getMouse()
p3.draw(win)

distance = sqrt((p3.getX() ** 2  + (p3.getY())  ** 2))

p4 = win.getMouse()
p4.draw(win)

distance = sqrt((p4.getX() ** 2  + (p4.getY())  ** 2))

p5 = win.getMouse()
p5.draw(win)

distance = sqrt((p5.getX() ** 2  + (p5.getY())  ** 2))

with

for i in range(5):
    pt = win.getMouse()
    pt.draw(win)
    distance = sqrt((pt.getX() ** 2  + (pt.getY())  ** 2))

and you should be calculating the cumulative score after you calculate the distance. You should have code to redisplay the cumulative values inside the loop. It would look something like

for i in range(5):
    get next shot
    calculate distance from centre
    calculate score based on distance
    redisplay shot #, score for current shot, and cumulative score