How to set a restriction for each phone/user on my app? [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 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.

Related

How can I know which days are occupied in my hotel management 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 15 hours ago.
Improve this question
I'm a rookie and I've been tasked with creating a hotel manager for a course I'm doing. Nothing too fancy, just some application which is handled by a receptionist and is never used by the customer. It goes like this. Some customer calls the hotel and asks the receptionist: "Hey, is there any single room available from Friday 12th to Thursday 18th?" And the receptionist checks it and makes the reservations if everything is ok.
This other question (Enter an array of objects into an Arraylist of objects and change attribute) is alike, but I'd wish for that variable "Occupied" or another Boolean variable called "Reserved" to be present every day it's reserved. Thank you in advance.

How can I limit the user to add only one item to a ResycleView per day in kotlin [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 last year.
Improve this question
is there a way to make the user add just one item per day, then get an alert saying "only one time a day"
what to use, coroutine, tasktimer, work manger ?
I will try and give a general answer.
Usually when it comes to such requirements it is good to compare the date and time of the last item that was created and the current date and time. That means you would need to store the item in a database.
The reason I'm suggesting such an approach is because a user might close your app, or the OS might put it to sleep / terminate it and all of your tasks and timers might be stopped. By having it persisted in a DB, you can always be sure your requirements are met.
For example if the requirement is 24 hours or perhaps just a calendar day (after midnight), then you would do the comparison and know if they have been met and allow the creation of new items, or not.
Additionally, it's always good to try and experiment at first. See what works and what doesn't before asking your question.
Good luck.

Efiiciency for Pagination in 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 7 years ago.
Improve this question
I am writing Pagination for a set of records in Java. Here i am talking to a service which fetches a result set of 500 per time. I interact with that service to display at most 50 records at a time with page markers.
Is it a really efficient model or if there is any other way to improve the suggested pagination model ?
Depends on your data.
If your data is rapidly changing, this definitely isn't a suitable method. I would suggest tweaking the service to return only as much requested records that are needed by the page.
If data is static and need not be time dependent, this should work fine. Just fetch the 500 records, put it in a local array and display from there. Once this is exhausted, replenish the same.

Start a minute counter for every newly added item [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 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.

controlling the number of chatroom users in xmpp server [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 9 years ago.
Improve this question
Am working on the design of a real time chat engine using xmpp server such as openfire, i want to be able to limit the number of users that can enter a chat room, 'programming room' should have only 30 people in the room the next person to enter the room, thats from 31st person up should be assigned to 'programming room-2' which will be automatically created once the number of users reaches 30, also as soon as users in programming room1 drops below 30 new users that enters programming room should be assigned to programming room1. Should i use plugin/component to achieve this.
Instead of going to hell, as suggested in your comment above, I'll provide you an approach.
Create a server-side component. Your client sends it some protocol (such as XEP-0050) and the service sends your client an invite to the correct room. If you want existing clients to be able to join, also accept a plain text message.
The component will need to join each room to keep track of the number of participants using their presence. As such, just have the component create each room as needed, before inviting any participants.

Categories