How does Reddit track top posts - reddit

Reddit has different buckets for Top posts. They have "This Hour", "Today", "This Week", "This Month" "This Year" "All Time". The best way I can think of to create these lists would be to save each vote with a timestamp so that you can calculate the score of a post for each bucket. This would be an expensive query but they could get away with it since Top is the same for all users and doesn't change very much so they could cache the query results.
This is just my best guess of what's going on but I'm curious, is this what Reddit is actually doing or is there a better way?

First off, "this hour", "today", "this week", etc. all refer to when the submission (link/comment) was created, not when the votes happened. I'll focus on links here, but comments are similarly processed for display on user pages.
Short answer: a bunch of cron jobs pull the relevant time period, sort the links and group them by subreddit, then store cached lists of links for quick perusal.
To elaborate, for each time period, there's a different cron job. The "top this hour" job runs much more frequently than the "top this year" job for example. The first thing each job does is pull down a list of all links from the database that were created in the time period of interest. This gets dumped out to a text file where a primitive map-reduce system processes the data. The links are grouped and sorted. The final list of results is then put into Cassandra as a simple list of link IDs which are very quick to look up in-request.
Source: https://github.com/reddit/reddit/blob/master/scripts/compute_time_listings
FWIW, individual votes do have timestamps attached to them, but they're not directly used for tracking Top.

Related

Jira JQL: how to find the busiest hours of a queue?

Jira Server v7.12.1#712002
We have noticed that at certain periods of the day there are more tickets assigned to "Operations" queue than usual, so we need to back this impression with real statistics.
We extracted all the tickets that at some point were assigned to "Operations" queue via the following query:
project = "Client Services" AND assignee WAS "Operations"
The results of the query above include the timestamp value in the "Updated" field, however this field reflects the last time the ticket was updated - not what we want. We want a timestamp which shows when the ticket arrived to "Operations" queue.
The tickets can arrive in two ways:
1) Ticket may come from other teams. In such cases, under History tab we can observe how 3 different fields change their values. For example, if ticket comes from certain Joe Smith, it would look like this:
FIELD ORIGINAL VALUE NEW VALUE
Joe Smith made changes - 09/04/2020 12:08
Assignee Joe Smith Operations
2) Ticket may be created directly (by other teams). In such cases the first 2 entries under History tab always have this pattern:
Joe Smith created issue - 02/04/2020 19:27
_______________________________________________________________________________________________________
Joe Smith made changes - 02/04/2020 19:27
FIELD ORIGINAL VALUE NEW VALUE
Link Referred from ABC-12345
The pattern above is that created issue and made changes always have the identical timestamps.
Based on these examples, is there some way to extract the timestamps of all tickets' arrival to "Operations" queue? If not with JQL, maybe some other solution/tool exists?
There can be two ways you could achieve most of what you've asked for:
Use Recently Created Chart JIRA gadget.
With this, you could get a clear picture of number of tickets that you'd get in an hour of a day.
Or you could use the Created Vs Resolved built-in JIRA report
This helps in bringing out better information from the tickets, do some analysis etc.
You could find more details from this answer on Atlassian Community forum. Hope this answer helps!

Query how many times target date changed in TFS

We're using TFS for our daily team stand ups which are more task driven vs development iterations. We'd like to be able to track how many times a target date changed & in what areas that's happening the most to see if we can pinpoint bottlnecks. I'm having a heck of a time figuring out a query that will give me these results. I tried querying "History Contains Words changed target date" (based off the image you'll see in the link below) but got no results. When I just say "history contains words date", it only gives me results where someone said the word "date" in a discussion field.
Any ideas?
Screenshot of History Item
It's an expected behavior. Comments entered into the Discussion area are queryable. Change history entries, such as which fields were changed, aren't queryable.
Check the following link for more information:
https://learn.microsoft.com/en-us/vsts/boards/queries/history-and-auditing?view=vsts&tabs=browser

Is it safe to "search" creating db records in Rails?

I need to build a search form including some fields like "city, price range, key word and date". I saw this video which is recommending to create a "searches" table. Every time any user made a search, it creates a table row in the db, and show the results depending on the submitted fields.
Seems easy to build but is it safe? I mean, if this is used in the practical world, I think we also have to use "I'm not robot" from Google.
https://www.youtube.com/watch?v=QRE7KxIvUb4&t=29s
Any idea is welcome.

Google Sheets sorting by time

So I am in charge of office hours for a class at my University. I have to send out a google form every week for the students to sign up. The way the form is sent back, the data is grouped by Name, and the times they are available are grouped by days.
To make it easier on myself, I want to group it by times. Basically, I want it so that each day/time will have its own row, and the names of the people who want the time slot would be grouped together in the adjacent column.
I already separated the groups of times so that each time has its own cell, but I cannot figure out how to regroup the data by time.
I should also mention that each session of OH is 30 minutes and that each student can only receive one session of office hours a week because of limited availability. I also need to group the sessions into blocks so that the teachers won't have idle time (basically a teacher will have office hours from 5:00-6:30 PM on Tuesday, instead of 5:00-5:30 PM and 6:00-6:30 PM on Tuesday and 8:00-8:30 PM on Thursday). Grouping the names of the people who want office hours by the times that they are available would make it a lot easier to set up that week's office hours schedule.
Here's a link to an example:
https://docs.google.com/spreadsheets/d/1fRYYNUoEcgynU9cDMoXzsyjtIir4hsRlfFYJau36a78/edit?usp=sharing
have a look at this sheet ( i have only turned on sharing temporarily, co copy this to your own drive)
Look at the "matrix choices" sheet.
I created a Matrix of students and times (which I think is better), but there is also a list of names for each timeslot on the end too.
have a play changing some of the 1's (sessions applied for) to "G" (short for Granted). Ive set up some conditional formatting and data validation.

How can I have FogBugz show me cases with no recent activity?

I have a particular saved filter that shows me all cases in a specific project and area that are active and assigned to humans (by excluding some users that don't correspond to real people but are instead used for unrelated project management operations.
It looks something like:
"All open cases in PROJECT that are active containing -assignedto:"Non-Human User 1" -assignedto:"Non-Human User 2"
I would like to amend this filter to show me the subset of these cases that have had no edits of any kind in the last two weeks. I have tried adding various flavors of the edited axis using relative time ranges as I've seen examples of in the FogBugz documentation, but I get unexpected results every time. In particular, -edited:"-2w.." or even the simpler -edited:"yesterday" shows me results where the Last Updated column says, maddeningly, "DD/MM/YYYY (Yesterday)."
(This is with FB 8, for what it's worth).
I was able to get this to work reasonably close to what I expected by adding a search axis term for edited:"..-2w" (where -2w means "two weeks ago" and could of course be changed to whatever window of time was relevant). What tripped me up is that I was trying to exclude things edited between two weeks ago and now using -edited and that didn't quite do what I expected.
Instead, my final query looks like it is grabbing things edited from the dawn of time until two weeks ago (further restricted by additional filters of course).

Resources