how to save the history of calculations done through the calc package in Keypirinha launcher

I frequently use the Calc package of Keypirinha launcher to do small calculations quickly, the problem is Keypirinha does not seem to store any history of those calculations, so I cannot look back at calculations I had done earlier. Is there any setting I can change in Keypirinha config file so that it saves the history of the calculations I have done.

Clean Architecture – Where to put business calculations when entities are autogenerated db first efcore?

I’m trying to switch to clean architecture from a traditional layered architecture approach and trying to figure out where to put business logic. Please consider the below scenario –

Employee class (exists in Efcore db first scaffolded in core)-

class Employee {     public int Id {get; set;}     public int TimeWorked {get; set;}     public int ZoneCode {get; set;}     public datetime JoiningDate {get; set;}     public decimal Reimbursement {get; set;} } class SomeMasterData { //Could be a value object     public int ZoneCode {get; set;}     public decimal OvertimeAllowedForZoneCode {get; set;} } class SomeOtherMasterData {  //Could be a value object     public int OvertimeMultiplier {get; set;} //and whatever other props } 

Business logic related to the employee –

int CalculateReimbursement(Employee emp, SomeMasterData masterData, , SomeOtherMasterData masterData2) {     // Use data from Employee (fields like zone code, joining date etc) and     // data from SomeMasterData to calculate the reimbursement amount for the employee     // The below business logic is random, created for this question     if(emp.ZoneCode == masterData.ZoneCode && emp.JoiningDate > 'some date') {         return masterData.OvertimeAllowedForZoneCode * masterData2.OvertimeMultiplier * emp.TimeWorked;     }     else //More business logic based on many entities and value objects     ... } 

My question is – Considering Clean Architecture, where to put the CalculateReimbursement method? Below are a few options –

  1. In domain services in the core – But is this what domain services are for?
  2. In the Employee class – But that class is autogenerated by Efcore db first scaffolding so I can’t change it. Should I create another Employee partial class with this method?
  3. In some sort of “helper” class within the core – if so, what do I call it?
  4. Somewhere else that makes more sense keeping Clean Architecture in mind?

Total Wages Calculations

https://docs.google.com/spreadsheets/d/13HdNN_qa9rhLFyMe0N9I9EusmBudi_dcdBkc6UeLHMM/edit#gid=878850570

I am trying to total Normal Pay but the formula does not Multiply Regular Hours by Normal Rate hence I get an R6.33 sum instead of R158.84

  1. I would appreciate assistance with a formula to calculate Currency/Price from Duration or Time.

  2. Also how to auto sum other cells? example – this formula ‘=SUM(H2:H*1.5)” to be applied everytime a new input is made on the column?

How does rounding affect subsequent calculations?

When we are doing calculations in mathematics, we often express exact values, like $ \sqrt 2$ or $ \arctan (1)$ , as decimals and round these to a finite number of decimal places/significant figures before using these approximations in subsequent calculations. We might also round off a very long but finite decimal and use it in subsequent calculations. My question is, what is the minimum number of decimal places/significant figures which all of my intermediate values must be rounded to if I want my final answer to be accurate to a particular number of decimal places/significant figures?

Example: I’m doing a $ \chi^2$ test. I want to find $ \chi^2$ exact to $ 1$ decimal place. The exact $ \chi^2$ contributions are: $ (0.56,0.32,1.76,1.99,0.72,0.88)$ . If I sum these, the exact value of $ \chi^2$ is $ 6.23$ , which becomes $ 6.2$ rounded to $ 1$ decimal place. Now if I round the contributions to $ 1$ decimal place, so they become $ (0.6,0.3,1.8,2.0,0.7,0.9)$ , before I sum them, I get the sum to be $ 6.3$ , which is not accurate to $ 1$ decimal place, as we have shown it should be $ 6.2$ .

How can I be sure that my intermediate values are rounded with enough remaining decimal places/significant figures that my final answer is accurate to a desired number of decimal places/significant figures? Not just for this particular example, but for a general calculation.

Manage multiple graphical processors – use one for the graphical interface and one to run calculations

I’m not a hardware expert, but I hope I got the words right.

I have a computer with two graphical processors, an NVIDIA GeForce GTX 1080 and an Intel 3e92. At the moment, I am using the GeForce both as for graphical interface tasks and to run simulations.

Is it possible to use both graphical processors, so that I run the GUI instances on the Intel card, and simulations on the GeForce? I am running Ubuntu 18.04 LTS.

Calculations of residue homomorphisms in cycle modules

In the proof of Proposition 2.2 and Theorem 2.3 in Chow groups with coefficients https://eudml.org/doc/233731 written by M. Rost, he wrote

$ \mathbb{A}^{1}={\rm Spec}F[u], \mathbb{A}^{2}={\rm Spec}F[s,t]$ and $ Z=\mathbb{A}^{2}_{<s,t>}$ , the localization of $ \mathbb{A}^{2}$ at $ 0$ . Let $ y,z$ be points of $ Z$ the points with parametetrs $ s,t$ respectively. Then

\begin{align} &\partial_{x}(\eta)=0 \text{ for }x \in Z^{(1)}\backslash\{y,z\},\ &\partial_{y}(\eta)=-\{t\}r_{\kappa(y)\vert F}(\partial_{∞}(\rho)),\ &\partial_{z}(\eta)=r_{\kappa(z)\vert F}\circ \partial_{0}(\{u\}・\rho)-\{s\}・r_{\kappa(z)\vert F}(\partial_{0}(\rho))\ \end{align}

Q; Please calculation this formulae.

Reading from JSON files, basic calculations and writing over another JSON file


Review

Class SectorController calculates coefficients for sectors of equity exchange markets using minute data from an API. Would you be so kind and review this class, which is also connected to some other classes, some of them I will post after this review?

I have simplified and added some dummy numbers (such as 0.05, 5) to be easier for your review. If there is anything that can make this script faster, it would be great.

Script

class SectorController {    /**   *   * @var a string of iextrading base URL   */    const BASE_URL = "https://api.iextrading.com/1.0/";     /**   *   * @var a string of target path and query   */    const TARGET_QUERY = "stock/market/batch?symbols=";     /**   *   * @var a string for backend path for every sector   */    const EACH_SECTOR_DIR_PREFIX = "/../../dir/dir/dir/dir-";     /**   *   * @var a string for backend path for index sector   */    const INDEX_SECTOR_DIR_PREFIX = "/../../dir/dir/dir/dir/";     /**   *   * @var a string for live data path   */    const LIVE_DATA_DIR = "/../../../public_html/dir/dir/";    function __construct()   {     echo "YAAAY! " . __METHOD__ . " success 💚\n";      return true;   }    public static function getSectors(){     $  baseUrl=self::BASE_URL.self::TARGET_QUERY;     $  currentTime = date("Y-m-d-H-i-s");      $  permission = 0755;      $  indexData = array( "Overall" => array("sector_weight" => 1, "sector_coefficient" => 5,     $  sectorInfos=SectorController::iexSectorParams();     foreach ($  sectorInfos as $  a => $  sectorInfo) {       $  sectorUrl = $  baseUrl . implode(",", array_keys($  sectorInfo["selected_tickers"])) . "&types=quote&range=1m";       $  rawSectorJson = file_get_contents($  sectorUrl);       $  rawSectorArray = json_decode($  rawSectorJson, true);        // Write the raw file       $  rawSectorDir =  __DIR__ . self::EACH_SECTOR_DIR_PREFIX . $  sectorInfo["directory"];        if (!is_dir($  rawSectorDir)) {         mkdir($  rawSectorDir, $  permission, true);       }        $  rawSectorFile = $  rawSectorDir . "/" . $  currentTime . ".json";       $  fp = fopen($  rawSectorFile, "a+");       fwrite($  fp, $  rawSectorJson);       fclose($  fp);        // Calculate the real-time index       $  indexValue = 0;       foreach ($  rawSectorArray as $  ticker => $  tickerStats) {         if (isset($  sectorInfo["selected_tickers"][$  ticker], $  tickerStats["quote"], $  tickerStats["quote"]["extendedChangePercent"], $  tickerStats["quote"]["changePercent"], $  tickerStats["quote"]["ytdChange"])) {            $  changeAmount = ($  tickerStats["quote"]["extendedChangePercent"] + $  tickerStats["quote"]["changePercent"] + $  tickerStats["quote"]["ytdChange"])/200;           $  indexValue += $  sectorInfo["sector_weight"] * $  sectorInfo["selected_tickers"][$  ticker] * $  changeAmount;         }       }        $  indexData[$  sectorInfo["sector"]] = array("sector_weight" => $  sectorInfo["sector_weight"], "sector_coefficient" => 5,       $  indexData["Overall"]["sector_value"] += $  indexData[$  sectorInfo["sector"]]["sector_value"];     }      // Calculate the index factor for better visibility between -1 and +1     $  frontIndexData = array();     foreach ($  indexData as $  sectorName => $  sectorIndexData) {       $  indexSign = $  sectorIndexData["sector_value"];       if ($  indexSign < 0) {         $  indexSign = - $  indexSign;       }        $  indexFactor = 1;       for ($  i=0; $  i <= 10; $  i++) {          $  indexFactor = pow(10, $  i);         if (($  indexFactor * $  indexSign) > 1) {           $  indexFactor = pow(10, $  i - 1);           break;         }       }        $  frontIndexData[$  sectorName] = $  sectorIndexData["sector_weight"] * $  sectorIndexData["sector_coefficient"] * $  sectorIndexData["sector_value"] * $  indexFactor;     }      // Write the index file     $  indexSectorDir =  __DIR__ . self::INDEX_SECTOR_DIR_PREFIX;      if (!is_dir($  indexSectorDir)) {mkdir($  indexSectorDir, $  permission, true);}      $  indexSectorFile = $  indexSectorDir . $  currentTime . ".json";      $  indexSectorJson = json_encode($  frontIndexData, JSON_FORCE_OBJECT);     $  fp = fopen($  indexSectorFile, "a+");     fwrite($  fp, $  indexSectorJson);     fclose($  fp);      $  sectorDir =  __DIR__ . self::LIVE_DATA_DIR;       if (!is_dir($  sectorDir)) {mkdir($  sectorDir, $  permission, true);} // if data directory did not exist      // if text file did not exist     if (!file_exists($  sectorDir . "text.txt")){       $  handle=fopen($  sectorDir . "text.txt", "wb");       fwrite($  handle, "d");       fclose($  handle);     }      $  sectorCoefFile = $  sectorDir . "text.txt";     copy($  indexSectorFile, $  sectorCoefFile);     echo "YAAAY! " . __METHOD__ . " updated sector coefficients successfully 💚!\n";      return $  frontIndexData;   }     public static function iexSectorParams(){     $  sectorInfos = array(       array(         "sector" => "IT",         "directory" => "information-technology",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(            "AAPL" => 0.05,           "AMZN" => 0.05,           "GOOGL" => 0.05,           "IBM" => 0.05           "MSFT" => 0.05           "FB" => 0.05           "NFLX" => 0.05,           "ADBE" => 0.05,           "CRM" => 0.05,           "NVDA" => 0.05,         )       ),       array(          "sector" => "Telecommunication",         "directory" => "telecommunication-services",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(           "VZ" => 0.05,           "CSCO" => 0.05,           "CMCSA" => 0.05,           "T" => 0.05,           "CTL" => 0.05           "CHTR" => 0.05           "S" => 0.05,           "DISH" => 0.05,           "USM" => 0.05,           "VOD" => 0.05,         )       ),       array(          "sector" => "Finance",         "directory" => "financial-services",         "sector_weight" => 0.05         "sector_coefficient" => 5,         "selected_tickers" => array(            "JPM" => 0.05,           "GS" => 0.05,           "V" => 0.05,           "BAC" => 0.05,           "AXP" => 0.05           "WFC" => 0.05           "USB" => 0.05,           "PNC" => 0.05,           "AMG" => 0.05,           "AIG" => 0.05,         )       ),       array(         "sector" => "Energy",         "directory" => "energy",         "sector_weight" => 0.05         "sector_coefficient" => 5,         "selected_tickers" => array(           "CVX" => 0.05,           "XOM" => 0.05,           "APA" => 0.05,           "COP" => 0.05,           "BHGE" => 0.05           "VLO" => 0.05           "APC" => 0.05,           "ANDV" => 0.05,           "OXY" => 0.05,           "HAL" => 0.05,         )       ),       array(         "sector" => "Industrials",         "directory" => "industrials",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(           "CAT" => 0.05,           "FLR" => 0.05,           "GE" => 0.05,           "JEC" => 0.05,           "JCI" => 0.05           "MAS" => 0.05           "FLS" => 0.05,           "AAL" => 0.05,           "AME" => 0.05,           "CHRW" => 0.05,         )       ),       array(         "sector" => "Materials and Chemicals",         "directory" => "materials-and-chemicals",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(           "DWDP" => 0.05,           "APD" => 0.05,           "EMN" => 0.05,           "ECL" => 0.05,           "FMC" => 0.05           "LYB" => 0.05           "MOS" => 0.05,           "NEM" => 0.05,           "PPG" => 0.05,           "MLM" => 0.05,         )       ),       array(         "sector" => "Utilities",         "directory" => "utilities",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(           "PPL" => 0.05,           "PCG" => 0.05,           "SO" => 0.05,           "WEC" => 0.05,           "PEG" => 0.05           "XEL" => 0.05           "D" => 0.05,           "NGG" => 0.05,           "NEE" => 0.05,           "PNW" => 0.05,         )       ),       array(          "sector" => "Consumer Discretionary",         "directory" => "consumer-discretionary",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(           "DIS" => 0.05,           "HD" => 0.05,           "BBY" => 0.05,           "CBS" => 0.05,           "CMG" => 0.05           "MCD" => 0.05           "GPS" => 0.05,           "HOG" => 0.05,           "AZO" => 0.05,           "EXPE" => 0.05,         )       ),       array(         "sector" => "Consumer Staples",         "directory" => "consumer-staples",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(            "PEP" => 0.05,           "PM" => 0.05,           "PG" => 0.05,           "MNST" => 0.05,           "TSN" => 0.05           "CPB" => 0.05           "HRL" => 0.05,           "SJM" => 0.05,           "CAG" => 0.05,           "KHC" => 0.05,         )       ),       array(          "sector" => "Defense",         "directory" => "defense-and-aerospace",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(            "BA" => 0.05,           "LMT" => 0.05,           "UTX" => 0.05,           "NOC" => 0.05,           "HON" => 0.05           "RTN" => 0.05           "TXT" => 0.05,           "LLL" => 0.05,           "COL" => 0.05,           "GD" => 0.05,         )       ),       array(          "sector" => "Health",         "directory" => "health-care-and-pharmaceuticals",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(            "UNH" => 0.05,           "JNJ" => 0.05,           "PFE" => 0.05,           "UHS" => 0.05,           "AET" => 0.05           "RMD" => 0.05           "TMO" => 0.05,           "MRK" => 0.05,           "ABT" => 0.05,           "LLY" => 0.05,         )       ),         array(         "sector" => "Real Estate",         "directory" => "real-estate",         "sector_weight" => 0.05,         "sector_coefficient" => 5,         "selected_tickers" => array(           "CCI" => 0.05,           "AMT" => 0.05,           "AVB" => 0.05,           "HCP" => 0.05,           "RCL" => 0.05           "HST" => 0.05           "NCLH" => 0.05,           "HLT" => 0.05,           "ARE" => 0.05,           "AIV" => 0.05,         )       )     );     return $  sectorInfos;   }     function __destruct()   {     echo "YAAAY! " . __METHOD__ . " success! 💚 \n";     return true;   }  } 

Output (text.txt)

{“Overall”:0.05,”IT”:0.05,”Telecommunication”:0.05,”Finance”:0.05,”Energy”:0.05,”Industrials”:0.05,”Materials and Chemicals”:0.05,”Utilities”:0.05,”Consumer Discretionary”:0.05,”Consumer Staples”:0.05,”Defense”:0.05,”Health”:0.05,”Real Estate”:0.05}

Which Armor Class values should be used as controls when making damage calculations?

It is known that occasionally questions will pop up that are about attempts to optimize a character’s damage output (sometimes shorthanded as DPR, or Damage-per-Round), and veterans of this game know that which Armor Class values used to perform these optimizations can have pretty significant impacts on how you optimize for damage.

In the past, I’ve been using what I thought was a pretty good “Standard Array” for Armor Class values to test against: AC0, AC14, AC16, AC18, AC20, AC26, for the purpose of covering the following cases:

  • AC0: Absolute “Ideal Scenario” gameplay, where bonuses are stacked high enough or creatures are vulnerable enough that their Armor Class is irrelevant
  • AC14-20: Commonplace “Regular Play” scenarios, representing average-case damage output
  • AC26: In officially published books, AC26 is greater than any Armor Class that any creature has; even the mightly Terrasque has an Armor Class of 25 in 5th Edition D&D

I’d also backed this with the context of the Dungeon Master’s Guide, which in its table (page 274) describing guideline Armor Class values for custom creatures, it never goes below 13. So I’ve been operating under the premise that it’s not realistic to perform DPR calculations against creatures that have an Armor Class of 13 or lower.

However, doing more research into how Statblocks are allocated in the Monster Manual and other supplemental books, I’m beginning to question this assumption. For example, despite AC13 being listed as a nominal minimum for even creatures as low as CR1/4 in the Dungeon Master’s Guide, there are lots of creatures whose AC is well below 13, even for significant Challenge Ratings. In fact, nearly a third (369/1205) of the creatures found in officially published 5th edition materials have Armor Classes below 13, and even if you exclude the CR<1 creatures from that list, more than 10% of all creatures still have Armor Class values of 13 or lower. This list also includes relatively high CR creatures like the Corpse Flower, Giant Ape, Tyrannosaurus Rex, and other high CR creatures that have an Armor Class of 13 or lower.

My sense from seeing these statblocks is that while the 14-20 range might be accurate for some adventures and DMs, it may not be accurate for others, depending on what kinds of creatures are pulled from the manual to use in encounters.

Of course, I could just span the entire range from [5,25] to capture every single Armor Class that shows up in published 5th edition materials, but tables constructed with 21 columns of Armor Class values are unwieldy and difficult to read. So in an ideal world, I don’t think I want to represent more than 6 or 7 distinct Armor Class values.

So I’d like to solicit some feedback: what would constitute a good array of Armor Class values to use in the future to try to represent the important use cases, if the use cases are:

  • Creatures whose Armor Class is trivially low
  • Creatures whose Armor Class is common and typical for a 5th Edition campaign
  • Creatures whose Armor Class is uncommonly high for a 5th Edition campaign
  • Creatures that constitute “Boss Monsters” with uniquely high Armor Classes

My calculations are taking too long, is there a free faster online version?

I’m trying to run CPU intensive numerical calculations (integrals, power series, etc.) and sometimes not only the results don’t seem accurate, sometimes Mathematica takes forever to run and I give up on waiting.

Is there a faster online version that I could use to just copy/paste my formulas and run them on a faster server?