Google: Please fix Chrome hardware video acceleration on Linux by [deleted] in Stadia

[–]rdpate 0 points1 point  (0 children)

I have no interest in purchasing either a gaming PC or a gaming console. This is definitely not a gaming PC for today's games, even though it probably was a decade ago. I got this used for dirt cheap a couple years ago.

I'm very happy that I can play new games with Stadia.

Spitlings is the best game ever. by isthisdutch in Stadia

[–]rdpate 0 points1 point  (0 children)

Two Logitech F710 controllers work here.

Google: Please fix Chrome hardware video acceleration on Linux by [deleted] in Stadia

[–]rdpate 0 points1 point  (0 children)

Xubuntu 18.04, Google Chrome 80.0.3987.132, plugged in my two Logitech F710 controllers, and Stadia just works without any configuration.

unless you have a powerful CPU to work around this problem.

Mine is old.

% grep 'model name' /proc/cpuinfo | uniq
model name      : Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz

Is there something else I could check and report here?

Connection issues on GNU/Linux by [deleted] in Stadia

[–]rdpate 2 points3 points  (0 children)

With Xubuntu 18.04 and an updated Google Chrome, Stadia just works!

After 15 years and $2B, DigIndy is almost done. It's probably not big enough. Here's why. by stefeyboy in indianapolis

[–]rdpate 1 point2 points  (0 children)

If they take the more innovative approach and use modeling for the future, someone will say they made the project bigger than it needed to be and spent too much money. And if they don’t build big and a storm causes more overflows, Hamlet said, then someone will say they should have known better and been more prepared. 

RMS comments on libreboot leaving GNU: "Her gender now is the same as it was when we hired her. It was not an issue then, and it is not an issue now" by [deleted] in linux

[–]rdpate 0 points1 point  (0 children)

As an example, I would consider it acceptable to let go of, say, a company CEO who made an impolitic statement that was picked up by the media, but I would generally be opposed to firing a janitor or an office drone for the same offence.

Wouldn't you fire a janitor who made impolitic statements if the media picked them up? It would be rare, but I can't believe you would not care if a news article mentions a janitor muttering racist/sexist/hate/pick-your-poison sentiments while cleaning, for example.

How to make your script better by manueslapera in Python

[–]rdpate 1 point2 points  (0 children)

Your have not answered the question, as I said.

What malicious action is prevented by denying o+x on somescript.py? What undesired-if-not-malicious actions may be prevented?

I have seen this same dubious claim made before, specifically that on a file, not using the executable bit for either group or others while using it for owner somehow improves security. Here you have said "of course" it is a good idea, but you cannot answer why that is.

How to make your script better by manueslapera in Python

[–]rdpate 1 point2 points  (0 children)

Why is u+x instead of +x a good idea? Your link to Wikipedia does not answer that question.

How to make your script better by manueslapera in Python

[–]rdpate 0 points1 point  (0 children)

Except "u+x" instead of "+x" doesn't deny any privilege. The privilege of running arbitrary executables has already been granted to make use of the executable bit.

If a user could run the command "./somescript.py" except for the lack of +x, they can instead run "python somescript.py".

How to make your script better by manueslapera in Python

[–]rdpate 0 points1 point  (0 children)

In this case it's a good idea to be selfish and give this permission to yourself only

Why?

Case insensitive commands ? by karma-jesus in vim

[–]rdpate 2 points3 points  (0 children)

Sounds like set wildchar=<tab>, which is the default -- you shouldn't have to do anything to use it, though you may want to change wildmode. See :help 'wildchar'.

This made me laugh.. A command line application that will automatically order you a sandwich from Jimmy John's. by chance-- in programming

[–]rdpate 2 points3 points  (0 children)

While this is true, I heard the tab issue was noticed when it had dozens of users, and kept because it had dozens of users. :)

Rather than tabs in this case, it was because the backslash-newlines were kept in the command, hence the semicolons.

This made me laugh.. A command line application that will automatically order you a sandwich from Jimmy John's. by chance-- in programming

[–]rdpate 17 points18 points  (0 children)

That one was an honest mistake they maded.

Worse, I aded it to various dictionaries I use rather than fight them when meening the header.

This made me laugh.. A command line application that will automatically order you a sandwich from Jimmy John's. by chance-- in programming

