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 4 years ago.
Improve this question
I would like to know what is the Bitcoin block number in an existing date at an exact hour. for example what is the block number closest to 1.1.2017 at 00:00 UTC. What is the easiest way to do so?
Convert the time to seconds since the UNIX epoch:
$ date -ud "1/1/2017"
Sun Jan 1 00:00:00 UTC 2017
$ date -ud "1/1/2017" +%s
1483228800
You can also use Epoch Converter to convert it.
Add three zeroes to that number and append it to a blockchain.com URL:
https://www.blockchain.com/btc/blocks/1483228800000
And there you have it:
446033 (Main Chain) 2017-01-01 00:02:33
And if you want the previous block, clock on the previous button and scroll to the end:
446032 (Main Chain) 2016-12-31 23:44:04
So block 446,032 was mined at 12/31/2016 at 23:44:04 UTC and block 446,033 was mined at two minutes and 33 seconds after midnight.
Related
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 6 days ago.
Improve this question
The input is a person's date of birth (e.g. 22/Feb/78).
Using a regular expression, I want to find out if the person has their birthday within the next two weeks from now.
So I want to know if February 22nd (the year needs to be ignored, of course) is within the next 14 days from now. Today is February 13th, so the correct result would be: yes.
Is there a way to do this?
I tried ChatGPT but it was not available for me due to capacity reasons.
So I tried https://www.autoregex.xyz/ and entered "Is the date (mm.dd.) within the next two weeks?".
Result:
\d{2}\.\d{2}\.\s*(?:[0-9]|1[0-9]|2[0-9]|3[0-1])\s*(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s*(?:19|20)\d{2}
But it did not work.
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 6 months ago.
Improve this question
I would appreciate it if someone can assist with a code to calculate the "specific number of heatwaves days where relative humidity > 66% and < 33%".
(whereas, a heatwave event is defined as one in which temperatures exceeded the 90th percentile of the daily mean temperature for at least three consecutive days, respectively).
Ok well here is a solution
# temperature percentile
cdo timpctl,90 infile -timmin infile -timmax t2m.nc t2m_pcen90.nc
# mask the temperature
cdo ge t2m.nc t2m_pcen90.nc mask.nc
# Need to make sure we have three consecutive days
cdo --timestat_date last runmean,3 mask.nc mask3.nc
cdo gec,1 mask3.nc heatwave_T.nc
# Now filter for dry heatwaves, assuming RH is %, change X if fraction
cdo lec,33 rh.nc rhdry.nc
cdo mul heatwave_T.nc rhdry.nc heatwave_dry.nc
# and same for wet
cdo gec,66 rh.nc rhwet.nc
cdo mul heatwave_T.nc rhwet.nc heatwave_wet.nc
Each file should have a 1 in it for each location/time when you are in a heatwave according to your definition. Of course the metadata is appropriate for T2m not the index, use NCO to change that if required. I have several video guides that would help with this question, the key one being the one on masking (it doesn't include the running mean part though). Note also that the RH criterion is applied ONLY on the day (no running mean) but that is how you write the definition in your question. Duplicate the running mean part if needed.
ps: In general it is good to show that you have attempted a solution yourself, before asking, SO guidelines are that questions are of a debugging nature, or can be a request for a one-liner, but not coding requests like "write me a code that does X or Y" - I think that is why you were getting downvoted.
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 6 years ago.
Improve this question
I've been looking for a way to calculate a future calendar date in C++ using local time, but so far no dice.
Basically I want to add 3 days (for standard delivery) OR add one day (for overnight delivery) to the CURRENT time (printed in MM-DD-YYYY format and which is retrieved by the computer). How do I do this simply [no algorithms required] in C++?
Output would look like this:
Would you like overnight delivery [Y/N]? Y
Today's Date: 03-25-2017
Your Expected Arrival Date: 03-26-2017
Would you like overnight delivery [N/Y]? N
Today's Date: 03-25-2017
Your Expected Arrival Date: 03-28-2017
Here's how to do it in less than 8 lines of code. Use hours to specify the exact amount of time in the future you want to go. Formatting is very much gross and unappealing like C. Don't forget to specify each "now"...expedited is different than regular shipping!
chrono::system_clock::time_point now = chrono::system_clock::now();
time_t now_c = chrono::system_clock::to_time_t(now + chrono::hours(24));
cout << "Overnight Shipping Expected Arrival Date: " << put_time(localtime(&now_c), "%F") << '\n';
chrono::system_clock::time_point now2 = chrono::system_clock::now();
time_t now2_c = chrono::system_clock::to_time_t(now2 + chrono::hours(72));
cout << "Standard Shipping Expected Arrival Date: " << put_time(localtime(&now2_c), "%F") << '\n';
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 6 years ago.
Improve this question
I am completely stuck / lost. I need to write a program that will tell a user what month it will be in x amount of months from March. I need a point in the right direction to start me off.
I am still learning c++, so I'm trying to keep it as basic as possible. Any help will be a lifesaver !!
Example:
User enters 6, the result would display September.
User enters 239, the result would be February.
Just get the input % 12 and add it to March . For example in case of 239 :
239 % 12 = 11 ---> 11 months after march is february.
Logic : there are 12 months in an year. So march will again come in a cycle of 12.
Now so n/12 years will pass as it is. So after n/12 years you will be again at march. After that only n%12 months remain. So you can add them up directly to get your answer.
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 need help creating a general function or pseudocode that chooses a single event from a group events who all have different probabilities.
Ex.
event 1 = 45%
event 2 = 15%
event 3 = 50%
event 4 = 35%
event 5 = 50%
The simplest solution would be to sum and normalize the ranges (as an example, the sum of the values is 195, your first event would get the range [0, 45/195=0.23[, the second one [0.23, 0.23+0.076=0.31], and so on), then extract a number from [0,1[ and look to what range it belongs.