body mass index (BMI) calculator with cool images

I’m selling my website
body mass index or BMI http://glutenfreespoon.com/
SEMrush

This website will help your visitors calculate their BMI (Body Mass Index)

Why this niche is important?
Weight has been one of the things most people have become focused on in later years
The body mass index or BMI as it’s usually shortened is a simple method, devised in order to determine, based on the height and current weight of a person whether or not they need to start working on losing weight fast.

What this site is about?

This website is about Body Mass Index (BMI) which is a measure of body fat based on height and weight that applies to adult men and women. Enter your weight and height using standard or metric measures.
It has two Body Mass Index Calculators, one in English and one in Metric values.
It also generates an image with your status form females and males it’s really cool

How can i use this site?
This can used as separate site , or can used as addon for an existing health website or forum.
the site is very simple and very easy to modify it uses jquey to maintain cross-browser supports.
The sale includes?

  • Website script
  • I will help you to install it
  • Great .com domain name

Additional Features:

  • It uses a light weight script
  • Easily to customize and change
  • It shows your Your BMI
  • It shows you your suggested healthy weight range
  • It shows Your BMI category
  • it gives you information about your BMI category
  • It shows the rate without reloading the page
  • The images are pre-loaded into the users’ computer memory so that it can be instantly accessed when needed
  • The design is very simple to make it easy to use it as a plugin for an existing website or to use it in your own templete

How can i make money?
You can use Adsense or any PPC alternative like Infolinks and Clicksor
you can use Amazon affiliate, clickbank which offer 75% commission

 

plugins – Cost calculator with ability to add new products

I’m looking for a way to make cost calculator something like this:

Name:
Surname:
Email:

** + Add product **
Quantity:
X:
Y:
Z:

** + Add product **

with ability to add as many products as I want to the form. And also, I need to be able to add a number to the total sum that is multiplied by added product count.

In other words, let’s say I add checkbox at the top with the title of “add tax?”, if “yes”, then it would need to take a number of added products and multiply it by tax rate.

Is this possible? I’ve only found a plugin “ez forms”, that was closest to what I need but it did not let me add a number that is multiplied by added products.

Is coding it in JS is my only option? Thanks.

How do I fix the Python calculator to make it only perform 3 calculations, then prints “THE END”

This code continuously asks to input numbers. I want it to only ask 3 times, then it prints “THE END”, meaning that the calculator is capped at 3 calculations

i=0
while(i<=3):
    while True:
        num1 = int(input("enter first number:"))
        num2 = int(input("enter second number:"))
        xx = input("Enter the operator number from 1 to 4 : 1(+) - 2(-) - 3(*) - 4(/)")

        if xx == 1:
            add = num1 + num2
            print (num1), ("+"), (num2), ("="), (add)

        elif xx == 2:
            subtract = num1 - num2
            print (num1), ("-"), (num2), ("="), (subtract)

        elif xx == 3:
            multiply = num1 * num2
            print (num1), ("*"), (num2), ("="), (multiply)

        elif xx == 4:
            divide = num1 / num2
            print (num1), ("/"), (num2), ("="), (divide)
        break
    
    else:
        print("please input a valid number")

