I've a sports application where the captain can register his team for a tournament. There can be multiple tournaments in an year and each tournament requires registration. Now, I want to support the below in registration process
If a Player has already participated in the previous tournament then the app need to reuse the existing details rather forcing the registration.
Need to make sure that a Player is not playing for two teams.
I am wondering how can we best implement the name match feature. It it makes any difference, most of the names are from Indian origin.
I am using Neo4j as the data store.
You use db4o and use unickey feature for field name in player class.
Tornament class have a (Set) field with players name (and at least a reference indexed name, date name may also be indexed).
Then with two fields : the last tournament and the registration for the next one you have for one player only one tournament.
Using SODA query you can select player with last referenced tournament, and register the others
Related
Lets suppose we have one table with column id, post_text.
And we have data in it as :
id post_text
Rent hotel Mohali near bus stop.
Hotel mohali
Rent hotel Delhi
Rent hotel Lima , lower prices.
lets suppose I want to search with word "Rent mohali" than I should get only first result.
i.e
id post_text
Rent hotel Mohali near bus stop.
because it both word rent and mohali is present in it.
#mysql, #java, #searching ,#precise search
If you're using MySQL and you'd like to use dynamic searching, you can use Full-Text feature which is more powerful than using the LIKE but be aware that you have to change the structure of you database to support searching index. Using the Full-Text, in addition to getting the result by semantic similarity, it offers more options to filter the query.
Like keyword in the other hand is not powerful and not dynamic but you don't have to change your database structure with indexes and nature language mode. If you follow that way, you have to find a way to split into multiple likes to try to find two things in one search.
I'm making a java web application for my golf society.
So far I've made all the user accounts and roles. I've made an events table in my database where a new event can be created. So far the event contains, id, name, course, date, cost and winner. Winner is null until the event has finished when a winner is entered.
I'm wanting to move on now and allow members to enter an event via the app and then a list of current entrants will be shown for each event. But I am stuck on how to go about this. I've thought about having a column in the DB for entrants, which will hold an array of people who have entered, but cannot find how to do it this way.
I have searched online for days and found nothing that helps.
Secondly once this is complete, the members who have entered would input their score for the round and this would create a leaderboard for each event.
I know this is possible as I use an app via my club which does the exact same thing, but I have spent days searching the internet but have come to a dead end.
I am using parse.com cloud storage, to implement level sharing/downloading and rating for built in level editor for my game, so players are allowed to built and test their own created levels, latter on they can share it with different players, that`s how I upload it to the parse.com cloud storage:
ParseObject testObject = new ParseObject("Levels");
testObject.put("file", new ParseFile(name + ".lvl", levelString.getBytes()));
testObject.put("author", authorName);
testObject.put("email", authorEmail);
testObject.saveInBackground();
It works fine, but I wanted to let players also rate downloaded levels (lets say 1-5 stars) it could be simple, by creating new two fields called rating and ratings count, so every time someone will vote, I would add it to ratings count and would ++ ratings count.
Problem is, how to prevent player from rating particular level multiple times? Thanks.
I have thought about this for a project of mine. In the end you will need two data points.
You need to track the counts per rank on the object (Level in your case)
You need to track UserLevelRating, at minimum a reference to the user, reference to the target (Level), and the rating given (if you will let people change ratings)
Depending on how you want to implement it, to prevent rating something twice, or to allow people to change the rating they have given something, you would do a query for the current user and the Level. If a record is returned they have already voted, so prevent them from voting again.
You could add some cloud code using before-safe or after-save logic to handle other things, such as changing the vote and updating the counts on the target (Level).
Here's a sample of the logic I would use for a simple single vote system without changing votes:
Test for existence of UserLevelRating record, if it exists prevent voting
Saving vote, include User=current user, Level=selected level, Rating=stars given
Cloud code, in after-save of UserLevelRating, looks at Level property, loads the level, calls increment on the property for the rating (e.g. if Rating=3, increment("Stars3") would be called)
Anytime you load a Level object you would have counts for each rating, and could produce the average.
I am programming a little java application but since my java skills are only 2 or 3 month old I am faced with some technical difficulties.
My problem is the following : A customer call a hotel and wants to rent a room. The employee (using the application) takes note of the customer name, phone and the dates where he will arrive and leave (that part is done). When the customer arrive to my hotel, the employee finds the reservation using the customer confirmation number. He now has an interface where he see's the available room for the selected class (economy, first class, etc.).
I want my employee to select X ammount of room, where X is the room ordered by the customer. I am using a JList to show the rooms number. The problem is I can only set the selection mode to a single or multiple lines :
myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
I read all the javadoc and tried to find an existing method to set a limit to the MULTIPLE_INTERVAL_SELECTION, but in vain.
Any suggestion?
PS. My english is not the best. I'm trying to make this as clear as possible.
I'm using Google App Engine and Objectify 3.1 and slowly learning about denormalization and designing entities based on their usage, but I'm still struggling with some aspects.
I'm currently building a system in which a User entity can participate in a Game entity and need to be able to find all games a user participates in. The way I see it, there's two basic solutions:
Solution 1)
Store a list of user keys (participantKeys) on the game and find the games a member participates in like this:
List<Key<User>> userList = new ArrayList<Key<User>>();
userList.add(new Key<User>(User.class, myUserId));
Collection<Game> games = ofy().query(Game.class).filter("participantKeys in" , userList).list();
Solution 2)
In addition to storing a participant list on the game entity, also store a list of games the user has participated in on the user entity and find the games like this:
User myUser = userDao.getUser(myUserId);
Collection<Game> games = user.getParticipatedGameKeys();
Solution 1 would become pretty slow once there's a lot of games in the system.
Solution 2 would make finding the games faster, but I'll need to constantly keep the list updated as users join and leave games.
The list of games would also become large once a user has been using the system for a long time. I only want to return all games the user is currently participating in, so that would require traversing the list and excluding "historical" games.
Am I missing a more elegant solution? Neither of the above seem very attractive.
Any and all help is greatly appreciated!
Edit:
I decided to try something like Mikl suggested after thinking about alternatives for a long time.. so it's good to hear a solution that's very pretty much exactly like it :-)
I have created a GameParticipation entity which contains a link to the game, a link to the user and all other information that I need to be able to get.
Every time a game is joined, I update the GameParticipation entity to reflect the current state of the game. When a game is left, I delete the entity. Also, when a game is changed, I update all related GameParticipation entities.
I've done a little performance testing and it seems to work reasonably well!
you can also have an another entity I don't know how you can call it (UserGame?) , but in this entity you will store the game key, the user key and also some information you want to access to, for instance the user name, the game name and so on. Then when the user enter a game you will create this entity.
With this entity you can easily retrieve the games a member participates in and also all the users that partipate to a game.
The inconvenient with this method is that, if a user property or a game property change you need to update also the information you stored in the USerGame entity like the userName.
I don't know if it's a good solution but it should work.