Value of a number going up [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Right, i honestly have no idea what to even search to find this out! i have searched many phrases trying to find out and i keep coming back with nothing.
I have a client who has asked if it is possible to have a number like 2.00000000 and have it constantly going up at a variable speed. The task he wants is to have is for different users to have a number that keeps going up (for what reason i don't know, i said ill look into it for him to find out if there is a plugin or something).
But either way he wants it to b able to even while the user is offline the value still continues to go up.
Is there such a plugin to achieve this? cheers

If it is at variable speed couldn't he just check the date time at which he initialize the sequence and compare it to the time at which he checks the number. The difference in time would be that offset he would call variable speed
For example if he wanted the number to increase 10 every 24 hours then:
double intialTimeInSeconds = //Whatever the Start time would be
double amountGainedEverySecond = 24/10/60/60;
double nowTime = //whatever time it is now;
return (nowTime - initialTimeInSeconds)*amountGainedEverySecond;

Related

How to track free trial in programming? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
The community reviewed whether to reopen this question 10 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I have an application that users can use it 14 days without paying. However, after 14 days users will not be able to use the application unless s/he pays for it.
I don't know how to track the remaining time for the free trial. I'm thinking of setting an cronjob 14 days later when the users is created but I think it is a bit hard to manage (?).
The second thought would be checking the remaining time for every user at a specific time every day but timezone and server loading might be problem in this case.
I'm using MongoDB and Node.js for back-end and HTML, CSS, JS for front-end. How can I design my database and code to overcome this problem?
Thanks in advance.
I believe this question have enough detail please warn before closing.
You could possible save time of register of user and then every time on request of users that don't pays calculate the remaining time?

How do I do this if statement? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am attempting to learn code from scratch and am doing the pre course work for lambda and I have hit a hard brick wall lol. I'm a bit older (36) and have no college education and wanted to pursue this for a while but always figured I wasn't smart enough but here I am attempting it. I am on the section of logical operators and if/else statements. I sort of get the concept but I think I am just not following how they word certain questions. I have been on the following question for about three hours and am ready to put my head thru the computer. Any help would be greatly appreciated.
function exerciseThree(typeOfPizza){
let lovesPizza;
// In this exercise, you will be given a variable, it will be called: typeOfPizza
// You are also given another variable called: lovesPizza;
// Using an if/else statement assign lovesPizza to true if typeOfPizza is 'pepperoni', assign it to false if it is 'olives'
Everyone starts at the beginning. Good on you for spending the time to learn. The people who are downvoting are probably doing so because you're supposed to show what you've tried so far in your post. When you get the chance, please do so. But here's the code before this question gets too many downvotes to be answered. I hope it helps. I trust you'll take the time to study it and learn from it. If you have questions about it, leave a comment.
function exerciseThree(typeOfPizza){
let lovesPizza;
if(typeOfPizza == 'pepperoni'){
lovesPizza = true;
}
else if(typeOfPizza == 'olives'){
lovesPizza = false;
}
}

Handling reminders timeout [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am creating an assistant bot in javascript and I want to support reminders, my problem is that it need to support both short timeouts (10 mins) and long timeouts (a month).
To my understanding using the setTimeout() functions wouldn't work for the long timeout, so I thought of using a lookup table and check it every second, but that would be heavy on resources.
I wanted to know if the lookup table it the best option (as far as performance is concerned) and if so whether there are best practices to follow.
I would create a function prepareNextReminders(time_in_minutes, callback) that retrieves reminders in the next X minutes, e.g. one hour. For each of them, creates a setTimeout with the callback and the proper delay and adds the id to a list of prepared reminders.
This function runs every 15 minutes and in each run does the same for the new reminders not already existing in the list of prepared reminders.

Creating a Counter that increments by 1 every second [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
So I'm trying to make a counter that begins counting as soon as the page is loaded and continues indefinitely. Much like what's done on candies.aniwey.net the only difference is I'm using asp.net and was wondering how to do it and what's the most efficient way? ASP.Net, Javascripting, etc.
Thanks
-- Sorry yeah, in the browser. Should have been more specific.
try using the date or datetime class in asp.net (sorry i work java, android, i will use java code)
like java you can use Date class for time operation, like you want to do, for example when the page start loading take a timestamp of the current time, then when the visitor leave take another timestamp, do the math and voala you have the seconds that person that person stay in that page
in code:
Date startTime = new Date();
Date endTime = new Date(); --> this must be activate in a event of some sort
int seconds = endTime - startTime;
that is the idea
Where do you want the counting to be done? You say "as soon as the page is loaded" which sounds like you mean in the Browser.
In which case JavaScript.

JavaScript distributed computing project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I made a website that does absolutely nothing, and I've proven to myself that people like to stay there - I've already logged 11+ hours worth of cumulative time on the page.
My question is whether it would be possible (or practical) to use the website as a distributed computing site.
My first impulse was to find out if there were any JavaScript distributed computing projects already active, so that I could put a piece of code on the page and be done. Unfortunately, all I could find was a big list of websites that thought it might be a cool idea.
I'm thinking that I might want to start with something like integer factorization - in this case, RSA numbers. It would be easy for the server to check if an answer was correct (simply test for modulus equals zero), and also easy to implement.
Is my idea feasible? Is there already a project out there that I can use?
Take a look at http://www.igvita.com/2009/03/03/collaborative-map-reduce-in-the-browser/ and http://www.igvita.com/2009/03/07/collaborative-swarm-computing-notes/

Categories

Resources