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

Buying Instagram followers is pretty much the same unethical tactic as buying up copies of your own book to get on the best seller's list. It's dodgy at best and contemptible at worst. At least The Times identifies (although not obviously) best sellers that resulted from bulk sales. Too bad Instagram et al don't do the same.

rproffitt commented: "Adult non-fiction, however, was down by 13%, as readers sought solace in imaginary worlds." - Imagine that. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Eric Schmitt, the Republican attorney general for Missouri, is suing the Chinese government. In his official statement he says "The Chinese government lied to the world about the danger and contagious nature of Covid-19, silenced whistleblowers, and did little to stop the spread of the disease. They must be held accountable for their actions."

Time to get out the old irony meter.

2008-12-23_Irony.jpg

rproffitt commented: Let's not talk about government workers fired for reporting back in 2019 to present day about COVID-19. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I suggest you start here with the python turtle module.

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

I didn't say it was her fault. I said I was blaming her.

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

Trump tours Honeywell plant in Arizona maskless while the sound system blares out "Live and Let Die". A cease and desist order from Paul McCartney is likely forthcoming.

rproffitt commented: 'We've got a mad captain sailing this boat' - Paul McCartney +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In a recent interview regarding Covid-19, Mike Pompeo stated both that

  • The “best experts” think it was “manmade".
  • He believes and trusts the Intelligence Community which says it was not.

Does that clear things up?

rproffitt commented: Thank you for my daily briefing. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can't you select a USB device as your first boot option in your BIOS/EUFI settings? Do you need to boot from external so frequently that just pressing the boot options key when you boot is not an option?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
  • The world is in the grip of a pandemic.
  • Donald Trump is an idiot.
  • Japanese giant hornets are now in North America.
  • Tom Hanks is still pretty awesome.

You are now updated.

rproffitt commented: "And that's the way it is." Walter Cronkite +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I spent the last 8 hours sorting screws, nails, and whatever. My younger son moved into my father-in-law's old house and we have been cleaning out his crap since mid January. He never threw out anything and saved about a billion drywall screws (which he absolutely loved to use to build anything) and every nail he ever bought or pulled (bent, rusty, or not). And of course everything was mixed up with everything else. But now it's done and my son and I each have our own tray consisting of sorted compartments of various lengths and types of screws and nails, and an assortment of metal washers.

