• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. What have you done lately that you're proud of?

      Anything you've been working at lately and finally got it done? Anything you finally got around to finishing/starting? Anything big happening? Feel free to gush about anything you've done but want...

      Anything you've been working at lately and finally got it done? Anything you finally got around to finishing/starting? Anything big happening? Feel free to gush about anything you've done but want to talk about!

      Yesterday I decided to pick my acoustic guitar back up and learn Blackbird by The Beatles (Only mildly inspired by Kmac). Today I got it all down! Feeling super proud that I nailed a song like that so quickly after having played bass almost primarily for a while now.

      23 votes
    2. Has Wine begun to remove the need for linux software?

      I started using wine in about 2013 and I remember back then it was quite patchy and only worked on some programs/games. I used to have a rule that I stuck hard to that I would not buy any games...

      I started using wine in about 2013 and I remember back then it was quite patchy and only worked on some programs/games. I used to have a rule that I stuck hard to that I would not buy any games that did not have a linux version. But now in 2019 I have found that everything I have tried to run in wine has been so seamless and close to flawless that I hardly know its running in wine. I semi regularly buy games that only have windows version because I am mostly sure it will work and can get a refund if it doesn't.

      What does everyone else think about this?

      8 votes
    3. A system for "starred" posts on sensitive/advice topics

      This was inspired by this post. I was thinking, as a platform gets bigger we're going to end up with more situations where people are asking for advice about fairly serious stuff. In some cases,...

      This was inspired by this post.

      I was thinking, as a platform gets bigger we're going to end up with more situations where people are asking for advice about fairly serious stuff. In some cases, that advice needs to come from experts and taking guidance from any random Joe on the street can be risky/dangerous. (For the record, I don't think the post I'm referencing is an example of this, it just got me thinking about it).

      In cases like this, I think it's important that the actual good advice get some kind of clear designation that THIS is the guidance you need to take first. I notice this in communities like /r/Fitness a lot where people will post about what sound like pretty serious health concerns and you get a fair number of posts that suggest toughing it out or whatever and the more critical "You need to see a doctor" posts can kind of disappear amid the discussion. Similar things in /r/relationships where you can't always count on "This is abuse. Make arrangements to get your kids and yourself somewhere safe. . ." to be the top post.

      Even in cases where the poster themselves is smart enough to take "YOU NEED TO SEE A DOCTOR" type advice to heart, not every schmuck searching the topic on Google will. To that end, it might be good to give certain posts with good, holistic advice or by a known expert some kind of visual indicator that it deserves to be taken more seriously than other posts in the thread. It wouldn't be censoring anything really, just providing a little nudge about what ought to be consulted first or taken to heart.

      Now obviously it gets hard to decide how to give a post this attribute. It could possibly be awarded by the OP, though that has some obvious issues where the OP themselves might not be in a position to credibly vet the advice they're getting. We could also just do it through ranking by vote, which is the default paradigm. But like I said, it doesn't always work so well on Reddit. And the Exemplary tag is invisible to others, so that doesn't work either (and the post itself might not be worth giving up your "Exemplary" for the day besides). Moderators could do it, but there may not be enough and the skillset to be a Mod might not overlap with the skillset to know what advice a person needs in a particular situation.

      I don't actually have the answers. Maybe it just comes down to creating an attribute for some users to be "wisened elders" or something and empower them to star certain posts to separate good advice from bad. It would basically be a trusted user system. It's got it's own problems, but I guess we can open the floor for other ideas. Maybe it's not a real concern. Maybe it's better addressed by tinkering with the sorting of posts.

      11 votes
    4. Code Quality Tip: The importance of understanding correctness vs. accuracy.

      Preface It's not uncommon for a written piece of code to be both brief and functionality correct, yet difficult to reason about. This is especially true of recursive algorithms, which can require...

      Preface

      It's not uncommon for a written piece of code to be both brief and functionality correct, yet difficult to reason about. This is especially true of recursive algorithms, which can require some amount of simulating the algorithm mentally (or on a whiteboard) on smaller problems to try to understand the underlying logic. The more you have to perform these manual simulations, the more difficult it becomes to track what exactly is going on at any stage of computation. It's also not uncommon that these algorithms can be made easier to reason about with relatively small changes, particularly in the way you conceptualize the solution to the problem. Our goal will be to take a brief tour into what these changes might look like and why they are effective at reducing our mental overhead.


      Background

      We will consider the case of the subset sum problem, which is essentially a special case of the knapsack problem where you have a finite number of each item and each item's value is equal to its weight. In short, the problem is summarized as one of the following:

      • Given a set of numbers, is there a subset whose sum is exactly equal to some target value?

      • Given a set of numbers, what is the subset whose sum is the closest to some target value without exceeding it?

      For example, given the set of numbers {1, 3, 3, 5} and a target value of 9, the answer for both of those questions is {1, 3, 5} because the sum of those numbers is 9. For a target value of 10, however, the first question has no solution because no combination of numbers in the set {1, 3, 3, 5} produces a total of 10, but the second question produces a solution of {1, 3, 5} because 9 is the closest value to 10 that those numbers can produce without going over.


      A Greedy Example

      We'll stick to the much simpler case of finding an exact match to our target value so we don't have to track what the highest value found so far is. To make things even simpler, we'll consider the case where all numbers are positive, non-zero integers. This problem can be solved with some naive recursion--simply try all combinations until either a solution is found or all combinations have been exhausted. While more efficient solutions exist, naive recursion is the easiest to conceptualize.

      An initial assessment of the problem seems simple enough. Our solution is defined as the set of array elements whose total is equal to our target value. To achieve this, we loop through each of the elements in the array, try combinations with all of the remaining elements, and keep track of what the current total is so we can compare it to our target. If we find an exact match, we return an array containing the matching elements, otherwise we return nothing. This gives us something like the following:

      function subsetSum($target_sum, $values, $total = 0) {
          // Base case: a total exceeding our target sum is a failure.
          if($total > $target_sum) {
              return null;
          }
      
          // Base case: a total matching our target sum means we've found a match.
          if($total == $target_sum) {
              return array();
          }
      
          foreach($values as $index=>$value) {
              // Recursive case: try combining the current array element with the remaining elements.
              $result = subsetSum($target_sum, array_slice($values, $index + 1), $total + $value);
      
              if(!is_null($result)) {
                  return array_merge(array($value), $result);
              }
          }
      
          return null;
      }
      

      Your Scope is Leaking

      This solution works. It's functionally correct and will produce a valid result every single time. From a purely functional perspective, nothing is wrong with it at all; however, it's not easy to follow what's going on despite how short the code is. If we look closely, we can tell that there are a few major problems:

      • It's not obvious at first glance whether or not the programmer is expected to provide the third argument. While a default value is provided, it's not clear if this value is only a default that should be overridden or if the value should be left untouched. This ambiguity means relying on documentation to explain the intention of the third argument, which may still be ignored by an inattentive developer.

      • The base case where a failure occurs, i.e. when the accumulated total exceeds the target sum, occurs one stack frame further into the recursion than when the total has been incremented. This forces us to consider not only the current iteration of recursion, but one additional iteration deeper in order to track the flow of execution. Ideally an iteration of recursion should be conceptually isolated from any other, limiting our mental scope to only the current iteration.

      • We're propagating an accumulating total that starts from 0 and increments toward our target value, forcing us to to track two different values simultaneously. Ideally we would only track one value if possible. If we can manage that, then the ambiguity of the third argument will be eliminated along with the argument itself.

      Overall, the amount of code that the programmer needs to look at and the amount of branching they need to follow manually is excessive. The function is only 22 lines long, including whitespace and comments, and yet the amount of effort it takes to ensure you're understanding the flow of execution correctly is pretty significant. This is a pretty good indicator that we probably did something wrong. Something so simple and short shouldn't take so much effort to understand.


      Patching the Leak

      Now that we've assessed the problems, we can see that our original solution isn't going to cut it. We have a couple of ways we could approach fixing our function: we can either attempt to translate the abstract problems into tangible solutions or we can modify the way we've conceptualized the solution. With that in mind, let's take a second crack at this problem by trying the latter.

      We've tried taking a look at this problem from a top-down perspective: "given a target value, are there any elements that produce a sum exactly equal to it?" Clearly this perspective failed us. Instead, let's try flipping the equation: "given an array element, can it be summed with others to produce the target value?"

      This fundamentally changes the way we can think about the problem. Previously we were hung up on the idea of keeping track of the current total sum of the elements we've encountered so far, but that approach is incompatible with the way we're thinking of this problem now. Rather than incrementing a total, we now find ourselves having to do something entirely different: if we want to know if a given array element is part of the solution, we need to first subtract the element from the problem and find out if the smaller problem has a solution. That is, to find if the element 3 is part of the solution for the target sum of 8, then we're really asking if 3 + solutionFor(5) is valid.

      The new solution therefore involves looping over our array elements just as before, but this time we check if there is a solution for the target sum minus the current array element:

      function subsetSum($target_sum, $values) {
          // Base case: the solution to the target sum of 0 is the empty set.
          if($target_sum === 0) {
              return array();
          }
      
          foreach($values as $index=>$value) {
              // Base case: any element larger than our target sum cannot be part of the solution.
              if($value > $target_sum) {
                  continue;
              }
      
              // Recursive case: do the remaining elements create a solution for the sub-problem?
              $result = subsetSum($target_sum - $value, array_slice($values, $index + 1));
      
              if(!is_null($result)) {
                  return array_merge(array($value), $result);
              }
          }
      
          return null;
      }
      

      A Brief Review

      With the changes now in place, let's compare our two functions and, more importantly, compare our new function to the problems we assessed with the original. A few brief points:

      • Both functions are the same exact length, being only 22 lines long with the same number of comments and an identical amount of whitespace.

      • Both functions touch the same number of elements and produce the same output given the same input. Apart from a change in execution order of a base case, functionality is nearly identical.

      • The new function no longer requires thinking about the scope of next iteration of recursion to determine whether or not an array element is included in the result set. The base case for exceeding the target sum now occurs prior to recursion, keeping the scope of the value comparison nearest where those values are defined.

      • The new function no longer uses a third accumulator argument, reducing the number of values to be tracked and removing the issue of ambiguity with whether or not to include the third argument in top-level calls.

      • The new function is now defined in terms of finding the solutions to increasingly smaller target sums, making it easier to determine functional correctness.

      Considering all of the above, we can confidently state that the second function is easier to follow, easier to verify functional correctness for, and less confusing for anyone who needs to use it. Although the two functions are nearly identical, the second version is clearly and objectively better than the original. This is because despite both being functionally correct, the first function does a poor job at accurately defining the problem it's solving while the second function is clear and accurate in its definition.

      Correct code isn't necessarily accurate code. Anyone can write code that works, but writing code that accurately defines a problem can mean the difference between understanding what you're looking at, and being completely bewildered at how, or even why, your code works in the first place.


      Final Thoughts

      Accurately defining a problem in code isn't easy. Sometimes you'll get it right, but more often than not you'll get it wrong on the first go, and it's only after you've had some distance from you original solution that you realize that you should've done things differently. Despite that, understanding the difference between functional correctness and accuracy gives you the opportunity to watch for obvious inaccuracies and keep them to a minimum.

      In the end, even functionally correct, inaccurate code is worth more than no code at all. No amount of theory is a replacement for practical experience. The only way to get better is to mess up, assess why you messed up, and make things just a little bit better the next time around. Theory just makes that a little easier.

      17 votes
    5. Reddit has quarantined /r/The_Donald

      Just happened minutes ago, so not much information yet. I think it's likely that this article from Monday might have finally pushed it over the edge (since it's usually media attention that does...

      Just happened minutes ago, so not much information yet.

      I think it's likely that this article from Monday might have finally pushed it over the edge (since it's usually media attention that does it): You can’t offer to murder cops on Reddit unless you’re on r/TheDonald

      The quarantine message says:

      It is restricted due to significant issues with reporting and addressing violations of the Reddit Content Policy. Most recently the violations have included threats of violence against police and public officials.

      As a visitor or member, you can help moderators maintain the community by reporting and downvoting rule-breaking content.

      Here's the message the admins sent them:

      Dear Mods,

      We want to let you know that your community has been quarantined, as outlined in Reddit’s Content Policy.

      The reason for the quarantine is that over the last few months we have observed repeated rule-breaking behavior in your community and an over-reliance on Reddit admins to manage users and remove posts that violate our content policy, including content that encourages or incites violence. Most recently, we have observed this behavior in the form of encouragement of violence towards police officers and public officials in Oregon. This is not only in violation of our site-wide policies, but also your own community rules (rule #9). You can find violating content that we removed in your mod logs.

      As we have discussed in the past, and as detailed in our content policy and moderator guidelines, we expect you to enforce against rule-breaking content. You’ve made progress over the last year, but we continue to observe and take action on a disproportionate amount of rule-breaking behavior in this community. We recognize that you do remove posts that are reported, but we are troubled that violent content more often goes unreported, and worse, is upvoted.

      User reports and downvotes are an essential way that Reddit functions to moderate content. Limiting or prohibiting them prevents you from moderating your community effectively. Because of this, we are disabling your custom styling in order to restore these essential functions.

      As stated in our Moderator Guidelines, our goal is to keep the platform alive and vibrant, as well as to ensure your community can reach people interested in it. Accordingly, here are the specific terms of the quarantine and the next steps we are asking from you as a mod team to resolve this situation.

      Quarantine terms:

      Visitors to this community will see a warning that requires users to explicitly opt-in to viewing it. This messaging reminds users of the importance of reporting rule-breaking content.

      Custom styling has been disabled to restore the report and downvote buttons.

      We hope both these changes will help improve the signal around rule-breaking content and improve your ability to effectively address it.

      Next steps:

      You unambiguously communicate to your subscribers that violent content is unacceptable.

      You communicate to your users that reporting is a core function of Reddit and is essential to maintaining the health and viability of the community.

      Following that, we will continue to monitor your community, specifically looking at report rate and for patterns of rule-violating content.

      Undertake any other actions you determine to reduce the amount of rule-violating content.

      Following these changes, we will consider an appeal to lift the quarantine, in line with the process outlined here.

      We hope that this process provides a viable way forward to restore the health of the community. However, if this situation continues to escalate, we will explore further actions, including the possible banning of your community.

      Please confirm that you have received and understand this message.

      109 votes
    6. What are some of your favorite examples of storytelling via gameplay?

      Video game's approach to storytelling usually comprise of mixing gameplay mechanics (gunplay, health system, enemy AI...) and storytelling elements (cutscenes, dialogue trees, environment...

      Video game's approach to storytelling usually comprise of mixing gameplay mechanics (gunplay, health system, enemy AI...) and storytelling elements (cutscenes, dialogue trees, environment details...). There are also special systems designed to work both as gameplay challenge as well as narrative carriers (quick time events, the nemesis system in Shadow of War...)

      However, there's also a third approach, where traditional gameplay elements when put into appropriate context within the game gain additional narrative significance (the way Thomas was Alone's basic platforming mechanics are personified via narration, or Undertale's combat system being integral to how the story develops...)

      Have you ever noticed if a gameplay element also doubled as a storytelling device in the games you played before? If so, what was it and what did it "tell" you?

      12 votes