print("THE END")
```

javascript – Form calculator to OOP

javascript – Form calculator to OOP – Code Review Stack Exchange

python 3.x – Mean difference calculator for any int combination

What it does

Calculates the mean difference for a list of any combination of ints (I think).

What I want to know

The only other way I can think of doing this is using recursion.

I’d like to know if there are other ways to do this.

Code:

nums = (3, 1, 2, 5, 1, 5, -7, 9, -8, -3, 3)

l = len(nums) - 1

diff_list = ()

for i in range(l):
    diff = nums(0) - nums(1)
    if diff < 0:
        diff = nums(1) - nums(0)
    print(diff)
    diff_list.append(diff)
    nums.pop(0)

mean = sum(diff_list)/len(diff_list)

print(round(mean, 1))

java – How is this Calculator Code? Because i started learning Programming and its good if I know what I can make better

java – How is this Calculator Code? Because i started learning Programming and its good if I know what I can make better – Code Review Stack Exchange

python – Formula filler and calculator

You’re using the wrong data structure to contain your shapes and formulas. list_shapes is a list of lists, but the first item of every list is different from the other items in the list. Different kinds of things should be stored in the same container.

A simple change is to just store the formulas in another sub list:

list_shapes = (
    ("cilinder", ("pi*r^2*h", "2*r*h", "2*r*h + 2*pi*r^2")),
    ("kegel", ("1/3*pi*r^2*h", "pi*r*a", "pi*r*a + pi*r^2")),
    ...
    )

Alternatively, you could store the data as a mapping.

list_shapes = {
    "cilinder": ("pi*r^2*h", "2*r*h", "2*r*h + 2*pi*r^2"),
    "kegel": ("1/3*pi*r^2*h", "pi*r*a", "pi*r*a + pi*r^2"),
    ...
    }

Best would be inside your own user-defined class.

PEP 8 states that variables names, function names, and parameter names should be in snake_case, with lowercase letters only. Capital letters are reserved use with constants or class names.

With this in mind, Main should be named main.

(See Ned’s Loop like a Native talk.)

The loop structure for x in range(len(list_shapes)): is frowned upon in polite Python circles. It is considered better to loop directly over the list itself, rather than looping over a list of list indices.

Why is it frowned upon? It is slower, less efficient. As an extreme example, consider a linked list. To determine the length of the list, one would need to traverse the entire list counting the items. Then, to get the n-th item, you would start from the head, and move forward n times. With the original loop, this becomes looping from the head to the 0th item, then looping from the head to the first item, then looping from the head to the second item, and so on, yielding $O(n^2)$ performance. It is more efficient to maintain an interator which advances over the list items one at a time.

For instance, to print out the shape names (using your original list_shapes structure), one could simply write:

for shape_data in list_shapes:
    print(shape_data(0))

In your case, you want the indices as well as the shape data. To get that, we use enumerate():

for x, shape_data in enumerate(list_shapes):
    print(x, shape_data(0))

This is more efficient than the original loop, since list_shape(x) never needs to be indexed.

We can improve this further using list unpacking. Using my first alternate list_shape definition, shape_data would be a list of two items. The shape name and a formula list, instead of assigning that data to shape_data, lets assign it to two variables: shape_name and formula_list:

for x, (shape_name, formula_list) in enumerate(list_shapes):
    print(x, shape_name)

Since we are not using the formula_list at this point, we could instead assign to the throw-away variable, _:

for x, (shape_name, _) in enumerate(list_shapes):
    print(x, shape_name)

Much clearer.

You go through a lot of effort to print out the uppercase shape name centered. This functionality is built-in to Python’s .format() function.

Centred in a 40 character-wide field:

print("{:^40}".format(shape_name.upper())

Or using Python 3.6’s f-strings:

print(f"{shape_name.upper():^40}")

When SWIDTH is defined, you can use it too:

print(f"{shape_name.upper():^{SWIDTH}}")

This is wrong on so many levels:

    for x in range(len(list_shapes(figur_num)(1:))):
        print("{}. {}".format(x + 1, list_shapes(figur_num)(x + 1)))

First, you take list_shapes(figur_num) and this slice it with (1:), creating a new list in memory, from which you just compute the len(...)! You could have computed the length of the original and subtracted one, saving the Python interpreter a lot of time and memory.

Next, we have the for x in range(len(…)) structure we already mentioned.

Then, we compute x + 1 twice per loop iteration!

Lastly, insult to injury, we are looking up list_shapes(figur_num) on each iteration, plus an additional time to compute the length!

Let’s rework this:

    for index, formula in enumerate(list_shapes(figur_num)(1:), 1):
        print("{}. {}".format(index, formula))

We’ve still got the list slice, but doesn’t seem as awful here, since we are actually iterate over the items of the slice. list_shapes(figur_num) is only looked up once. And the + 1 calculation vanished from the loop entirely, because we use enumerate(..., 1) to start the enumeration value at 1.

With the improved list_shapes structure, where the shape name and formulas are separate, we can eliminate the slice, too:

    for index, formula in enumerate(list_shapes(figur_num)(1)):
        print("{}. {}".format(index, formula))

When eval(formula) raises an exception, you extract the variable name which was not defined.

What if the exception was a ZeroDivisionError, or maybe ValueError due to square-root of a negative number?

You should catch the more precise exception you can to avoid catching and attempting to recover from the wrong problem.

    try:
        print(eval(formula))
    except NameError as error:
        ...

Again, you’re going through a lot of work to extract the variable name from the error. It could be simpler:

        variable_name = str(error).split("'")(1)

When you use exec(…) or eval(…), your global and local environment are available to use and modify. This include variables like formula and formula_num and functions like Main.

You should use a clean environment for your evaluator.


   local_vars = {}
   …
   while True:
       eval(formula, None, local_vars)
       …
       exec(variable, None, local_vars)

Initially, local_vars won’t contain any variables. But as the exec(…, None, local_vars) statement gets executed, your user-defined variables will start to be added to local_vars, and used in the eval(…, None, local_vars) statement.

This means to run a different calculation, possibly with a different formula, you can re-initalize local_vars to an empty dictionary, and you will be able to enter new values for the variables.

javascript – This code renders a time dilation calculator. Am I abusing React state? Can I reorganize my components so that this scales better?

I’ve been learning React for about a month now. I wrote a small (interactive calculator)(1) to show the effects of time dilation under special relativity. It’s Node/React/Razzle(for SSR)/Typescript/Javascript.

Here are the issues I’ve run into and would like help with:

  1. I feel like I’m abusing state. You change one parameter and it cascades through other dependent values which then trigger a recalculation; but because state updates are asynchronous, I have to set awkward artificial callbacks to force a timely update.

  2. Bootstrap prepend and append on input forms take up a lot of space and cause certain calculators to render poorly on mobile… Should I consider using Material UI, or can I “prettify” and resize the input fields appropriately with custom CSS / bootstrap?

  3. Scalability – Currently there are only ~13 components but intend to make a lot more pages and calculators, and I’m wondering if there’s any room for refactoring to take advantage of recurring patterns: it feels like I could be writing a lot less code. Also, routes – the file containing routes could get huge – will that become a problem in the future?

import { ThreeColumnContainer } from "../Layout/ThreeColumnContainer";
import { TextControl } from "../controls/Input";
import { Helmet } from "react-helmet";

const c = 299792.458; //km/s

export class TwinParadoxUnderSpecialRelativity extends Component<{}, { (key: string): number }> {

  constructor(props) {
    super(props);
    this.state = { 
      velocityAsPercentageOfC: 0,
      lorentzFactor: 1,
      velocityInKph: 0,
      velocityInMph: 0,
      contractedElapsedTime: 1,
      dilatedElapsedTime: 1 
    };

    this.calculateLorentzFactor = this.calculateLorentzFactor.bind(this);
    this.updateVelocity = this.updateVelocity.bind(this);
    this.updateLorentzFactor = this.updateLorentzFactor.bind(this);
    this.calculateVelocityAsPercentageOfC = this.calculateVelocityAsPercentageOfC.bind(this); 
    this.calculateTimeDilation = this.calculateTimeDilation.bind(this);
    this.updateElapsedTime = this.updateElapsedTime.bind(this);
    this.updateTravelerElapsedTime = this.updateTravelerElapsedTime.bind(this);
    this.calculateTimeContraction = this.calculateTimeContraction.bind(this); 
  }



  updateVelocity(e) {
    var velocityAsPctOfC = e.target.value;
    var lorentzF = this.calculateLorentzFactor(velocityAsPctOfC);
    var kph = this.convertToKmh(velocityAsPctOfC);
    var mph = this.convertToMph(kph)
    //var dilatedTime = 
    this.setState({ velocityAsPercentageOfC: velocityAsPctOfC, lorentzFactor: lorentzF, velocityInKph: kph, velocityInMph: mph},
      () => this.setState({dilatedElapsedTime: this.calculateTimeDilation(this.state.contractedElapsedTime, lorentzF)}));
  }

  updateLorentzFactor(e) {
    var lorentzF = e.target.value;
    var velocityAsPctOfC = this.calculateVelocityAsPercentageOfC(lorentzF);
    var kph = this.convertToKmh(velocityAsPctOfC);
    var mph = this.convertToMph(kph)
    //var dilatedTime = this.calculateTimeDilation(this.state.elapsedTime);
    this.setState({ velocityAsPercentageOfC: velocityAsPctOfC, lorentzFactor: lorentzF, velocityInKph: kph, velocityInMph: mph},
      () => this.setState({dilatedElapsedTime: this.calculateTimeDilation(this.state.contractedElapsedTime, lorentzF)}));
  }

  updateTravelerElapsedTime(e) {
    var elapsed = e.target.value;
    this.setState({contractedElapsedTime: elapsed},
      () => this.setState({dilatedElapsedTime: this.calculateTimeDilation(this.state.contractedElapsedTime, this.state.lorentzFactor)}));
  }

  updateElapsedTime(e) {
    var dilatedTime = e.target.value;
    this.setState({ dilatedElapsedTime: dilatedTime },
     () => this.setState({contractedElapsedTime: this.calculateTimeContraction(this.state.dilatedElapsedTime, this.state.lorentzFactor)}));
  }

  calculateLorentzFactor(velocityAsPercentageOfC: number) {
    return 1 / Math.sqrt( 1 - ( Math.pow( velocityAsPercentageOfC / 100, 2) ) );
  }

  calculateVelocityAsPercentageOfC(lorentzFactor: number) {
    return Math.sqrt(-1 * (Math.pow(1/lorentzFactor, 2) -1)) * 100;
  }

  convertToKmh(velocityAsPercentageOfC: number){
    return velocityAsPercentageOfC * c;
  }

  convertToMph(kilometersPerHour: number)
  {
    return kilometersPerHour * 0.621371;
  }

  calculateTimeContraction(contractedElapsedTime: number, lorentzFactor: number)
  {
    return contractedElapsedTime / lorentzFactor;
  }

  calculateTimeDilation(dilatedElapsedTime: number, lorentzFactor: number)
  {
    return dilatedElapsedTime * lorentzFactor;
  }

  roundNumber = (num: number, dec: number) => {
    return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
  }


  renderLeft() {
    return (
      <div>
        <h1>Twin Paradox (Time Dilation under SR) Calculator</h1>
        <p/>
        <TextControl prepend="Relative velocity as % of c" type="number" value={this.state.velocityAsPercentageOfC} append="v" onChange={this.updateVelocity} />
        <TextControl prepend="Lorentz Factor" type="number" value={this.state.lorentzFactor} append="gamma" onChange={this.updateLorentzFactor} />
        <TextControl prepend="Velocity in kph" type="number" value={this.state.velocityInKph} append="kph" readonly="true" />
        <TextControl prepend="Velocity in mph" type="number" value={this.state.velocityInMph} append="mph" readonly="true" />
        <TextControl prepend="Earth Observer Elapsed Time" type="number" value={this.state.dilatedElapsedTime} append="Tb" onChange={this.updateElapsedTime} />
        <TextControl prepend="Spaceship Traveler Elapsed Time" type="number" value={this.state.contractedElapsedTime} append="Ta" onChange={this.updateTravelerElapsedTime}/>
        <p></p>
        <h4>Explanation</h4>
        <p>At {this.roundNumber(this.state.velocityAsPercentageOfC,0)}% of the speed of light (c), the lorentz factor or gamma is {this.roundNumber(this.state.lorentzFactor,4)}. That means a twin traveling through space will age at {this.roundNumber(1 / this.state.lorentzFactor * 100,4)}% the rate of its twin at relative rest on earth. If {this.roundNumber(this.state.dilatedElapsedTime,4)} units of time have passed on earth, {this.roundNumber(this.state.contractedElapsedTime,2)} units of time will pass for the space twin. For this to be realistic, the space twin needs to travel at {this.roundNumber(this.state.velocityInMph/1000,0)}K miles per hour ({this.roundNumber(this.state.velocityInKph/1000,0)}K kilometers per hour).</p>
        <p>Interestingly, the spaceship - and everything in it - will also contract in length to {this.roundNumber(1 / this.state.lorentzFactor * 100,2)}% of its original length.</p>
      </div >
    );
  }

  renderMiddle() {
    return (
      <div>
        <Helmet>
          <title>Time Dilation Calculator (Twin Paradox)</title>
          <meta name='description' content='Calculate the Lorenz factor based on given velocity or percentage of the speed of light to measure time dilation in special relativity.' />
        </Helmet>
        <h3>Calculate Time Dilation (SR)</h3>
        <p>Time Dilation is the time difference between two clocks or observers moving relative to each other. Time Dilation has practical consequences at very fast relative speeds, in particular for GPS and other satelites. The formula to calculate time dilation is Sqrt(1 - v^2 / c^2) where v is relative velocity and c is the speed of light. The result is called the Lorenz factor.</p>
        <p>Time Dilation means that someone traveling at very high speeds will "experience" time at a slower rate than someone in a frame at rest. So at speeds approaching the speed of light a traveler will age more slowly than someone observing from earth. The closer the traveler gets to the speed of light, the more dramatic the effect, so the traveler could experience and age only a year while everyone on earth ages and experiences eight years.</p>
      </div>
    );
  }

  render() {

    return (
      <div>
        <ThreeColumnContainer
          left={this.renderLeft()} middle={this.renderMiddle()}></ThreeColumnContainer>
      </div >
    );
  }
}```


  (1): https://calc-solver.com/twin-paradox-under-special-relativity-calculator