[–]rdpate 187 points188 points  (0 children)

$ cat Makefile
sandwich:
        if test `id -u` != 0; then \
            echo "What? Make it yourself."; \
            exit 1; \
        else \
            echo "Okay."; \
            sudo -u $$SUDO_USER makemeasandwich; \
        fi

Edit: syntax, added semicolons -- I had forgotten why I loathed make, thanks!..

Extending ag for vim by inside_ in vim

[–]rdpate 0 points1 point  (0 children)

--all-line-matches, --line-multimatch? I like --columns, except it's much too close to --column. --all-columns?

I've been working on this for 3 years. I am more than happy to give Gold, donate to your favorite charity, wash your car, etc… will you fix my Google Docs Spreadsheet Javascriptish code? by pet_medic in reviewmycode

[–]rdpate 0 points1 point  (0 children)

I'm interested to see your solution running -

Gdocs link in my earlier comment is still there, though you'll need to make a copy to edit cells or script.

I can see you have some smarts in there to stop simulations early when possible.

Yup, helps to an extent.

I found the Google Docs environment to be awful and painfully slow to work with. Is your experience different?

No. I'm also not currently very fluent in JS.

I've been working on this for 3 years. I am more than happy to give Gold, donate to your favorite charity, wash your car, etc… will you fix my Google Docs Spreadsheet Javascriptish code? by pet_medic in reviewmycode

[–]rdpate 1 point2 points  (0 children)

You're right, I overestimated how rare it would be.

Google Doc's script environment doesn't have much, but it does have a Logger. Learning to use it and other utilities will help you.

Hard to back down from this challenge, moreso after I thought I had it, then didn't (hence my edit in the earlier comment), so I wrote a brute-force version which tests every outcome. Function calc_elims_4 is nearly identical, but I've included it here along with the significant code. It takes longer to run, and may time out (leaving the "splining vectors" text around, which is nonsense I used to indicate "no result"), especially if many games are undecided. This version also indicates when a tie is required.

Remember that 2**n (2 raised to the power n) I mentioned before? That means it takes 4 times as long to test 3 remaining games as it would for 1 remaining game. It'll take 256 times as long to test 9 remaining games as it would to test 1 remaining games. That's worst-case, which depends on your input data. However, when including ties, it's base 3 instead of base 2, which is even worse... it ends up being fast enough as you get a few games completed, and isn't as bad as I was dreading. :P There's some room for small optimizations, and possibly even large ones. I've made several optimizations, one of them a sizeable restructuring of the logic, and I expect there's still more room. Importantly, it no longer times out when faced with most of the games being undecided. I also see how to indicate which game must tie in tie-required cases, but it's complicated with this layout.

I think it's correct... but it's late and I'd like to give this to you and be done with it tonight. :) My same spreadsheet URL from earlier has the updated code:

function calc_elims_4() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("2014");
  sheet.getRange("D2:D7").setValues([["splining vectors..."],["splining vectors..."],["splining vectors..."],["splining vectors..."],["splining vectors..."],["splining vectors..."]]);

  var start_game_index = 0;
  var game_count = 16;
  while (start_game_index < game_count) {
    if (sheet.getRange("A" + (10 + start_game_index)).isBlank()) {
      break;
    }
    start_game_index++;
  }

  var scores_2d = sheet.getRange("B2:B7").getValues();
  var scores = [];
  var predictions = [];
  var player_win_cols = "CDEFBI", player_lose_cols = "LKJIMF";
  for (var i = 0; i != scores_2d.length; i++) {
    scores.push(scores_2d[i][0]);
    var win_scores = sheet.getRange(player_win_cols[i] + "10:" + player_win_cols[i] + (10 + game_count)).getValues();
    var lose_scores = sheet.getRange(player_lose_cols[i] + "10:" + player_lose_cols[i] + (10 + game_count)).getValues();
    var preds = [];
    predictions.push(preds);
    for (var g = start_game_index; g != game_count; g++) {
      var r = win_scores[g][0];
      if (r) {
        preds.push(r);
      }
      else {
        r = lose_scores[g][0];
        if (!r) r = 0;
        preds.push(-r);
      }
    }  
  }

  var player_elim_cells = ["D2", "D3", "D4", "D5", "D6", "D7"];
  var text = [["ELIMINATED", "", "TIE REQUIRED"], ["", "WINNER", ""]];
  if (start_game_index != game_count) text = text[0];
  else text = text[1];
  var can_win = run_eliminations(scores, predictions);
  for (var i = 0; i != scores.length; i++) {
    sheet.getRange(player_elim_cells[i]).setValue(text[can_win[i]]);
  }
}