Can anyone tell me the rationale behind Phillips head screws? Pop loved to use them and his technique was to drive them in with a variable-speed drill on high speed until the screw was stripped. It seems to me that square hole screws offer better drive (they don't pop out) and are much harder to strip, and easier to remove. And don't get me started on slot type screws.

We do find the occasional treasure. For example, he owned three belt sanders. I suppose he either forgot he alrready owned one or couldn't find it when he needed in. He also sa ved (in six different places) six pieces of diamond willow which we used to make this.

Diamond_Willow_Mobile.JPG

rproffitt commented: 3 belt sanders? Sounds like a sand belt racing team to me. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Kind of hard to do that without seeing the code.

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. You might want to watch How to create notepad in vb.net first.

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

So you're a Flat Earther?

Living where I am it's hard to dispute based solely on direct observation, unless you discount things like the shadow of the Earth on the moon, etc.

rproffitt commented: As you may have guessed, I was joshing you there. But it does sound flatter than a pancake. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You cold also check out this article on the difference between machine learning and AI.

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

It takes under 10 seconds to cross two lanes. Remember, I live on the prairies where you can stand on your front doorstep and watch your dog run away from home for four days.

Well, maybe not, but you can see cars coming from a long long way off. You can get the idea by following my google maps link and doing a street view.

rproffitt commented: So you're a Flat Earther? +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm assuming that because the OP was too lazy to try this on his own first, he was also too lazy to expand WAP to "Write A Program".

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
datetime.date.today() - datetime.timedelta(days=100)

gives you the date - 100 days.

>>> import datetime
>>> datetime.date.today()
datetime.date(2020, 4, 24)
>>> datetime.date.today() - datetime.timedelta(days=100)
datetime.date(2020, 1, 15)

You can see the month is 1.

rproffitt commented: Sorry for the +1 a month late but here it is. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You need to use the code tool </> to insert blocks of code. What you posted is not posted as code and without proper indentation it is meaningless.

Radroad commented: Thank you Ill do that +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can download the first two chapters of Michael Driscoll's latest book, Creating GUI Applications with wxPython, here as a free sample from the publisher. And you can look at the code samples here.

JamesCherrill commented: Will do, thanks for the lead +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Welcome to Daniweb. I removed the spammy link to the online casino. We don't look kindly on spammers so please avoid posts that are thinly veiled spam.

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

An obvious first guess would be a failed power supply.

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

Trump is leaving it to the governors to decide when to re-open things, but he has stated he wants things to open up sooner rather than later.

Trump is pissed at New York for keeping things locked down (he is encouraging protests).

Trump is pissed at Georgia for wanting to re-open.

It seems he hates Democratic governors who want to keep people safe and Republican governors who want them to get sick.

But if blue states get sicker their economies will collapse faster.

Blue (have) states fund most red (have not) states through federal taxes.

If blue states can't pay federal taxes because their economies have collapsed then red states suffer.

Nothing makes sense any more. Maybe that movie quote was right. Some people just want to watch the world burn.

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

PS. Code Snippet is to be used only for working (debugged), commented, and documented code.

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

I see three mains, actually.

rproffitt commented: Thanks. I stopped reading after the second then {}'s looked unbalanced. Not much needed to fix if that's it. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The only way to permanently disable it is to never connect to the internet.

danialvin commented: hmm +0
rproffitt commented: That's about the only way. I've seen folk try many things, this works. Also, Linux. +15
streamvn commented: hahaaaa +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Sounds like you understand it. What's the problem?

Edoburun commented: And I want confirmation if am in line, thank you +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That was a Duh! moment

We've all been there.

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

You are calculating

TotalPay = ((float(hrs) * float(HourlyRate)) + ((float(OvrTimehrs) * float(OvertimeRate) *   float(HourlyRate))))

You are using the total hours multiplied by your hourly rate. You want 40 * HourlyRate. That would give you the answer you expect.

littlepr commented: Oh! That was a Duh! moment in my logic. Thank you Reverend Jim. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Awesome introduction. Welcome to Daniweb.

Donna_9 commented: Thank You :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

BTW an excellent Python book is 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

It's been a few years since I tried it but I was impressed with Komodo IDE. It's by ActiveState and they have versions for all major platforms. They also have their own implementation of Python. Best of all, they recently made Komodo IDE free. I'd start with that one. The only reason I don't use it is because I use the Visual Studio IDE for debugging.

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

One good thing at least - March 2020 was the first March without a school shooting in the U.S. since 2002.

Dani commented: Yeah, I heard about that as well. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are interested, here is one implementation using pandas. Note that the first line in the data file must be

Routes,Passengers

import pandas
import sys

df = pandas.read_csv("airlines.csv")

# calculate total flights per airline

totals = {}

for route,passengers in zip(df['Routes'],df['Passengers']):
    airline,*rest = route.split()
    totals[airline] = totals.get(airline,0) + passengers

# print out the totals for each airline and find max total

maxpassengers = 0

for airline,passengers in totals.items():
    print(airline, passengers)
    if passengers > maxpassengers:
        maxpassengers = passengers
        maxairline = airline

print("\nmax airline is",maxairline,'with',maxpassengers,'passengers')
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I presume you heard what happened in Wisconsin? A 10-year seat on the state supreme court opened up and the GOP forced an election at the height of the pandemic figuring that

  1. Democrats would be too afraid to go to the polls to vote
  2. Republicans would be too stupid not to

In spite of all efforts to

  1. Close numerous polling stations
  2. Disenfranchise Democrats
  3. Restrict mail-in absentee voting
  4. Gerrymander districts

The GOP candidate still lost by a 10% margin. Now I'm waiting to see how the GOP manages to rule the election invalid. Incidentally, the GOP still retains a one vote majority on the state supreme court but the writing is on the wall.

rproffitt commented: As to the voting, the current destruction of the US Mail is underway, BIG TIME. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are going to use pandas then forget the standard file open and just do

df = pd.read_csv("airlines.txt")

and keep in mind thatin your for loop, Airline will contain both the airline name and the route name. For example, one line of

Alitalia Rome      180

will give you "Alitalia Rome". You might want to try

for route,flights in zip(df['Airline'],df['Flights']):

and then separate the airline portion by

airline,*rest = route.split()

If you are unfamiliar with this expression, what it does is to split the string using a space as a delimiter. The first token (the airline) goes into airline and the remaining tokens go into rest. This saves you from an error if the route has more than one word.

Once you have the dictionary built you'll still need to iterate through it to find the entry with the largest number of flights.

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

10 years for me. Same comments as James but different languages. Never benn a java fan.

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

That's sort of pseudo-code but still too code-ish. Try to write it like you are telling a person how to do it step-wise with pencil and paper. Your pseudo-code shouldn't have terms like 'open file', 'string', 'integer', or whatever a 'boucle' is.

There is a very useful feature in Python called a Dictionary. A dictionary uses key-value pairs. Unlike a list which you index by an integer, a dictionary is indexed by a key which can be any type. If you use the airline name as the key and the number of flights as the value you can keep a running total for each airline. The only gotcha is that you have to check if the key already exists, so your code looks like

totals = {}     # create an empty dictionary

If you split each line into three fields named airline, route and flights then you can do

if airline not in totals: totals[airline] = 0
totals[airline] += flights

So take that and try to figure out the rest.

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

Although I don't know why you are importing collections when you aren't using them, and I think you are over-complicating things by using pandas dataframes for such a simple application. I suggest you write your process as pseudo-code before you try to write actual code. Debug your pseudo-code on pencil and paper first with a small dataset example.

From what I can see you need to add a header line to your CSV to name the columns. For example, if your file looks like

Airline,Flights
Alitalia Rome,180
Alitalia Pisa,82
Germanwings Munich,96
Germanwings Frankfurt,163
NorwegianAir Bergen,202
Wizzair London,184
Wizzair Frankfurt,83
Wizzair Lisbon,198

then to iterate through the records you could do

for airline,flights in zip(df['Airline'],df['Flights']):
    print(airline,flights)

There are likely other ways to do this but I got this from a brief look at the 'getting started' guide. Let me know how it goes and where you are stuck and we can take it from there. I'll check back in a couple of hours.

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

I've never user pandas or collections but I noticed that although

from collections import counter

does not work,

from collections import Counter

does (upper case c in Counter). Perhaps that will help. I also noticed that the data you posted is not comma delimited,

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

You still haven't shown us that you have put any effort into doing this yourself. If you don't pony up then this thread will likely be ignored.

rproffitt commented: Giddyup. +15
Samuel_33 commented: I have been trying tom paste a copy but having a tough time doing that +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For future reference, if you want to count bits in an integer you should make it an unsigned int, and use bitwise shift right operations rather than division.

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

I was in the process of writing a response and after two sentences I realized I had already put more effort into replying than you did in creating the original post. Please show us what you have and where you are stuck.

Samuel_33 commented: #include <iostream> #include <fstream> using namespace std; /* The SMM Insurance Management System */ //function prototypes void displayMenu(); void +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When I was in school I did my own homework. You should do the same. It's called "learning". You might also want to reread your post. Instead of "can you please help me with this" it comes off more like "Here's my homework. Do it for me." The first is a request. The second is just a rude demand.

So let's try this again. What have you done so far and where are you stuck?

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

You do realize my answer was rife with sarcasm. I provided exactly as much good code as the OP provided bad code.

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

When asked, "What language should I learn first?", my answer is always "English". If you can't communicate clearly then you can't do your job as a programmer properly. As a programmer your job does not begin and end with code. You must also be able to write documentation clearly. I recently came across two excellent technical writing modules by Google that are free for everyone. They do not take long to complete and (aside from the confusion between acronyms and initialisms) are spot on. You can find the overview here with links to the two main modules.

A lot of you are shut in for the duration of the Covid-19 outbreak anyway so you have no reason not to at least have a look.

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

Several things:

  1. Remove lines 14-17. You are prompting for and reading input that you never use.
  2. You don't have brackets around your two statements after the else if so only the first is part of the block.
  3. Why are you summing the salaries? That wasn't part of the spec.
  4. You need to pick better counter names than count and lcount.
  5. Your spec doesn't match your code.

For the last point, your spec (incorrectly, I presume) says to count how many are over and how many are under. According to the spec you should ignore those that are equal. Try

int over    = 0;
int notover = 0;

do {

    cout << "Enter a yearly salary: R";
    cin  >> yearlySalary;

    if (yearlySalary > LIMIT)
        ++over;
    else
        ++notover;

    cout << "Are there any more values to be input? ('Y' or 'N') ";
    cin  >> answer;

} while (answer == 'Y' || answer == 'y');

cout << "There are " << notover << " salaries that do not exceed R100 000." << endl;
cout << "There are " << over    << " salaries that exceed R100 000." << endl;
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try

$stmt = $pdo->prepare("INSERT INTO 'download' ('IP_ADDRESS', 'FILENAME') VALUES (?, ?)");

Note the small change from ") to )")

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

You declare the dimensions of island as [4,1] but you index the columns as 0, 1, 2, 3 (lines 2-5). Did you mean to do

island[0, 0] = "Nassau" + "210";
island[1, 0] = "Freeport" + "$350";
island[2, 0] = "HarbourIsland" + "$400";
island[3, 0] = "MarshHarbour" + "$275";
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

i try but i didn't get the right input

Your program doesn't have any input. Your problem is in lines 23-49. Here is the correct code.

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

We won't do your homework for you, but if you show us what you have tried so far and where you are stuck perhaps we can help.

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

There is no direct way to do that but I'd like to point out a potential problem. What do you do when a week straddles two months?

If you still want to have months with weeks under you might use a tab control with one month per tab. That has the benefit of not requiring horizontal scrolling.

andre.jonker commented: thanks for the quick answer. I go for you solotion +0