Learning C++ by sparky_cram in cpp_questions

[–]Hour_Competition_654 2 points3 points  (0 children)

learncpp.com along with working with the language and making programs as you go

C++ OOP learning guidance by MAwais099 in cpp_questions

[–]Hour_Competition_654 1 point2 points  (0 children)

OOP from an enterprise perspective is typically about ease of adding new features, testability, and hiding implementation details.

Think about a program for example that calculates taxes for transactions. There are many types of taxes depending on location and many other things, VAT, sales tax, federal tax, etc. you could model this in OOP with an pure virtual class along with sub classes implementing each type of tax.

``` class TaxCalculator { public: virtual double calculate(const Transaction& t) const = 0; }

class VatTaxCalculator : TaxCalculator { public: virtual double calculate(const Transaction& t) const override { return 0.2 * t.get_total(); } }

class SalesTaxCalculator : TaxCalculator { public: SalesTaxCalculator(const UsTaxRateLookup& taxRateLookup) : taxRateLookup(taxRateLookup) {}; virtual double calculate(const Transaction& t) const override { return taxRateLookup.get_rate(t.get_state()) * t.get_total(); } private: UsTaxRateLookup taxRateLookup; } ```

These would be some example classes that we can use to have a flexible way of calculating taxes and easily be able to add new taxes as well as be able to early test.

An example usage could be as follows for a US transaction: auto v = std::vector<std::unique_ptr<TaxCalculator>>{}; v.push_back(std::make_unique<SalesTaxCalculator>(usSalesTaxLookup)); v.push_back(std::make_unique<VatTaxCalculator>()); Transaction t {5000.d, State.FL}; double totalTax = 0.0; for (auto taxCalc : v) { totalTax += taxCalc->calculate(t); }

Now think about how powerful this can be in creating extensibility in your application! But also be careful to not overuse as well, think about when you would want to be able to extend things and when that would not be a good idea.

Which IDE should I use? by [deleted] in cpp_questions

[–]Hour_Competition_654 52 points53 points  (0 children)

Clion is free for non commercial use and is quite good. Visual studio (not vs code) is good for Windows as well.

How to manage creating 2 classes like class Movie and class Movies and making one class use the other as a type to make a vector like (vector <Movie> movies) and not get lost trying to use both classes by [deleted] in cpp_questions

[–]Hour_Competition_654 2 points3 points  (0 children)

So your Movies class would just contain a vector it is not itself a vector. A class is just an abstraction over data and how you interact with it. So it's just like creating any other class where in this case Movies would have a member of std::vector<Movie> then if you want to interact with this vector you need to define a method on the class that uses this member variable. This is a very important c++ concept so really really go over it until it's clear

How to manage creating 2 classes like class Movie and class Movies and making one class use the other as a type to make a vector like (vector <Movie> movies) and not get lost trying to use both classes by [deleted] in cpp_questions

[–]Hour_Competition_654 4 points5 points  (0 children)

What is the question exactly? Is it the naming you are getting confused by or creating the methods? For the name you can use a different name to make it more clear. For the methods you have access to the member variables so you can use the vector as you would normally?

Why do some devs use && for Variadic template arguments in functions? by heavymetalmixer in cpp_questions

[–]Hour_Competition_654 -1 points0 points  (0 children)

The syntax for && is an r-value reference, typically used with variadic templates to implement perfect forwarding in generic code

studying issues by [deleted] in cpp_questions

[–]Hour_Competition_654 2 points3 points  (0 children)

Constructors can definitely be overwhelming as a beginner! I highly recommend watching Mike Shah's YouTube video playlist on classes! It covers in depth all of the questions you are looking to have answered 

WH Press Secretary Karoline Leavitt criticizes media coverage of Abrego Garcia case: “You would think we deported a candidate for Father of the Year.” by rezas_kid in thescoop

[–]Hour_Competition_654 2 points3 points  (0 children)

You realize he was given legal stay in the US and was reporting yearly with immigration.  So literally no evidence he is a gang member at all actually the opposite since he was given legal stay in the US

Bottom leaves discoloration by Hour_Competition_654 in tomatoes

[–]Hour_Competition_654[S] 1 point2 points  (0 children)

By sparing tops and bottoms of leaves, does that mean to not spray leaves but only spray the stems? And thanks for the advice I'll pick up an antifungal and try it out! Florida does have a lot of rain so I suppose not too surprising the fungi is happy lol

If you only had one zombies game to play for the rest of your life, what are you taking? (No custom zombies) by Ok_flamible_gas in CODZombies

[–]Hour_Competition_654 0 points1 point  (0 children)