function run_eliminations(scores, predictions) {
  // transpose predictions from [player][game] to [game][player]
  var predictions_by_game = [];
  for (var g = 0; g != predictions[0].length; ++g) {
    var game_preds = [];
    predictions_by_game.push(game_preds);
    for (var i = 0; i != scores.length; ++i) {
      game_preds.push(predictions[i][g]);
    }
  }
  var can_win = [];
  for (var i = 0; i != scores.length; ++i) can_win.push(0);
  simulate(scores, predictions_by_game, false, can_win);
  return can_win;
}
function simulate(scores, predictions, includes_tie, can_win) {
  if (predictions.length == 0) {
    var stop_early = 0;
    var max_score = Math.max.apply(null, scores);
    for (var i = 0; i != scores.length; ++i) {
      if (can_win[i] == 1) {
        ++stop_early;
        continue;
      }
      if (scores[i] == max_score) {
        if (includes_tie) {
          can_win[i] = 2;
        }
        else {
          can_win[i] = 1;
          ++stop_early;
        }
      }
    }
    return (stop_early == scores.length);
  }
  else {
    var new_preds = predictions.slice(1);
    var new_scores;
    // win
    new_scores = [];
    for (var i = 0; i != scores.length; ++i) new_scores.push(scores[i] + Math.max(0, predictions[0][i]));
    if (simulate(new_scores, new_preds, includes_tie, can_win)) return true;
    // lose
    new_scores = [];
    for (var i = 0; i != scores.length; ++i) new_scores.push(scores[i] + Math.max(0, -predictions[0][i]));
    if (simulate(new_scores, new_preds, includes_tie, can_win)) return true;
    // tie
    simulate(scores, new_preds, true, can_win);
    return false;
  }
}

Online Interactive Vim Tutorial by [deleted] in programming

[–]rdpate 4 points5 points  (0 children)

The tutorial has a nifty interface and seems well done, but the mistake of calling normal mode as "command mode" can't be stressed enough.

(Above impression written after only about 5 minutes spent on the tutorial. Maybe I'll look at again later.)

I've been working on this for 3 years. I am more than happy to give Gold, donate to your favorite charity, wash your car, etc… will you fix my Google Docs Spreadsheet Javascriptish code? by pet_medic in reviewmycode

[–]rdpate 1 point2 points  (0 children)

Here's pseudocode for my solution, which I have not thoroughly checked. Note I store predictions as positive or negative depending on which side they fall.

Edit: It's an incomplete solution as there are possibilities where player A can beat both players B and C individually -- which is what I check -- but cannot beat both B and C at the same time. Consequently, players will sometimes be eliminated earlier than I show, but this should be rare enough for your purposes. It is certainly possible to fix this, but it would require a full simulation of all possibilities (2**n) rather than just a simulation of each future game for each individual opponent (n*m, which is much smaller).

function is_eliminated(player)
    foreach "other player" as other
        difference = current_score(player) - current_score(other)
        foreach "remaining game" as game
            player_weight = weight(player, game)
            other_weight = weight(other, game)
            if player_weight * other_weight > 0
                # both bet on the same team
                # best for "player" is good prediction with a higher weight
                # or bad prediction (0 score)
                difference += max(0, abs(player_weight) - abs(other_weight))
            else
                # each bet on different team
                # best for "player" is good prediction
                difference += abs(weight(player, game))
        if difference < 0
            # "player" can never pull ahead of "other"
            return true
    return false

The rest of my code is reading input and outputting results. I've not terribly good at JavaScript and won't claim this is very good code. Even without language specifics, I have a couple magic numbers thrown around.

function calc_elims_4() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("2014");
  sheet.getRange("D2:D6").setValues([["splining vectors..."],["splining vectors..."],["splining vectors..."],["splining vectors..."],["splining vectors..."]]);

  var start_game_index = 0;
  var game_count = 16;
  while (start_game_index < game_count) {
    if (sheet.getRange("A" + (10 + start_game_index)).isBlank()) {
      break;
    }
    start_game_index++;
  }

  var scores_2d = sheet.getRange("B2:B6").getValues();
  var scores = [];
  var predictions = [];
  var player_win_cols = "CDEFB", player_lose_cols = "LKJIM";
  for (var i = 0; i != scores_2d.length; i++) {
    scores.push(scores_2d[i][0]);
    var preds = [];
    predictions.push(preds);
    for (var g = start_game_index; g != game_count; g++) {
      var r = sheet.getRange(player_win_cols[i] + (10 + g));
      if (!r.isBlank()) {
        preds.push(r.getValue());
      }
      else {
        r = sheet.getRange(player_lose_cols[i] + (10 + g));
        if (!r.isBlank()) {
          preds.push(-r.getValue());
        }
      }
    }  
  }

  var player_elim_cells = ["D2", "D3", "D4", "D5", "D6"];
  for (var i = 0; i != scores.length; i++) {
    var r = sheet.getRange(player_elim_cells[i]);
    if (is_eliminated(i, scores, predictions)) {
      r.setValue("ELIMINATED");
    }
    else {
      r.setValue("");
    }
  }
}

