Two processes doing extensive calculations – I want one to get ~100% of processor time – how?

I am running Ubuntu basic server with two processes: – process 1 – performing calculation 100% of uptime, and which I use to share computing power to community (it’s running @ prio 19) – process 2 – performing calculations for 5-10mins, from time to time, which I use to compute for me (it’s running @prio -19)

I want process 2 to be given with 100% of computing power (process 1 is at that moment should get close to 0% of CPU). But best what I get is 50% of CPU for process 1 and 50% of CPU for process 2 (checked with htop).

I don’t want to manually stop/start any process when I need computing power (both processes must be running all the time); 100% of CPU for process 2 must be given automatically.

What should I do to achieve my goal? Thanks.

Posted on Categories Best Proxies

Solar Power Calculations

Good Afternoon, I have calculated the Incident beam radiation for a given locations local sunlight hours.

Rise = Sunrise[GeoPosition[{57.7053, -3.33917}],     DateRange[DateObject[{2019, 1, 1}], DateObject[{2019, 12, 31}]]]; Sunrises = DateString[#, {"Hour", "Minute"}] & /@ Rise["Values"] Sets = Sunset[GeoPosition[{57.7053, -3.33917}],     DateRange[DateObject[{2019, 1, 1}], DateObject[{2019, 12, 31}]]]; Sunsets = DateString[#, {"Hour", "Minute"}] & /@ Sets["Values"];   Sunrises[] Sunsets[]  n = Table[0 + i, {i, 1, 1}];(*Days of the Year*)  LSH = Table[i + 0.01, {i, 8.93, 15.616667, 0.01}]; (*Local Solar Hour*) H = 360/24*(LSH - 12);(*Hour Angle*) L = 57.7053;(*Latitude*)  \[Delta] =   23.45*Sin[360/365*(n - 81) Degree](*Solar Declination of the sun*);  \[Beta] = (Cos[L Degree]*Cos[First[\[Delta]] Degree ]*  Cos[H Degree ]) + ((Sin[L Degree]*Sin[First[\[Delta]] Degree]));  Arc\[Beta] = ArcSin[\[Beta] ]*180/Pi; A = 1160 + 75 Sin[360/365*(n - 275) Degree](*Extraterrestial Flux*);  m = 1/(Sin[  Arc\[Beta] Degree])(*Air Mass Ratio for every hour of the day*); k = 0.174 + 0.035*Sin[360/365*(n - 100) Degree];(*Optical Depth*)  IB = First[A]*E^(-First[k]*m); (*Direct Beam radiation Wm^-2*) test = Transpose[{LSH, IB}];  ListLinePlot[test, PlotRange -> {{8.5, 16}, {0, 600}}]

From the ListLinePlot, it should show solar radiation for the daylight hours of the location. Where sunrise is 0856 and sunset is 1537 (Considering time of year) However the graph shows a sudden increase before the given sunset time where the graph should have a bell shape resemblence between 0856 and 1537(8.933333 and 15.616667 in numerical format) I’ve been going over this code for days trying to solve this so any help would be appreciated.

Luke

How Babbage’s Analytic engine made calculations of unlimited extent?

Brian Randell, in his article The COLOSSUS, explains how computing ushered in the 20th Century, by the development of the Colossus computer. He cites a passage from the Passages from the Life of a Philosopher, illustrating how Charles Babbage described the Analytical Engine :

That the whole of the conditions which enable a finite machine to make calculations of unlimited extent are fulfilled in the Analytical Engine.

I couldn’t get how calculations of unlimited extent can be performed by the Analytical engine as described by Babbage. An example would be helpful too.

Posted on Categories proxies

What’s the best kind of test for complex calculations without access to external resources?

I have two libraries that handle the mapping from one family of objects to another one. I had to create a middle set of objects for other transformations.

So, the NativeConverters libray converts elements NativeElement to MiddleElement, and the ViewModelConverters library converts MiddleElement to ViewModelElements.

I have unit tests (with NUnit) for both NativeConverters and ViewModelConverters. So the single conversion works well.

Now, I want to test the whole process: given a converter from NativeConverters and another one from ViewModelConverters, I want to test that a NativeElement gets converted correctly into a ViewModelElement.

I don’t need access to DB, file system or whaterver, so I’m not sure that Integration tests are the best choice. But I’m not testing a single method, so it shouldn’t be a unit test.

What kind of test do you think could best fit this case?
Do you know any library for C#?

Understanding CR calculations

I’ve been working on a tool to help me design monsters, specifically doing CR calculations as described in the DMG. In order to test it, I’ve tried it out on some monsters in the Monster Manual, which of course are giving me different results.

I just want to say up front that I’m fully aware that the DMG method doesn’t align with what’s actually in the MM, and that a different calculation was used for it. And for my purposes that’s ok, but it does make testing it rather difficult. I also understand that playtesting can influence the CR.

So what I want to check is: For these 3 test monsters, is my calculation correct, or have I overlooked something? And if it is correct, is there any widely accepted or documented reason for these monsters specifically to have different CRs?

Wolf (MM CR: 1/4, calculated CR: 1/2)

HP: 11
AC: 13
Damage per round: 7
Attack bonus: 4 + 1 (for Pack Tactics) = 5

Defensive CR: 1/8
Offensive CR: 1
Average CR: 0.625 rounded = 1/2

Wight (MM CR: 3, calculated CR: 2)

HP: 45 x 2 (for damage resistances) = 90
AC: 14
Damage per round: 2 x 6 (longsword) = 12
Attack bonus: 4

Defensive CR: 2
Offensive CR: 1
Average CR: 1.5 rounded = 2

Planetar (MM CR: 16, calculated CR: 15)

HP: 200 x 1.25 (for damage resistances) = 250
AC: 19 + 2 (magic resistance) + 2 (3 saving throws) = 23
Damage per round: 2 x 43 (angelic greatsword) = 86
Attack bonus: 12

Defensive CR: 12 + 3 (adjust for AC) = 15
Offensive CR: 13 + 2 (adjust for attack) = 15
Average CR: 15

Posted on Categories Best Proxies

Are calculations or checks made in the for loop lifecycle/breakpoint penalising?

Consider the following segment of code:

for (let i = 0; i < (maxResults || currentResults.length); i += 1) {       const item = currentResults[i];       if (results.has(item)) {          // do something       }     }

Does the i < (maxResults || currentResults.length) piece of code get optimised away at any point before runtime? (perhaps by transpilation?)

Would the severity of the calculation made in the for loop’s breakpoint hinder performance at all or is it calculated once for the entirity of the loop?

e.g. We could write it:

const max = maxResults || currentResults.length;     for (let i = 0; i < max; i += 1) {       const item = currentResults[i];       if (results.has(item)) {          // do something       }     }

If calculation was taken once per loop.

Posted on Categories buy elite proxies

Is it good practice to create a static class for database tables calculations?

I need to implement some system (using python pandas dataframe in my case) that parses raw data, then adds on calculated data, and then validates that calculated data (boolean output on some columns)

I couldn’t make this problem simpler than what is below, so please bear with me.

Assumption: this is and always will be single threaded

The flow I think of implementing:

1. Read raw data into a db
2. Query the db, to obtain result (some other table)
3. Parse the result (map or reduce operation, or multiple operations)
4. Put parsed result back into original table, or into a new table.
5. Validate result

I was thinking how to design this, and came up with the following:

1. create a class that would hold all types of tables. It would allow for read and update operations only, on needed columns.
2. create a static class for calculations on tables. Each query would take as arguments the tables it requires to make its calculations and return a new table.
3. Create validator interface which has a method that takes in a table and outputs whether it is valid or not.

Now, I would do something like

db = DB() df_raw = raw_parser.parse_raw() db.add_raw(df_raw) calculation1 = Calculations.calculation1(df_raw) calculation2 = Calculations.calculation2(df_raw, calculation1) calculation3 = Calculations.calculation3(calculation1 , calculation2) db.add_calculation3(calculation3) validator3 = Calculation3Validator(db.get_calculation3()) validator3.validate()

Is this a problem?

This doesn’t seem very object oriented to me, because all the calculations sit together, statically, in Calculations.

Maybe it would have been smarter to somehow create a class for each calculated column, and assign it responsibility for calculating its own properties? Seems like too much of an abstraction, but I am not sure.

Question

Is it ok to have a static class holding queries that accept and output tables, and that holds no state? Does it hold a risk of becoming a god class that can’t be separated?

Is there a standard way of achieving my use case which I am very far from?

Sorry for the length of this question, I wanted to be very clear in my intent.

Posted on Categories buy anonymous proxy

Android 9, internal storage running full – ‘weird’ calculations

My phone (Nokia 3.1) is running low on storage, which is a little weird, because then i go to settings ->storage space-> Internal shared storage i see the it as in the images below.

As far as i learned back in school 8,0 + 2,9 + 0,14 + 0,1 + 0,09 + 0,86 is 12,09 and not 15.40 😀 …

But it gets better: when i now click Photos & Videos it says my Photos (Google Photo Image) takes up 230 MB and Images 632 MB. But when i click on Images i don’t even get images for 100 MB shown.

Does anybody have an idea what’s going on here, or how to free that ghost-occupied storage? I tried SD Maid, but no success…  Posted on Categories buying proxies

Calculations with percentage with jQuery

I’ve the following HTML code: https://jsfiddle.net/tnLad51z/

It’s a simple table with:

• 1 input for the price without tax
• 2 inputs for the taxes
• 1 input for the final price with tax

All the variables looks working well but do I use the ideal way to do these type of calculations ?

function updatePriceWithTaxe() {     var total_taxes = 0;     var total_without_taxes = Number($('input[name="RAT_Price"]').val());$  ('input[name="STX_Amount[]"]').each(function() {         total_taxes += Number($(this).val()); }); // Calculs total_taxes = total_without_taxes * total_taxes / 100; total_with_taxes = total_without_taxes + total_taxes; // Output console.log(total_with_taxes.toFixed(2));$  ('input[name="RAT_PriceTaxed"]').prop('readonly', false).val(total_with_taxes.toFixed(2)).prop('readonly', true); }

Should I need to add some error handling around non-numbers in the tax area?

Actually, a ‘NaN’ shows up in the ‘total’ if I don’t put some number?

How can I make this?

Thanks.

Posted on Categories buy elite proxies

Calculations for trucks

How can I improve my VBA code to run faster?

The issue I’m having is that the For/Next commands are taking ~10 hours to calculate and print all of the data. I cannot turn of calculations because I need the values calculated for every node (check_nodes).

I have 1 sheet (“Rating”) that performs calculations (25) for every check_node (944 nodes) of all check_trucks (38 trucks) so that’s $$25\times944\times38=896800$$ data points that are compiled then printed to different sheets for each of the 38 trucks. The results & format I’m getting are correct I just need to speed up the code somehow.

Originally I was going to run the VBA individually for all 38 trucks but then decided to modify the code to run all trucks automatically. Unfortunately this increased run time dramatically.

Sub Perform_Rating_Check()  Dim StartTime As Double Dim SecondsElapsed As Double  'Remember time when macro starts   StartTime = Timer  '------------------------ 'DETERMINE NUMBER OF ROWS OF DATA FOR LOAD RATING SUMMARY '------------------------      Application.ScreenUpdating = False     Application.DisplayStatusBar = False     Application.EnableEvents = False      Sheets("Output").Activate     Row = Range("Start.Nodes").Row     Column = Range("Start.Nodes").Column      startRow = Range("Start.Nodes").Row     nrows = Range("Num_Checks").Value      ReDim check_nodes(1 To nrows)     For q = 1 To nrows         check_nodes(q) = Cells(startRow - 1 + q, Column)     Next  '------------------------------ 'CALCULATE & PRINT LOAD RATINGS '------------------------------      ReDim PR_summary(1 To nrows, 1 To 26)      Sheets("Rating").Activate     Truck_row = Range("Start.Truck").Row     Truck_col = Range("Start.Truck").Column      ntrucks = Range("Num.Trucks").Value      ReDim check_trucks(1 To ntrucks)     For k = 1 To ntrucks         check_trucks(k) = Cells(Truck_row - 1 + k, Truck_col)     Next      For j = 1 To ntrucks         TruckSheet = check_trucks(j)         Range("Choose.Truck") = check_trucks(j)         Sheets(TruckSheet).Activate              For s = 1 To nrows                 Range("Check_Location") = check_nodes(s)                 PR_row = Range("A9").Row - 1                 PR_col = Range("A9").Column - 1                 Cells(PR_row + s, PR_col + 1) = check_nodes(s)                 Cells(PR_row + s, 2) = Range("RF_INV_Axial").Value                 Cells(PR_row + s, 3) = Range("RF_INV_Major").Value                 Cells(PR_row + s, 4) = Range("RF_INV_Minor").Value                 Cells(PR_row + s, 5) = Range("RF_OPR_Axial").Value                 Cells(PR_row + s, 6) = Range("RF_OPR_Major").Value                 Cells(PR_row + s, 7) = Range("RF_OPR_Minor").Value                 Cells(PR_row + s, 8) = Range("RF_INV_Axial_My").Value                 Cells(PR_row + s, 9) = Range("RF_INV_Major_My").Value                 Cells(PR_row + s, 10) = Range("RF_INV_Minor_My").Value                 Cells(PR_row + s, 11) = Range("RF_OPR_Axial_My").Value                 Cells(PR_row + s, 12) = Range("RF_OPR_Major_My").Value                 Cells(PR_row + s, 13) = Range("RF_OPR_Minor_My").Value                 Cells(PR_row + s, 14) = Range("RF_INV_Axial_Mz").Value                 Cells(PR_row + s, 15) = Range("RF_INV_Major_Mz").Value                 Cells(PR_row + s, 16) = Range("RF_INV_Minor_Mz").Value                 Cells(PR_row + s, 17) = Range("RF_OPR_Axial_Mz").Value                 Cells(PR_row + s, 18) = Range("RF_OPR_Major_Mz").Value                 Cells(PR_row + s, 19) = Range("RF_OPR_Minor_Mz").Value                 Cells(PR_row + s, 20) = Range("RF_INV_Shear_P").Value                 Cells(PR_row + s, 21) = Range("RF_INV_Shear_My").Value                 Cells(PR_row + s, 22) = Range("RF_INV_Shear_Mz").Value                 Cells(PR_row + s, 23) = Range("RF_OPR_Shear_P").Value                 Cells(PR_row + s, 24) = Range("RF_OPR_Shear_My").Value                 Cells(PR_row + s, 25) = Range("RF_OPR_Shear_Mz").Value             Next s     Next j  'Determine how many seconds code took to run   SecondsElapsed = Round(Timer - StartTime, 2)  'Notify user in seconds   MsgBox "This code ran successfully in " & SecondsElapsed & " seconds", vbInformation      Application.ScreenUpdating = True     Application.DisplayStatusBar = True     Application.EnableEvents = True  End Sub

I like how the data is printed currently but I just want it to run much faster. Last time I ran the code it took about 10 hours to complete.