We currently have an activity stream for things like users posting a photo, liking a post, and commenting. Everyone essentially has their own stream which I fan out to on write. I want to group similar activity stream entries together like Facebook does. E.g. "Jim, Mary and John liked your post" shows up as one entry rather than 3 entries, one for Jim, Mary and John separately.
Does that mean I shouldn't use fan-out on write anymore and would have to change my architecture? Or, should I still keep my activity streams as is and group and process entries on read? Are there things I can do to make that more efficient? What are some best practices on how to group activities together, like maybe all entries of the same type in the past day, past hour, or since last login should be grouped together?
Should I do this client-side? Should I have an auto-incrmenting incrementing group by integer for each feed item that's tied to some time period?
Related
I'm trying to simulate a movie theater. Movies start and end at specified times, no matter when a customer arrives and sits down. I want to be able to start and end the delay by time based units, kicking everyone out at the same time (once the movie is over)
I've tried googling - because I am a student and this was way too ambitious to try but I really wanted to. I'm literally hoping for any kind of insight
Select output, 4 different services (not ped), ped go to, then all same sink
I want it to work and it doesn't
Try thinking of your movie as an agent. Each movie can have its own event, which you could set to go off at a specific calendar date/time. In the action of the event, you could send a message to all your customers that they can now leave the theater...or, if your customers are in a queue with a hold block for that particular movie, you can just unblock the hold.
With movies as agents, you could have a start/end time and then create your population of movies from a database linked to Excel. That is, you would be able to set up your movie schedule outside of AnyLogic, which would probably be easier for whoever your stakeholders are.
Your question is probably too broad to answer fully in stack overflow. There are a million different ways to model a movie theater, and approach would depend on what you are trying to answer, animation requirements, your comfort level with programming, user interface requirements, etc.
So let's say I have a hospital that I'm running and I have 1 doctor and 5 patients. Patient 1 comes in, nobody is in queue so he goes first.
Next, I have 3 other patients. Bob has been waiting 3 hours. Sally has been waiting 2. Jim has been waiting 1. Based on arrival, Bob goes first, then Sally, then Jim. Like a regular queue (FIFO).
Bob goes next. During Bob's exam, Jack comes in and has an axe in his head. Jack needs immediate attention. How would I immediately stop Bob's inspection and swap over to Jack in this priority queue?
What would this look like structurally in pseudo code? Would this need some sort of timer?
I'm struggling to understand how Adaptable Priority Queues work and would like to understand the logic behind them. Not asking for code, but the thought process for this sort of thing.
Something like this:
I think what's being described is a combination of a signaling system like POSIX signals, with an actual queue/dequeue process, where you simply need to promote certain patients ahead of others at the time of dequeueing, I would guess by seriousness (triage). Maybe something like this:
SELECT patient_id
FROM wait_list
WHERE queue_status = 'awaiting service'
ORDER BY triage_code, queue_dt # queue_dt is a Date/Time
Where triage_code might have a mapping like:
1 # Very serious
3 # Serious
5 # Stable
7 # Stable Non-Serious
9 # Non-Serious
With the last group maybe vaccinations and the like. Make it sparse to give you a little growth, maybe, or just use 1-3. I've done this recently, it works well enough. Just keep a mapping of the numbers handy.
You can create a state field to inform you about the current patient treatment state that can be:
waiting
interrupted
finished
examining
...
And have a table where you register the last interrupted patient and the last patient with serious problem that you are going to examine first.
So that you can be able to track the lastly interrupted patient and call him back after you finish with the one having serious problems.
I think that can work
Capturing data in Keen.io is pretty straight-forward when it's driven by an event. (User-logged-in, Customer-bought-stuff, ...). That's very nicely explained in the docs.
But what is the best approach when I want insight on a state of my app at a given time in the past?
For instance: how many active licenses were there this time last year?
Our first thought is to run a cronjob every hour, to get those data from te DB, and store them in a custom collection. Is this the right approach, or are there better solutions?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I have a website where I've done a "mission generator" to encourage engagement. I've hard coded 3 sets of missions (Easy, Med, Hard).
Easy missions have 6-8 cases that could randomly happen
Update N times your hero (N is random number)
Update specific skill
Rest your hero for a day
etc..
Med and Hard require 1 task which is harder to achieve and adds two from the Easy tasks.
My generator works great but I would like to know how to design the reward system so that it is hard to game by the users.
The problems that I have are sort of:
The user might decide to quickly achieve the tasks and then delete them as soon as they get the "achieved badge"
For example
Update 3 times your hero
Add a new skill
Send a message to another hero
What I see as a problem is that the person might decide to update 3 times, choose a new skill and send a message, then erase the 3 updates (there is such a feature) remove the skill and delete the message that he has send.
So far I've come up with the following ideas but I'm looking for an opinion from someone who has done something like that.
- First approach:
Hard-code a table in the database with columns for each possible combination say
row1 - Updates | row2 - New skills etc...
Downside: I'm afraid that the row could end up very long and it would be hard to manage and add new types of challenges. The whole concept become very rigid.
- Second Approach:
For every task assign a unique id and once a skill or update or whatever is added append that to the task number.
Downside: every member gets 3 daily missions (which could be extended in time) if the generator requires on average 3 updates per mission that makes it to roughly 10 updates per user per day, adding to that the actual records for the updates with the data it adds up pretty quickly for a couple of thousand users. I would say 90% of this data will be useless and will just generate bills.
- Third approach:
Add a column to the table with the updates, skills (and all the other tables which are used in the missions). Then, when the user adds a new skill (for instance) the challenge ID will be added to the column in the skills table, then if the skill is removed the mission will fall back to "unachieved" (same goes for the updates and the other skills)
Downside: This might turn out very messy when the challenge is "put hero to rest for 1 day" because if the generator asks that twice between two days, the user will lose the first achievement of that sort because the challenge ID will be overwritten.
A big question is - what happens when the user decides to cut corners and delete some of their skills. I presume their missions will start piling up? (kind of like a punishment)
Try making some things more dynamic.
For example: You could put the skills in a static checkbox list on the side, and select or deselect them. Then add a button to delete the selected skill, and skills are added to the static checkbox list by selecting a skill on the page itself, outside of the checkbox list.
The skill is then added to the checkbox list as an element.
When you need to rest your character for a day, it's pretty much impossible to do that twice in one day. Make it so that the rest for a day event can only happen once in a day.
This way there is no need to worry about overwriting, and the player doesn't get confused as to why his hero needs to rest twice. Perhaps make the resting bound to a stamina bar that decreases with certain events. When you add a skill perhaps the training can cost stamina. When the stamina runs out his hero needs to rest.
About removing updates and skills:
It is not a very good idea to make things removable right after being added.
Make it so that the skills and updates can only be removed after a certain time.
Long enough to confirm the achievement and store the achievement.
Then they are able to remove their skill and updates and the achievement which was already saved won't disappear.
Sending a message to the other hero:
I have a question about that.
Why would you be able to remove the message.
Is the message sent to another player?
If so, it would make no sense to be able to remove it.
Also, sending a message obviously happens server side since it goes to another player so you can set it to done server side.
I'm thinking how and when a DCI context can be used in a Web application. I'm considering this high-level use case:
User enters city, arrival, departure, room type and clicks "Search".
System displays a list of hotels
User clicks on a Hotel logo to read its details
System displays hotel details
User clicks "Book now"
System displays payment form
User enter customer details, billing information and clicks "Submit".
System validates billing information and displays a booking confirmation.
This is very high-level and surely needs to be broken down. The first steps (1-2, 3-4, 5-6) feels like simple resource requests that could be handled with some search- and REST-architecture. So my first question is, is there a need for a DCI-context in those cases, isn't plain MVC enough? Of course a "Hotel" data entity could play a role, but would you consider it feasible, especially if it's the only actor?
The last step is where I see that DCI could be very useful, for now there is work to do in a procedural fashion. (Creating a Customer, adding a Booking to the Hotel, sending confirmation mail...)
What are your thoughts on this? Am I on the right track?
I think I would say that a context starts at step 2.
You have a list of offers that plays a part. Currently those offers are hotel offers but what's a hotel offer? they might be different things. Some might be from brokers and some might be directly from hotels those are two different types of entities but they play the same part in this context, you might have many more types some which might be contexts the self. E.g. flight and hotel combined to an offer, where in that context a hotel/broker offer and a cheap flight offer plays each a role but the the listed use case you shouldn't have to worry about this but simply make it possible for the domain to evolve independently of the use case and though the use case is book cheap hotel I'd say that the form which we are trying to capture can be expressed better (though not exact) with "find best offer"
Then when picking a specific offer I'd agree that you start a new context