change max output of Milliseconds from 1000 to 2000 in HTML - time

I am wondering how to change the time format of natural time from 24 hours 60 minutes 60 seconds 1000 milliseconds to 30 hours 30 minutes 30 seconds 3200 milliseconds in HTML

Ok, makes slightly more sense now. Firstly you want this to be done in JavaScript. HTML is markup. If you are saying you wish to change the time format, then I can give you examples of changing the format (i.e.: dd-mm-yyyy to mm-dd-yyyy, and many many other variations). Check this out - there you find lots of examples. If you want to turn a day into 30 hours, however, then this is a proper customisation you have to do. So basically a timer that adds a new hour each 30 minutes, and a minute each 30 seconds. Not sure if that's worth the effort for amusement purposes only ? You might want to impress your friends with other things ... i.e. how quickly you can down a pint!

Related

I have a work time of 90 hours, I want to subtract hour:minutes worked to get hours:minutes left to complete work in a libreoffice spreadsheet

I have set 90 hours to complete a job.
Every time I work on the job I want to subtract that time from 90 (90 - time worked)
This is to be done in a Libreoffice spreadsheet

JavaScript/html time

I'm trying to convert the normal 24 hour system to a 20 hour system in JavaScript or html
there seems to be problems and I don't know how to fix them, the program code as a whole works ok but it's not accurate in the area of displaying the proper time
can someone help me.
24hrs per day to 20hrs
60 minutes per hour to 40 minutes per hour
60 seconds per minute to 80 seconds per minute
1000 milliseconds per second to 1350 milliseconds per second
I have been working with the code that is supposed to get the milliseconds from 1/1/1970 to make things hopefully simple but like I said the program isn't working quite right, I do have a table that lets me know what normal time would be at each changed hour but that's all the info I have
Check this Fiddle:
http://jsfiddle.net/z4s7j9vL/1/
My approach was to get the timestamp difference between the current time and midnight of the same day:
millis = ts - clone.getTime();
This way you get how many milliseconds have passed this day and you can do your conversion from there. This is limited to converting time only, but if months and years followed the same principles you could just convert the same way from the current timestamp.

How much monthly hours does the Scheduler addon take on Heroku?

In the Heroku documentation it's said that addons, such as Scheduler, add up to your montly hours, meaning you would have to pay if it adds up more than 30 hours (I have only one web dyno, so I'm using 720 montly hours, and the maximum free is 750 hours). So, how to calculate how much Scheduler takes from your montly hours? For example, if I have a daily task, how much would it take from my montly hours?
It means the wall clock time of the time taken for the jobs that are executed by scheduler to run.
So, for instance, if you're running a 1 minute job every hour, you'd be looking at 720 minutes of time every 30 days.
I believe this last answer is incorrect - the scheduler costs the same hourly as a regular dyno - right?

Algorithm for randomly selecting object

I want to implement a simulation: there are 1000 objects; during a period of time 1800 seconds, each object is randomly selected (or whatever action); the number of selected objects along time follows a rough distribution: 30% will be selected within 60 seconds, 40% will be selected after 60 seconds but within 300 seconds, 20% will be selected after 300 seconds but within 600 seconds, and 10% will be selected after 600 seconds.
So what is the probability for each object being selected every second?
This might be more appropriate to the Programmers section of StackExchange here: Programmers Exchange
But just taking a quick swipe at this, you select 300 objects in the first 60 seconds, 400 objects in the next 240 seconds, 200 objects in the next 300 seconds, and 100 objects in the last 1200 seconds. That gives you a sense of objects per second for each second of your simulation.
So, for example, you select 5 objects per second for the first 60 seconds, so there is a 5/1000 or 0.5% probability of selecting any specific object in each second of those first 60 seconds.
I think that should lead you to the answer if I understand your question correctly.

How to store and collect data for mining such information as most viewed for last 24 hours, last 7 days, last 30 days, last 365 days?

Let's imagine that we have high traffic project (a tube site) which should provide sorting using this options (NOT IN REAL TIME). Number of videos is about 200K and all information about videos is stored in MySQL. Number of daily video views is about 1.5KK. As instruments we have Hard Disk Drive (text files), MySQL, Redis.
Views
top viewed
top viewed last 24 hours
top viewed last 7 days
top viewed last 30 days
top rated last 365 days
How should I store such information?
The first idea is to log all visits to text files (single file per hour, for example visits_20080101_00.log). At the beginning of each hour calculate views per video for previous hour and insert this information into MySQL. Then recalculate totals (for last 24 hours) and update statistics in tables. At the beginning of every day we have to do the same but recalculate for last 7 days, last 30 days, last 365 days. This method seems to be very poor for me because we have to store information about last 365 days for each video to make correct calculations.
Is there any other good methods? Probably, we have to choose another instruments for this?
Thank you.
If absolute precision is not important, you could summarize the information that is longer than 2 units back.
You would store the individual views for the last 1-2 hours, the hourly views (one value per hour) for the last 1-2 days, and the daily views (one value per day) further.
"1-2" means that you store until you have two units full, then summarize the earlier of them.

Resources