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 have a problem that I'm stuck at, I'm trying to create a countdown timer that update itself from firebase, the timer will be shown to all users whenever a user visit my app ( I am creating a school management application,I want the timer the countdown timer to look like this 12days: 32 min : 3second to exams and let it automatically refresh so that it get new content).
I think the easiest way to do this is to create a deadline date value and store that date value in a firebase databse. When the user opens the app, you fetch the deadline value from firebase and then start a count down timer in the local app.
To get the deadline value from firebase you can use this link.
To create a count down timer you can use this link.
What you can do instead of changing the timer from Firebase is to save a timestamp into Firebase (the date you are planning to countdown from) and then query it client side and do the calculations of the days from the client.
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 years ago.
Improve this question
I am developing an application using servlet and jdbc using mysql database.
Here I have to move one table data into other table in every month end(lets say 30th)
visitorlog
id name date
1 XYZ 02-10-2016
visitorloghistory
id name date
Here I have to move all data of visitorlog into visitorloghistory in each month end, and need to remove data from visitorlog.
I have no idea how to do this.
Thanks in advance.
This is called event scheduler or more specifically cron job. The following should help you to start:
https://www.sitepoint.com/how-to-create-mysql-events/
http://www.mysqltutorial.org/mysql-triggers/working-mysql-scheduled-event/
The event schedulers are set to perform specific tasks depending upon time. The following is a sample:
DELIMITER ;;
CREATE EVENT UpdateData ON SCHEDULE EVERY DAY STARTS '2016-10-10 00:00:00' -- This is scheduled to start from '2016-10-10' and updates data every day
DO BEGIN
UPDATE table1 SET Status = 1 WHERE Status = 0;
UPDATE table2 SET Status = 1 WHERE Status = 0;
END;;
DELIMITER ;
Your can check this out. Write a script which will run at particular time.
Cron job for a Java Program
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 am working on printing a file with scheduled date (selected a date from datepicker) in Java, but I don't have any idea about how to do it.
Use cron based tasks that will fire and do the work. For your case, you may use Quartz
It's depend on what actualy you do.
If you want to print many files in different time (printer queque in some oraginsation for example) you could follow next recomendation:
1) place all records about planned print in some storage (file, DB)
2) create one scheduler( #Scheduled in spring for example, or java sheduled executor) wich will processed queqe every minute(if minute is minmal interval of date that you could select).
(Be careful and select delay option instead of rate in your scheduler)
3) print only whose files that time to proceed.
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'm starting to build an app where people vote certain stuff just by clicking on happy/sad faces (kind of like grading it). The thing is that I dont want to make a log-in nor registration for my app (the reason is a long story). So is there any way that I can limit people's vote to 2 per day? Every phone/user could only vote twice a day, and that count will reset after 24h from the first vote.
You have tow options:
Limit the number of votes on the device, by saving the number of votes into persistant storage on the device with a timestamp and act accordingly.
Or (more secure, but also more difficult)
Track the installations as described here identifying app installation
And send the id with every request and validate on the server side.
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 am developing one mobile app where I have to show one tip per day if user clicks on the tip button. all the tips are defined in one text file. It reads the file and randomly pics up the tip (using Random of Java) and displays in the app.
Now my question is how can I restrict the app to show one tip per day. Tip should be same for the whole day doesn't matter how many times user clicks on tip button in the app.
Please provide your ideas to make it work.
I would use a daily alarm to store the tip of the day in the shared preference of the android device. Then you can retrieve the tip of the day from the shared preference and not worry about anything else.
Shared preference
Alarm
maybe use System.currentTimeMillis() and map this timestamp to some picking method? maybe basing on day number in month, week or even year?
Calendar cal = Calendar.getInstance();
//by default it gets current time
//you might set another using setTimeInMillis(long milliseconds)
int dayNum = cal.get(Calendar.DAY_OF_YEAR);
String[] tips = ... ;
int posOfTip=tips[dayNum%tips.length];
String yourTip = tips[posOfTip];
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 9 years ago.
Improve this question
I am developing a website where the users will add items they want to sell.
I am now trying to figure out a way how to place a munite counter for every newly added item. I need the counter to start from 0 and count every minute the item has been active. I also need the counter to reset at the end of every month and start again from 0 in the beginning of the next month.
Do you have any suggestions where I can start from?
I will appreciate any help here.
Thanks a lot!
If I were you I would store the creation date inside a database and derive the number of minutes it has been available from it. If you're going to store a counter in memory things won't scale, apart from the fact that in case of failure you would lose all information.