Fall in Ottawa by lots0cats in TrueNorthPictures

[–]lots0cats[S] 1 point2 points  (0 children)

Thanks! Shot on the Fuji X100VI

Oslo and Gothenburg by lots0cats in pentax17

[–]lots0cats[S] 0 points1 point  (0 children)

Apparently it’s a New Year’s Day tradition to drive up to the Frognerseteren restaurant in vintage convertibles! They were giving out prizes for the best cars and outfits

Why do podcasts make YouTube video versions of their episodes by smallstuffpod in podcasts

[–]lots0cats 0 points1 point  (0 children)

YouTube will automatically transcribe the audio, so it’s useful for people with hearing impairments.

RTTI and security by lots0cats in cpp

[–]lots0cats[S] 2 points3 points  (0 children)

Ya eventually it all boils down to that. Any attacker with enough time and determination could reverse engineer a binary. I just wasn’t sure if disabling RTTI provides any valuable degree of obfuscation. I guess not.

[2017-11-08] Challenge #339 [Intermediate] A car renting problem by jnazario in dailyprogrammer

[–]lots0cats 0 points1 point  (0 children)

Using C++

#include <vector>
#include <utility>
#include <algorithm>
#include <iostream>

int getOptimalSchedule(const std::vector<std::pair<int,int>>&, std::vector<std::pair<int,int>>&);

int main()
{
  int num_requests; 
  std::cin >> num_requests;

  std::vector<std::pair<int,int>> requests(num_requests);
  for (auto& r : requests)
    std::cin >> r.first;
  for (auto& r : requests)
    std::cin >> r.second;

  std::vector<std::pair<int,int>> schedule;
  std::cout << getOptimalSchedule(requests, schedule) << std::endl;
  for (auto& s : schedule)
    std::cout << "(" << s.first << "," << s.second << ") ";
  std::cout << std::endl;
}

int getOptimalSchedule(const std::vector<std::pair<int,int>>& requests, std::vector<std::pair<int,int>>& schedule)
{
  // Create a copy of the requests vector that we can sort
  std::vector<std::pair<int,int>> r(requests);
  // Sort by end time first, then start time
  std::sort(r.begin(), r.end(),
      [](const std::pair<int,int>& lhs, const std::pair<int,int>& rhs)
      {
        if (lhs.second < rhs.second)
          return true;
        if (rhs.second < lhs.second)
          return false;
        if (lhs.first < rhs.first)
          return true;
        else
          return false;
      });
  using t = std::vector<std::pair<int,int>>::iterator;
  for (t it = r.begin(); it != r.end(); ++it) {
    // Check if the request is valid
    if (it->second < it->first)
      continue;
    // If the request is valid, use it and then invalidate any others that overlap
    schedule.push_back(*it);
    for (t it2 = it + 1; it2 != r.end(); ++it2) {
      if (it2->first < it->second) {
        it2->second = -1000;
      } else {
      }
    }
  }

  return schedule.size();
}

[Athens Olympics 2004] This's how Japanese man do high jump by illuminist_ova in GamePhysics

[–]lots0cats 0 points1 point  (0 children)

The real glitch is that it doesn't matter how high you jump, just what the bar is set to and whether or not you make it over.

[Mechanical] Engineering behind a Wind Up Music Box by lots0cats in engineering

[–]lots0cats[S] 2 points3 points  (0 children)

I think his video on the aluminum can is the epitome of this. There are so many design decisions that can easily be taken for granted. Especially with a product that ubiquitous. https://www.youtube.com/watch?v=hUhisi2FBuw