Sending an email at a specific time using spring boot [closed] - java

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
in the application I am developing I can specify an expiration date of a license and now I want to create an a java spring boot api that can send an email to a specific email before a specific time period (the user can choose the time period). The purpose of the email is to notify the user that his license is about to end.
For example:
The user chooses an expiration date of 3/8/2023 and chooses to be notified 3 months before the expiration date chosen. An email gets sent to the user's email on 3/5/2023 notifying the user that the license is about to end.
Any help is highly appreciated.

You need to store the info in database. So that your system knows when to send the email. For ex, having two columns in a table like send_notif_date, send_to_user.
write a job(you can use Quartz for this) which will pick all details of user for which we need to send the emails based on if today equalsTo send_notif_date

Related

How to keep user input even after rerunning the program (JAVA) [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 1 year ago.
This post was edited and submitted for review 9 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I only started coding about a month ago and I am trying to add a code or program to my work in order to make it store user input and even after rerunning the program, the input will still be kept. Confused? For example, when you make an account on Facebook, they will keep your email and password so next time you just have to login without making the account again. Something like a database to store value I am guessing?
When a program terminates, it looses all the values stored in variables.
This is because we have a GC (Garbage Collection) mechanism which helps to clear up data which are not used.
In your case, to persist data post restart, we need to store to some external store (persistent storage) rather than keeping in the memory.
Your external store can be a database or can be a simple file.
Create a file and store your values in it. Once you restart the program, read the values again from it.
You would require a storage to store the data, as rerunning will erase all previous data. Any filesystem/db can be used to resolve your issue.

Add a 5 minutes Countdown timer to a quiz website developed in spring boot [closed]

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 1 year ago.
Improve this question
I need to implement a countdown timer for a quiz in a Spring boot webApp.I tried to implement it using JS but every time the user clicks on the next question button the timer resets. the timer must be of five minutes and at 00:00 the quiz must be auto-submitted.
In past I have implemented something similar, It was for learning purpose. On server-side I have created cookie for user and session, then I have stored start time in session for this user. So refreshing website would just pick up start time from user session kept on server. As for auto-submit functionality, you would need to implement It on the frontend side. Using JS you can check whether time has reached 00:00, and run function that performs submit.

Prevent duplicate entries in column using hibernate [closed]

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 6 years ago.
Improve this question
I am trying to make a login system for my app using web-service,hibernate and MySql.What I am trying to do is to make separate column for phone number and email id provided by the user.I want my system to work with both the options available,I mean my login system should work for email id and as well as phone no.If my user wants to login with phone number or email id,in both way it should work.But I don't know how to make both of them unique to prevent duplicate entries.If I am using primary key it is working only with one column.I want both of them to be unique for each user registration.
If I understood what you are asking I think you can annotate the both attributes with:
#Column(unique = true)
It will make your attributes unique, so you will ensure that the data won't be duplicated.

basic user account lockout system [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've currently got a system with a user account and login system. I'm trying to implement a "lockout" function, so that after 3 incorrect password attempts, the user is locked out. Currently this only involves a popup window, and simply warns the user instead of locking them out. I'm trying to find a good way to do this, based around a timeout so after a set amount of time the user can try to access their account again.
One idea I have is to write the time of lockout to a text file, and then have the system check for the previous lockout time from this text file and allow login if enough time has elapsed, however this seems to be an inelegant way to solve this.
Is there any other ways that this could be done? thanks
Usually, you'll use a database with fields like
id
username
password
failedAttempts (int)
lastFailed (date)
lastLogin (date)
When they fail to login, you increment failedAttempts and save the time in lastFailed.
Then on login, you check if (failedAttempts < threshold) or ((now - lastFailed) > timeThreshold).
On login you reset failedAttempts = 0, and lastFailed = null

How would you design a twitter like message system, how to design the messaging system? [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 8 years ago.
Improve this question
If you were to create an application like twitter, how would you go about designing the messaging system?
Specifically look for ideas on the basic data model, and how you would write the method that takes the user's tweet and then sends it out to all its followers?
example:
Tweets ( tweetID, userID, message, datesend)
User (userID, ...)
Followers(userID, followerUserID)
Inbox(userID, tweetID)
is the above model a good starting point?
Would you first insert the tweet, then push a message to the queue. Then one-by-one, take a message off the queue and push the message to its subscribers?
(I am ignoring the mobile functionality of twitter, just focussing on the web based functionality, but I thought of using a queue from the start so one could add other functionality later)
The High Scalability blog has a number of articles on twitter and it's infrastructure and changes over time that might interest you.
I don't think twitter uses a message queue (inbox in your data model.) I think in twitter everything is done via date. Thus each user has a "last viewed date" and the inbox/message queue is created by looking for all subscribed tweets after that last viewed date.
So to modify your data model, remove inbox and add in a last view date column to user.
Also I would expect that follower information is not stored as who follows a user but instead as which users a give user is following. Of course it could be stored both ways but that seems to make more sense to me.

Categories

Resources