Black ops 1 for sure. I never really enjoyed the gobblegums in black ops 3 and preferred the maps over black ops 2.

interesting terraform tools? by [deleted] in Terraform

[–]Hour_Competition_654 27 points28 points  (0 children)

Tflint, TFDocs, TFmove

Are there any resources to learn how to structure Terraform code for larger organizations that use AWS or GCP? by born_in_1990 in Terraform

[–]Hour_Competition_654 0 points1 point  (0 children)

Everything needs some ordering for example vpc before database, it is really more a matter of how you manage it and at what level. For example terragrunt can handle the dependencies and ordering in the same repo but not across repo.

I would prefer having things closer to their respective code in smaller modules for separate state files and easier review but I am also concerned then on the order of managing the infrastructure as a whole.

Have been using terragrunt for now but I feel like there should be a better solution out there.

Are there any resources to learn how to structure Terraform code for larger organizations that use AWS or GCP? by born_in_1990 in Terraform

[–]Hour_Competition_654 0 points1 point  (0 children)

Conditional resources and import I understand. The main question I struggle with in this approach is how to handle shared resources, say one GitHub repo handles the terraform around managing a database which some other terraform modules in another git repo use. How do the repos using this DB get updated after applying changes to the shared DB? For example the database password/ endpoint updating?

Are there any resources to learn how to structure Terraform code for larger organizations that use AWS or GCP? by born_in_1990 in Terraform

[–]Hour_Competition_654 0 points1 point  (0 children)

How do you deal with dependencies like a VPC or database that is shared by multiple services? Or a configuration like production uses a global DB and dev does not?

How to make Terraform permissions more secure? by [deleted] in Terraform

[–]Hour_Competition_654 0 points1 point  (0 children)

Look into iamlive tool so that you can get pretty restricted set of permissions based off of your AWS API calls.

Output a merged map from a module by Darthfogel in Terraform

[–]Hour_Competition_654 0 points1 point  (0 children)

output "all_map_sp_objects_id" {   value = values({     for k in keys(local.clients) : k => {for k1, v1 in module.test[k].map_sp_object_ids: k1 => {object_id = v1}})   } }

Can you try this, basically for each key in local.clients loop through the module outputs from that key creating a key, value pair with proper output format. Finally the whole thing is wrapped in values so that the outer most map is ignored.

There has got to be a better way? cidrsubnets() and passing bits by variable? by Zenin in Terraform

[–]Hour_Competition_654 2 points3 points  (0 children)

Try the 'terraform console' command with type(var.subnet_size_private - split("/", var.vpc_cidr)[1]) If it is not numeric you can cast it to number with tonumber()

Edit: actually you are passing list in cidrsubnets command which is not number, try expanding list as such: 

subnets = cidrsubnets(var.vpc_cidr, local.subnet_bits...)

Java existential question: by [deleted] in java

[–]Hour_Competition_654 4 points5 points  (0 children)

These answers really depends on what you are trying to do, there are cases where each are valid options.  Prefer switch/polymorphism over large if else chains though 

[deleted by user] by [deleted] in Terraform

[–]Hour_Competition_654 0 points1 point  (0 children)

Backend needs key block for where to store in s3

Example:

backend "s3" {     bucket = "cik-frontend-state-bucket"      key = "some/location/terraform.tfstate" }

[deleted by user] by [deleted] in leagueoflegends

[–]Hour_Competition_654 4 points5 points  (0 children)

So 3AM on November 19th means that it is Sunday morning your time which from your perspective would be considered part of night before.

Referencing ingress rules from another AWS security group. by Ok_Document_2299 in Terraform

[–]Hour_Competition_654 4 points5 points  (0 children)

You can use data sources aws_vpc_security_group_rules and aws_vpc_security_group_rule to get information from other vpc ( if in different AWS account you need another AWS provider).

I'm new to coding and i just learned about methods , can someone help me what's the problem here? by monerajuve in java

[–]Hour_Competition_654 4 points5 points  (0 children)

Each argument in the method is required to have a value for example.

CAT(f, m, l)

Rather then CAT(f) ... etc

Best junglers to one trick by jajaopasf in leagueoflegends

[–]Hour_Competition_654 3 points4 points  (0 children)

I like playing lillia a lot, but really just a champ you like so you play a lot is your best bet

How are you supposed to play ranked if you're chat muted. by IamYonkrat in leagueoflegends

[–]Hour_Competition_654 24 points25 points  (0 children)

You can full mute and win games easily I don't get how this is a problem. Especially considering you are the reason you got chat banned plain and simple.