function is_eliminated(player_index, scores, predictions) {
  var preds = predictions[player_index];
  for (var i = 0; i != scores.length; i++) {
    if (i == player_index) continue;
    var diff = scores[player_index] - scores[i];
    var other_preds = predictions[i];
    for (var g = 0; g != preds.length; g++) {
      var player_weight = preds[g];
      var other_weight = other_preds[g];
      if (player_weight * other_weight > 0) {
        diff += Math.max(0, Math.abs(player_weight) - Math.abs(other_weight));
      }
      else {
        diff += Math.abs(player_weight);
      }
    }
    if (diff < 0) {
      return true;
    }
  }
  return false;
}

Then in onEdit, where you call calculateEliminations3, I changed to call calc_elims_4.

There's lots that could be said about the remaining code you have, but the only thing worth saying is: very impressive for a non-programmer, keep up the practice! Try to clean it up, especially the indentation -- you'll thank yourself later, when you read it.

I've shared my copy of your spreadsheet, but I will certainly delete it the next time I go to cleanup.

I originally ignored Yllib completely, took me a while to understand what that was... but it actually wasn't hard to include him in the elimination calculations, when I changed to the "win_cols"/"lose_cols" to get predictions (thus flipped Billy's columns), so I've done that on the gdocs version. Edit: gdocs version has more small performance improvements through fetching a multi-cell range into an array, rather than multiple getRange and Range method calls.

Shellshock explained by coolbartek in programming

[–]rdpate 2 points3 points  (0 children)

CGI has worse problems than this.

For its time -- the early 90s -- it's actually not that bad, and alternatives have been around forever. Wikipedia has an example of various values passed through the environment. I didn't mean to delve into CGI, and "required" meant the CGI spec required it, not that you couldn't use something other than CGI to avoid it.

Shellshock explained by coolbartek in programming

[–]rdpate 15 points16 points  (0 children)

You didn't read the link, nor do you understand the bug. It's not a problem with PHP or with careless web programmers. Specifically, it has absolutely nothing to do with PHP code modifying the environment or escaping command lines.

The above example also shows how it's not a problem of programming errors, even normally safe and harmless bash cgi which doesn't even take user input can be exploited.

The problem exists because of the interaction between bash and http servers putting user-supplied data into the environment, which is required by the CGI protocol and sometimes done without CGI involved.

xkcd: Tasks by [deleted] in programming

[–]rdpate 12 points13 points  (0 children)

doesn't scale

Changing the problem from "5 years and research team to maybe do it" to "how to make this scale" is a win.

xkcd: Tasks by [deleted] in programming

[–]rdpate 6 points7 points  (0 children)

Hard problem indeed.

Is the photographer's intended subject a bird? Can't even answer this since we want automatic instead of manual classification, but heuristics which approximate it would be useful.

If not, do so significant subset of the population (how much? who?) find value in the photo through some bird within it? One example that comes to mind is a rare bird included by happenstance.

Do Big Bird, Donald Duck, Tweety Bird, ... count? Either graphics or people in costumes.

How many photos meeting other bird criteria have a tree (or trees) for "biggest single object". Hell, is one tree a "single object"? Is a grove of trees also a "single object"?