javascript – Simple jQuery Calculator

I'm building a simple calculator with jQuery.

I can add the value to the screen and when the user clicks on the operator, the first values ​​are clear or empty.

My question is: how can I store the first and second values ​​of the input field to use these values ​​to perform the calculation?

$(document).ready(function() {
  let firstVal = 0;
  let secVal = 0;
  let latestNumber = 0;

  $(".btn").on("click", function(event) {
    let currentVal = $("input").val();
    console.log("currentVal is " + currentVal);
    let val = $(this).data("val");
    console.log("val is " + val);
    firstVal = $("input").val(currentVal + val);

    switch (val) {
      case "+":
        latestCalculationMethod = val;
      case "-":
        latestCalculationMethod = val;
      case "x":
        latestCalculationMethod = val;
      case "/":
        latestCalculationMethod = val;
        latestNumber = 0;

    if (firstVal === "") {
      firstVal = latestNumber;
    } else {
      secVal = latestNumber;

research – Confidence Intervals, Confidence Levels, and Probability of Simple Tests

This seems like a simple problem, but I can not understand it

Let's say I'd like to know if it's useful to implement a new feature. If we have to focus on functionality or not. Suppose that there is no test possible, such as interviewing users or anything else.
Its function will be simple, for example "webcam for ecommerce for users who pay a premium account".

To be precise, I have 1500 premium users. I can say "The feature is used when at least 75% of customers use it". Awesome! We would like to run the Fake Door test, where we simply implement the button for the webcam and when the user clicks on it, we show him "we're implementing this feature now, let's stay with us" or whatever it is. Other (I know, false doors are not the best method, but that's not the purpose of that). I will "test" for 14 days. In 14 days, 350 customers will come to my site and see this feature. 265 customers click the button.

What can I say about this feature? It seems like I can say, "Yes, we need to implement it, because 75% of users will use this feature" (75% of 350 is 262.5). < 265) => H0 (at least 75% use this feature) seems to be ok. But this is not the truth at all. Because there can be a huge mistake (I only tested about 23% of customers).

What I'm trying to achieve is:
I would like to say: "With 95% trust, 75% of customers will use this feature so we can implement it."

I am lost from all confidence intervals, confidence levels and sample sizes, etc. etc. Can any one help me get the confidence step by step and explain to me, what can I expect with these numbers (1500 premium users at all, 350 users have seen the feature, 265 users used the feature).

parsing – parsing a key configuration file = simple value in C


I do not like too much the interface that you have defined for the function. I think that trying to combine reading integers and reading strings in one function makes it more difficult to use. For most C codes, I think the old UNIX guiding principle ("do one thing and do it right") provides excellent guidance. As such, I would probably have two distinct functions, one to read a string, the other to read a number.

I have not tested it to be sure, but at first glance, it also seems that if you ask to read a number, it will mean a poor failure in signaling. For example, if your file contains: foo=0 and you try to read foo as a number, it will set the number to 0 and return 0. But if the file contains foo=Joe instead, it seems to me that it's going to do exactly the same thing.

I would prefer that if that could not convert the rest of the line after the = to a number that it returns 1 to indicate that it has failed.

Memory allocation

Since you only use our left and right inside your function and release them again before coming back, it is probably not necessary to assign them to the job. You can just allocate them as local tables and use them. The obvious exception to this would be if you were targeting a tiny microcontroller that could have less than 256 bytes available on the stack. In this case, however, you will usually not have a file system, so the whole function is no longer relevant.

Standard library

I think of a judicious use of fscanf can simplify a little code.

To read a string, it seems that the obvious interface would simply be to return the value part of the pair, and if it is not found, return a NULL pointer:

char *read_string(FILE *file, char const *desired_name) { 
    char name(128);
    char val(128);

    while (fscanf(file, "%127(^=)=%127(^n)%*c", name, val) == 2) {
        if (0 == strcmp(name, desired_name)) {
            return strdup(val);
    return NULL;

When reading a number, we probably need something closer to your original interface, with a return value indicating success or failure and receiving a pointer on a int where we write the value (if found):

int read_int(FILE *file, char const *desired_name, int *ret) {
    char *temp = read_string(file, desired_name);

    char *stop;
    *ret = strtol(temp, &stop, 10);
    int ret_val = stop == NULL || *stop != '';
    return ret_val;

Note that in the current state, the return value reflects the conversion of the all rest of the line (everything after =) to the desired number. If part of it can be converted, this part will be written to the destination, but the return will always indicate a failure. For example, if you had foo=1234abcd, trying to read foo as a number would give you 1234but returns 1 because the abcd some could not be converted.

It would also be possible to simply ignore the waste lying around, so foo=1234abcd would read 1234 part and return 0 to signal success.

This would simplify the code a bit:

int read_int(FILE *file, char const *desired_name, int *ret) {
    char *temp = read_string(file, desired_name);

    char *stop;
    *ret = strtol(temp, &stop, 10);
    return stop == temp;

In this case, it is sufficient to check that at least one character has been converted, in which case stop has been advanced at least one character after the entry. Since we do not need to read the content of the strings to determine the return value, we no longer have to do the little dance with determining the value of return, then the release of the string and finally returning the return value.

Aggressive geometry – Can a simple vector beam be isomorphic to its torsion?

Let $ V $ to be a vector packet on an algebraic curve $ C $. Is it possible that $ V cong L $ for a line package $ L $? This is certainly possible if $ V $ is decomposable, for example if $ V cong mathcal {O} _C oplus L $ with $ L ^ 2 cong mathcal {O} _C $. I want to show that $ V cong L $ involved $ L cong mathcal {O} _C $ if $ V $ Is simple.

parsing – parse a simple C configuration file

Write a program that should read a formatted file strictly as
this below:

$ cat sample


The left and right sides of = are consecutively the parameter name and
its respective value. Values ​​can be integers or strings. Each parameter is
separated by a new line. The parameter name and its value will not be greater than
127 bytes.

This program receives an input search token and, if applicable, parse_param_file() will fill in the input arguments with a string or an integer value.


#define TEXT "sample"

 * Function: parse_param_file
 * Arguments:
 * token    - param name that needs to be looked up
 * buf      - buffer for string value. Pass NULL if unwanted
 * buf_int  - buffer for integer value. Pass NULL if unwanted
 * filename - string formatted path to the file 
int parse_param_file(const char *token, char **buf, int *buf_int,
        const char *filename) {
    if (!token || (!buf && !buf_int)) {
        printf("%s: invalid argsn", __FUNCTION__);
        return 1;
    FILE *f = fopen(filename, "r");
    if (f == NULL) {
        printf("%s: %s not foundn", __FUNCTION__, filename);
        return 1;
    char *left = malloc(128);
    char *right = malloc(128);
    char *dlim_ptr, *end_ptr;
    char fbuf(256);
    while (fgets(fbuf, 256, f)) {
        dlim_ptr = strstr(fbuf, "=");
        end_ptr = strstr(dlim_ptr, "n");
        strncpy(left, fbuf, dlim_ptr - fbuf);
        strncpy(right, dlim_ptr + 1, end_ptr - dlim_ptr - 1);
        if (strcmp(left, token) == 0) {
            /* Param found */
            if (buf != NULL)
                *buf = strdup(right);
            if (buf_int != NULL)
                *buf_int = atoi(right);
            return 0;
    printf("%s: Param not found in %sn", __FUNCTION__, filename);
    return 1;

/* How to use parse_param_file() */
int main(void) {
    char *buf = malloc(128);
    int val = 0;

    /* Test 1 */
    if (parse_param_file("bingo2", NULL, NULL, TEXT))
        fprintf(stderr, "parse_param_file() failedn");
    printf("buf : %sn", buf);
    printf("int : %dn", val);
    /* Test 2 */
    if (parse_param_file("bingo3242", NULL, &val, TEXT))
        fprintf(stderr, "parse_param_file() failedn");
    printf("buf : %sn", buf);
    printf("int : %dn", val);
    /* You must clear *buf and val if you want to reuse them as args again */
    /* Test 3 */
    if (parse_param_file("bingo3", &buf, &val, TEXT))
        fprintf(stderr, "parse_param_file() failedn");
    printf("buf : %sn", buf);
    printf("int : %dn", val);

    return 0;

simple question about the Git workflow for the subproject

My research team and I use Git to manage our various scripts and notes / publications for our current projects, and I am questioning what is considered the best practice for the situation we are in.

Until now, the scripts we used were relatively small and did not require too much computing power. We generally agreed on what a script should do; one or more people coded it, executed it on their personal machine and sent an output file on the main branch. We did not follow a specific workflow and mainly used the repository as a Dropbox: as we are a small team, a person sends his message to the main branch once he has finished what she does so that everyone can see it.

Recently, we needed more computing power and access to a high-performance machine on which we can run our scripts for several days. Our workflow is currently: we code scripts and test them on our personal machines for small executions; once we are ready for a long run, we put all the necessary files into a production/ directory, and I scp to the server.

We can not clone the entire repository on the server because we have limited space and we are not comfortable copying unpublished results and other files internal on a machine that we share with other people.

We have considered creating another repository just for this, but that does not seem better than what we are doing now, because I would always have to copy the files from the main repository to the new one. I've also read articles on scattered crates, but from what I understood, the whole report is still downloaded.

Is there a best practice or standard workflow for doing these things?

50 pieces BMF for a simple task. | NewProxyLists

Hello guys, I offer you a simple task in exchange for 50 BMF coins

Just watch a 3-minute YouTube video.
Press the button I like, subscribe and comment down.

Here is the YouTube link

Thank you for letting me know your user name or your user name here so that I can give you the reward immediately

I only need 6 people to do the tasks for the moment.

Thank you so much.

A simple business plan to provide managed shared hosting services to 100 clients

Hello, can anyone criticize this simple business plan?

I have the intention to buy a vp plan fully managed from Inmotion Hosting. It costs around $ 800 a year.

I would like to use IM Creator as the main content management system. The annual plan costs about $ 2,500.

I want to charge my clients a fixed annual or monthly fee. First, I will use IM Creator (EXPRS Website Builder) to create the sites.

1. To what extent is this plan viable in terms of safety?

Amazon Web Services – AWS Recommendation for Simple Serverless Structure

I'm learning the structure of websites and am confused by the number of existing concepts and designs.

That's what I want to do:

(Using AWS)

Image: Simple structure without an AWS server

Route 53: DNS

CloudFront: CDN   ->  S3 /website1/styles.css   ->  S3 /website1/robots.txt  ->  S3 /website1/favicon.ico             -> API Gateway*        -> API Gateway

S3: Where can I register: syles.css, robots.txt and favicon.ico

API gateway: Request Manager.       ->  Lambda (node.js)*  ->  Lambda (API)

Lambda (node.js): I want to have React App with server-side rendering server without rendering. This application calls an API to obtain data.

Lambda (API): the API

RDS: PostgreSQL


1) Is my structure correct? Or are there any other website server designs that are better? (I want to keep server-side rendering)

2) Can I add another website to this structure?
For example: redirection, with CloudFront, / styles.css at S3 / website2/syles.css, same in API Gateway, redirection / to another Lambda instance (node.js). Or it is not recommended?