object oriented – How could I construct a C# function that takes in a credit limit and advance amount and outputs an Amount and APR?


The Amount and APR will be set as a percentage of the credit limit. The split will be 50%, 25%, and 25% of the credit limit compared to the advance amount. APR starts at 249 and increased 25% each time.

For example :

My credit limit is $1000 and my advance amount is $800. My output should be the following:

{ Amount: 500, APR: 249.00 }, 
{ Amount: 250, APR: 311.25 },
{ Amount: 50, APR: 373.50 }`


My credit limit is $1000 and my advance amount is $700. My output should be the following:

{ Amount: 500, APR: 249.00 },
{ Amount: 200, APR: 311.25 }

My code works but I know that it is not best practice and would like to be more efficient. I know there is a more mathematical way to get this done it is just not coming to me. Such as the Environment.Exit(-1) should not be used but I needed it otherwise some outputs were incorrect.

My Code:

public static int CreditLimit { get; set; }
        public static int AdvanceAmount { get; set; }
        public static int Amount { get; set; }
        public static int APR { get; set; }

    public Bam(int creditLimit, int advanceAmount, int amount, int apr)
        CreditLimit = creditLimit;
        AdvanceAmount = advanceAmount;
        Amount = amount;
        APR = apr;


     public decimal EquationForOutput()
        Amount = ((int)(CreditLimit * .5));
        if (AdvanceAmount <= CreditLimit * .5)
            Amount = AdvanceAmount;
            return Amount;
        return Amount;

class Program
        static void Main(string() args)
            int amount = 0;
            int apr = 249;

        Console.WriteLine("Enter Credit Limit");
        int creditLimit = (int)Convert.ToInt64(Console.ReadLine());

        Console.WriteLine("Enter Advance Amount");
        int advanceAmount = (int)Convert.ToInt64(Console.ReadLine());

        Bam nums = new Bam(creditLimit, advanceAmount, amount, apr);
        amount = (int)nums.EquationForOutput();

        Console.WriteLine($"Amount: {amount}");
        Console.WriteLine($"APR: {apr}");


        var newApr = (apr * .25) + apr;
        if (advanceAmount <= creditLimit * .5)
        else if (advanceAmount -amount < creditLimit * .25)

            Console.WriteLine($"Amount: {advanceAmount-amount}");
            Console.WriteLine($"APR: {newApr}");

            Console.WriteLine($"Amount: {amount * .5}");
            Console.WriteLine($"APR: {newApr}");

        int newAmount = (int)(advanceAmount - (creditLimit * .25) + amount) - creditLimit;
        bool endTrue = Convert.ToBoolean(newAmount);

        if (endTrue)
            newApr = (apr * .5) + apr;
            Console.WriteLine($"Amount: {(advanceAmount - amount) - amount * .5}");
            Console.WriteLine($"APR: {newApr}");

investing – Need Help Buying huge amount of Bitcoins

I want to invest in Bitcoin, have program to buy 200-350 Bitcoins per week,
Could you please guide me how to buy it from a valid and reliable person?
Could you introduce me someone has more than 80 Bitcoins in her wallet to buy? I can pay your brokering commission.
Please email me if you could help
, Thanks

dnd 5e – How to protect myself against Divination with the least amount of resources

Cast Mordenkainen’s Private Sanctum every day in the same place for a year. Among the effects you can choose when you cast the spell are:

  • Sensors created by divination spells can’t appear inside the protected area or pass through the barrier at its perimeter.
  • Creatures in the area can’t be targeted by divination spells.

The most important feature of the spell, for this question’s purposes, is this line:

Casting this spell on the same spot every day for a year makes this effect permanent.

Now, obviously using a fourth level (or higher, if you want a larger area) spell slot every day for a year is not an insignificant effort, but there are no material components consumed by casting the spell, so it only takes time to set it up, and nothing to sustain after the year is done. It might be a worthwhile project if your character has a long period of downtime between his high-level adventures. You may not have many uses for your spell slots on boring non-adventure days!

The biggest downside of course is that it’s limited to a single location that you pick in advance. If you need to be protected from divination everywhere you go, this doesn’t help you. But if you’re a high-level wizard, you probably have the means to teleport yourself across the world reasonably easily, so you might be able to tolerate doing your most secret stuff only in your own wizard tower (or wherever it is you chose to cast the spell so many times). And you can still cast the spell as a one-off if you need to protect some other place for just a single day, when teleportation isn’t an option.

dnd 5e – looking for a way to protect myself against divination with the least amount of ressources

I am a fairly high-level wizard. I could learn mind blank or nondetection, or use an amulet of protection against detection and location, But 8th level slots are too valuable, burning 25gp every day is annoying, and I don’t want to use an attunement slot on this. Is there anything that I can do? I was thinking of using the simulacrum of a monster or summoning and binding an outsider with the right ability, but the simulacrum ability would have to be at-will or not be a spell because simulacrums don’t get spells back, and the summoned outsider must be cr 9 or less. Is there anything in the monster manual that would fit? Or any other solution I could use?

entities – Increase maximum amount of characters for entity reference field (tag style)

I have a Drupal 9 installation running Commerce 2. My products use a taxonomy entity reference field (tag style). There’s one products category, where I need to have more references in the tag input field than currently allowed (1024 characters).

I looked it up and found a similar post where someone suggested to write a module to increase the maximum input value like so:

function MODULE_field_widget_form_alter(&$element, &$form_state, $context) {

  if ($context('widget')->getPluginId() == 'entity_reference_autocomplete') {
    if ($element('target_id')('#maxlength') == 1024) {
      $element('target_id')('#maxlength') = 3072;

So I did that, but it still doesn’t let me input more than 1024 characters. Any help would be appreciated. Thank you!

architecture – Is a language which terminates in a given amount of real-time still Turing complete for all finite problems?

Background: this is a continuation of this question here, further expanding the thought experiment.

In short, you have a magic calculation machine which has the following properties.
The machine is:

  • Fast. The rigid definition is that the processor frequency can be arbitrarily high (though not infinite).
  • Finite. (NEW) Any program that runs on this processor has a fixed, finite input and output size. If the program tries to output more information than it’s pre-determined output size, the machine immediately exits. It is not possible to alter these values.
  • Frugal. This means that the output of the machine is strictly the data that is outputted. This means that the state of the machine is not an output, and a program that loops infinitely without printing anything has the same output as a program that exits immediately. Expanding on the finite quality of our machine, this means that both of the previous examples are equivalent to any program which has a pre-determined output size of 0.
  • Fleeting. The processor has a pre-determined time of execution. This time can be arbitrarily high, but not infinite.

The question:

Given that the processor IS Turing complete with only the (fast) quality, is the processor with the other limitations also Turing complete?

I should note that a language is considered Turing complete if:

It can solve every problem that another Turing complete language can, OR
It can solve every problem that a Turing machine can solve.

The following should not necessarily exclude a program form Turing completeness:

The program cannot solve every problem that a Turing machine can solve in the same way.

Further more:

Does the halting problem occur for any program in this processor?

c++ – How do I use an infinite amount of structs for a function’s parameter?

I’m writing a very simple OBJ exporter in C++ (for VC6, as I am writing for an old project that only compiles there.)

Right now, I’m stuck on figuring out how to use an infinite amount of structs to make a vertices position line. That may sound a bit silly, but this is my first functioning program written in C++, so I don’t know the concepts very well.

I’m assuming I’m doing it wrong, as there’s nothing I can find on the Internet for what I’m trying to do.

Here’s my header’s struct code:

struct PointList {
        float X;
        float Y;
        float Z;

..and the actual OBJ export function’s code:

void OBJEXP::WriteOBJ(OBJEXP::PointList Points, std::string File) // Writes an OBJ.
    ofstream    output(File + ".obj");

    for (int i = 0; i < sizeof(Points); i += 1)
        output << "v " + to_string(Points.X) + " " + to_string(Points.Y) + " " + to_string(Points.Z) + "n";
    cout << "All donen";

My main file (meant to test the code out, this is going to be run every time I save a file otherwise:)


int main()
    POINTZ.X = 1.0f;
    POINTZ.Y = 5.5f;
    POINTZ.Z = 2.0f;
    OBJEXP::WriteOBJ(POINTZ, "testobject");
    std::cout << "Execution donen";

My OBJ file looks like this:

v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000
v 1.000000 5.500000 2.000000

which obviously isn’t very correct.

magento2 – Magento 2 – Change amount of products per row in category view

Currently there are showing 4 products per row in the category view.

How can I make it show 3 products per row instead?

I found this answer. It says there is a file Magento_Catalogwebcsssourcemodule_listing.less but I searched in vendormagentomodule-catalogviewfrontendweb folder and there is not even a css folder inside of it.

post processing – Is it possible in Lightroom to change a develop property of multiple photos by a certain amount?

After a long session of “developing” RAW photos I think I over processed most of the photos. I tried lowering the clarity value of some photos and saw that this tamed the over processed look a bit.

I’m looking for a way to select a set of photos and lower the clarity for all of them by a set amount, regardless of their current value.
I’ve tried Auto-sync, but that sets the clarity of the selected photos to one value.

As an example:
Photo A, B and C have a clarity value of 15, 32 and 12 respectively.
I want to select the three photos and decrease the clarity of all the photos by 10 such that photos A, B and C have a clarity value of 5, 22, and 2.

Is this possible using Lightroom 5?

database design – Best Practice for Handling Table with Large Amount of Transaction Data

I have a transaction table storing large amount of transaction data. Only the most recent data of one month are required to be available for transactional use in real-time. Less recent data may only be used for report generation or offline analysis.

What is the best practice for handling such transaction data?

Should I create a history table with same columns and move data with age over one month from the transaction table to the history table with a batch job?
Should I create a history table per year? Or just use a single history table to host all past data?

Or Should I use database partitioning instead of history tables?

Or should I create a data warehouse and move data into it?