keyboard – Troubles with Calculator key on HP notebook

I’ve got a new notebook HP Omen 15, manufactured in 2020.
I has Calculator key, and I cannot get it launching calculator in Ubuntu 20.04.

When I press Calculator key, nothing happens. I also cannot assign a shortcut to that key in the respective configuration program from the desktop environment. I’ve tried KDE with Plasma and Gnome shell (I suppose it is launched if I choose “Ubuntu” session on login screen of a display manager). Those programs invite “Press a desired key” but don’t see Calculator key presses.

I’ve tried debugging situation with xev and showkey utilities.

If I run xev and press Calculator I see insanely many messages about pressing and releasing XF86Calculator key:

...
KeyRelease event, serial 42, synthetic NO, window 0x3e00001,
root 0x29e, subw 0x0, time 52918, (151,-96), root:(151,806),
state 0x14, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyPress event, serial 42, synthetic NO, window 0x3e00001,
root 0x29e, subw 0x0, time 52918, (151,-96), root:(151,806),
state 0x14, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 42, synthetic NO, window 0x3e00001,
root 0x29e, subw 0x0, time 52958, (151,-96), root:(151,806),
state 0x14, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

KeyPress event, serial 42, synthetic NO, window 0x3e00001,
root 0x29e, subw 0x0, time 52958, (151,-96), root:(151,806),
state 0x14, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 42, synthetic NO, window 0x3e00001,
root 0x29e, subw 0x0, time 52999, (151,-96), root:(151,806),
state 0x14, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
...

Then I press Ctrl-C to stop it.
If I run xev again, it doesn’t show any events on Calculator key.
If I run dmesg, it shows messages like ( 5685.955273) kauditd_printk_skb: 46 callbacks suppressed. Probably this key still generates press-release events, but the kernel suppresses them.

Probably this is the reason of the bug.

If I run showkey, it always shows scan codes and key codes, if I press Calculator key:

$ sudo showkey -s
kb mode was ?UNKNOWN?
( if you are trying this under X, it might not work
since the X server is also reading /dev/console )

press any key (program terminates 10s after last keypress)...
0x9c
0xe0 0x21
0x1d
^Ccaught signal 2, cleaning up...
0xe0 0x21
$ sudo showkey -k
kb mode was ?UNKNOWN?
( if you are trying this under X, it might not work
since the X server is also reading /dev/console )

press any key (program terminates 10s after last keypress)...
keycode  28 release
keycode 140 press
keycode  29 press
^Ccaught signal 2, cleaning up...

Overall, it looks like that key is a normal media key that is correctly mapped to XF86Calculator.

So, could you give me any clues how to get it working?

I am ready to provide any additional information about my notebook and OS.

I also think that I could try to fix that bug myself. However, currently I have no idea which module to debug.

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies