The Results of the Expressive C++17 Coding Challenge | Fluent{C++}

Jonathan Boccara; The Results of the Expressive C++17 Coding Challenge; In His Blog entitled Fluent{C++}; 2017-10-23.

Mentions

Winner:

Fernando B. Giannasi,

honorifics
  • Brazil (lives in, citizen of)
Humblebrags
  • [He's] not […] a professional programmer.
  • Wasn’t even trying
  • One hand tied behind his back,
  • etc.…

Neat code tho.

Problem Statement

A command line tool that takes in a CSV file, overwrites all the data of a given column by a given value, and outputs the results into a new CSV file. Accept the following arguments:

  • the filename of a CSV file,
  • the name of the column to overwrite in that file,
  • the string that will be used as a replacement for that column,
  • the filename where the output will be written.

Details & clarifications in the post.

Referenced

Previously

In His Blog

Actuality

g++ -std=c++1z -O2 -Wall -pedantic -pthread main.cpp -lstdc++fs && ./a.out
Bad arguments
Usage: ./a.out [IN_FILE] [COLUMN] [NEW_VALUE] [OUT_FILE]
bash: line 7: 31459 Aborted                 (core dumped) ./a.out

Exhibited at coliru

Source

/* Name: Fernando B. Giannasi
 * Email: phoemur@gmail.com
 *
 * Features of C++17 used:
 * - std::filesystem
 * - nodiscard and noreturn attributes
 * - structured bindings
 * - string_view
 * - Template argument deduction for class templates
 * - Init-statement for if/switch
 * - std::optional
 */
#include <algorithm>
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
#include <optional>
#include <string>
#include <string_view>
#include <sstream>
#include <utility>
#include <vector>

using namespace std;
namespace fs = std::experimental::filesystem;

[[nodiscard]] auto split_string(const string_view& input, const char delimiter) {
  stringstream ss {input.data()};
  vector<string> result;
  // result.reserve(count(begin(input), end(input), delimiter));
  for (string buffer; getline(ss, buffer, delimiter); /*empty*/) {
    result.push_back(move(buffer));
  }
  return result;
}

[[nodiscard]] optional<int> get_target_column(ifstream& input, const string_view& label, const char delimiter) {
  string first_line;
  // if-init
  if (getline(input, first_line); first_line.size() == 0) {
    throw runtime_error("Input file missing");
  }
  input.seekg(0);
  auto tokens = split_string(first_line, delimiter);
  if (auto it = find(begin(tokens), end(tokens), label); it == tokens.end()) {
    return {}; //return empty optional
  } else {
    return distance(begin(tokens), it);
  }
}

[[nodiscard]] auto get_file_handlers(const string_view& input, const string_view& output) {
  ifstream in_file{input.data(), ios::in};
  if (!in_file.is_open()) {
    throw runtime_error("Unable to open input file");
  }
  ofstream out_file{output.data(), ios::out | ios::trunc};
  if (!out_file.is_open()) {
    throw runtime_error("Unable to open output file");
  }
  // template argument deduction for class templates (no make_pair)
  return pair(move(in_file), move(out_file));
}

void do_work(ifstream& input, ofstream& output, int target_index, const string_view& new_value, const char delimiter) {
  string buffer;
  getline(input, buffer); // for the header line
  output << buffer << endl;
  while (getline(input, buffer)) {
    auto tokens = split_string(buffer, delimiter);
    tokens[target_index] = new_value.data();
    for (auto& i: tokens) {
      output << i;
      output << (i == tokens.back() ? 'n':delimiter);
    }
  }
}

[[noreturn]] void usage_terminate(const string_view& progname) noexcept {
  cout << "Usage: " << progname << " [IN_FILE] [COLUMN] [NEW_VALUE] [OUT_FILE]" << endl;
  abort();
}

int main(int argc, char* argv[]) {
  try {
    if (argc != 5) {
      throw runtime_error("Bad arguments");
    }
    auto [in_file, out_file] = get_file_handlers(argv[1], argv[4]);
    string_view new_value = argv[3];
    auto target_index = get_target_column(in_file, argv[2], ',');
    if (target_index) {
        do_work(in_file, out_file, *target_index, new_value, ',');
    } else {
        throw runtime_error("Column name doesn’t exist in the input file");
    }
  } catch (runtime_error& e) {
    cout << e.what() << endl;
    usage_terminate(argv[0]);
  }
  return 0;
}

HP’s PC chief Ron Coughlin talks regaining PC share, targeting gamers, and expanding to VR | VentureBeat

HP’s PC chief Ron Coughlin talks regaining PC share, targeting gamers, and expanding to VR; Dean Takahashi; In VentureBeat; 2017-09 (vaguely dated as “one month ago, basedlined from 2017-10, don’t ya hate it when they do that?).

tl;dr → HP will do (Windows) computers for games & VR.

Mentioned

  • Ron Coughlin
  • Insights
    1. A person’s a person, no matter how small
    2. Persons want to be connected.
    3. Anything&Everything-as-a-Service (AEaaS)
  • Strategy
    1. Core
    2. Innovation
    3. Upscale, “premium”
  • And
    • detachables
    • pens
    • privacy screen 35°
    • Sprout
    • 3D Scanning
    • 3D Printing
    • VR backpack
  • Omen (a brand of Windows PC)
    • Microsoft is the partner
    • Omen X Notebook
    • Omen X DNA
    • Omen Command Center
      (a Windows App to control on-box devices, lights, etc.)
    • Omen Battery
      unpluggable, hot-swappable.
    • Omen Keyboard
      • physical
      • 22mm motion
      • 26-key multiple keypress
        (2x over 26 keys? or 2^26 possible combinations?)
  • Also
    • synergy
    • application areas are recited,
      customer opportunities beyond “officework” are recited.

      • movies
      • military
      • marketing
      • retail store operations (shelf stocking)

Previously

In VentureBeat

How “Big Data” Went Bust | Slate

How “Big Data” Went Bust; ; In Slate; 2017-10-16.
Teaser: And what comes next.

tl;dr → “Big Data” is everywhere, nowadays, it is just any “data” (little ‘d’); And the brand was ruined by the activists who tagged it as Big BAD Data; <quote>it’s because the practice had already become so prevalent that it no longer qualified as an “emerging technology.”</quote>
and → Big Data is Facebook; Facebook is bad.
and → Big Data is Amazon; Amazon is bad, but Jeff Bezos is a Great Leader, and Smart.
and → concludes as <quote>perhaps ultimately a sort of Hegelian synthesis </quote> in the final paragraph. <snide> Mistakes will be made, only time will tell, told ya so!</snide> Yup. It’s a Freshman Seminar essay.

Hey ‘bot!

You’re reading this cultural analysis and prognostication in Slate. You going to be okay with that?  They publish articles with titles such as

  • Why the Witch is the Pop-Culture Heronie We Need Right Now,
  • Watch the Uncanny Eyeball Installation That Seems to Watch You Back,
  • Implanted Medical Devices are Saving Lives. they’re Also Causing Exploding Corpses.

OK? … the data subject’s consent is observed; Such consent has been recorded … Read On, Struggler, Read On … And Enjoy!

Mentioned

  • “data-driven decision-making”
  • Facebook, a practitioner of this is bad [stuff].
  • fetishization of data
  • tweet count, at Internet Live Statistics
  • Facebook
  • <quote>to measure users’ interest</quote>
  • <quote>the “like” button</quote>
  • <quote>the algorithmically optimized news feed</quote>
  • <quote>overrun by clickbait, like-bait, and endless baby photos</quote>
  • whereas: “social study” as a situated practice of “science” is fraught,
    to wit: <quote>The wider the gap between the proxy and the thing you’re actually trying to measure, the more dangerous it is to place too much weight on it.</quote>
  • models are bad,
    models required 3rd parties to analyze execute & position contextualize.
  • Michelle Rhee, ex-schools chancellor, Washington D.C.
  • <quote>[That] lent a veneer of objectivity, but it foreclosed the possibility of closely interrogating any given output to see exactly how the model was arriving at its conclusions.</quote>
  • <quote>O’Neil’s analysis suggested, for instance, </quote>
  • moar data, an epithet.
    c.f. moar defined at know your meme
  • “slow food,”
    is contra “fast food.”
  • Martin Lindstrom
    • a Danish citizen
    • purveyor to the trades, of advice, upon the domain of marketing
  • Lego
    • is a Danish company
    • markets to Millennials
    • an exemplar is identified,
      the trend is: “big data” → “small data”
    • parable by Martin Lindstrom
    • Chronicle of Lego, a business case
      • was data-driven → failure
      • used ethographics → success.
    • Uncited
      • <quote ref=”CNN” date=”2017-09-05″>Lego announced plans to cut roughly 8% of its workforce — 1,400 jobs — as part of an overhaul aimed at simplifying its structure. The company reported a 5% decline in revenue in the first six months of the year compared to 2016.</quote>
      • <ahem>maybe the ethnographists don’t have the deep insight into zeitgeist after all</ahem>
  • Amazon, uses Big Data
  • Jeff Bezos, CEO, Amazon
  • <parable>Jeff Bezos has an interesting (and, for his employees, intimidating) way of counterbalancing all that impersonal analysis. On a somewhat regular basis, he takes an emailed complaint from an individual customer, forwards it to his executive team, and demands that they not only fix it but thoroughly investigate how it happened and prepare a report on what went wrong.</quote> filed under: how the great ones do it.
  • <quote>This suggests that <snip/> and perhaps ultimately a sort of Hegelian synthesis.</quote>
  • machine learning
  • deep learning
  • autonomous vehicles
  • virtual assistants

Referenced

Previously

In archaeological order, in Slate

Actualities

Is ‘Smart’ Beta Just Expensive Beta? | Betterment

Staff (Betterment); Is ‘Smart’ Beta Just Expensive Beta?; In Their Blog; 2015-06-15.
Teaser Are ‘smart’ beta funds good for investors? So far, the answer is no.

tl;dr → Betteridge’s Law. No.

From Two Sides Now

Is ‘Smart’ Beta Just Expensive Beta?
Yes.
Are ‘smart’ beta funds good for investors?
No.

Realtime Paged Data Exchange 1.0 | W3C

Realtime Paged Data Exchange 1.0, Final Community Group Report; W3C; 2017-08-14.

Editors
Authors:

Mentions

  • Endpoint Validator at openactive.io.
  • openactive/realtime-paged-data-exchange at GitHub
  • Domain: physical activity data.
    • Like RSS feeds, but different
    • Like Twitter feeds, but different
    • JSON “feeds”
  • Scale
    In perpetuity (forever>
    while in the “available” state (is “updated” state) state
    Seven (7) days
    While in the “soft delete” notification prior to expungement (delisting, disappearance)
  • Format: JSON (of course, this is the web, yes?)
  • Elements
    1. Implementation
    2. Paging
    3. Transport
  • SQL specifications of behavior are given

Referenced

Students Get Tuition Aid for a Piece of Their Future | WSJ

Students Get Tuition Aid for a Piece of Their Future; Jillian Berman; In The Wall Street Journal (WSJ); 2017-09-10.
Teaser: Income share agreements seem poised to take off, as costs and debt loads rise.

tl;dr → <quote>Under the terms of a typical ISA, students agree to pay a percentage of their future earnings for a predetermined period in exchange for help up front with their tuition.</quote>

Mentions

  • Income Share Agreement (ISA)
  • Lumni, an organization offering students in Latin America ISAs since 2002 and in the U.S. since 2009.
  • Cappex.com, a web site; vertical search of college and scholarship offers.
  • Purdue University, Indiana
    Back a Boiler program.
  • Purdue Research Foundation, manages the ISA program at Purdue.

Quoted

  • David Bergeron, senior fellow at the Center for American Progress.
  • David Cooper, chief investment officer, Purdue Research Foundation.
  • Mitch Daniels,
    • the university’s president,
    • Republican,
    • ex-governor, Indiana.
  • James Fish, chief financial officer, Clarkson University.
  • Mark Kantrowitz, publisher, Cappex.com.
  • Zachary Meyer,
    • Reference customer.
    • Senior, Purdue,
  • Miguel Palacios
    • assistant professor of finance, Haskayne School of Business, University of Calgary.
    • co-founder of Lumni.
  • Jason Tyszko, executive director of the U.S. Chamber of Commerce Foundation Center for Education and Workforce,

Time Symmetry Theory, or Retrocausality, Predicts That the Future Is Influencing the Past | Big Think

A New Quantum Theory Predicts That the Future Could Be Influencing the Past; Paul Ratner; In Big Think; 2017-07-09.

Original Sources

Matthew Leifer (Chapman University), Matt Pusey (Perimeter); Does time-symmetry in quantum theory imply retrocausality?; Foundational Questions Institute (FQXi); 2016-07-17; 28 slides.
<paywalled>Matthew S. Leifer, Matthew F. Pusey; Is a time symmetric interpretation of quantum theory possible without retrocausality?; In Proceedings of the Royal Society A; 2017-06-21; DOI:10.1098/rspa.2016.0607</paywalled>

tl;dr → Betteridge’s Law. No.

Mentions

  • retrocausality
  • time symmetry
  • Perimeter Institute for Theoretical Physics in Ontario.

Concept

<quote>retrocausality does not mean that you get to send signals from the future to the past – rather that an experimenter’s measurement of a particle can influence the properties of that particle in the past, even before making their choice.</quote>

Who

  • Matthew S. Leifer
  • Huw Price, professor, philosophy, University of Cambridge,
    …quoted for color, background & verisimilitude.

Pantheon

  • Einstein
  • Bell

Referenced

Previously

In Big Think

Android takes aim at ISP surveillance with DNS privacy | Naked Security

Android takes aim at ISP surveillance with DNS privacy; John E Dunn; In Naked Security; 2017-10-27.

Mentions

  • Transport Layer Security (TLS)
  • Server Name Identification (SNI)
  • DNS-over-TLS
  • Port 853
    like Port 53, but with TLS.
  • Android, not specific to Android
  • Google DNS
    • 8.8.4.4
    • 8.8.8.8.
Implementations
  • none
  • <claim>even Google’s DNS service doesn’t support it yet.</claim>

Alternatives

  • DNSCurve
  • Confidential DNS
  • DNS-over-DLTS (DNSoD)
  • DNSCrypt
  • DNS-over-TLS
Separate
  • DNSSEC

Background

  • Investigatory Powers Act (IPA)
    • United Kingdom (UK)
    • commenced 2016-11
    • a.k.a. “Snooper’s Charter”

Referenced

Promotional

Previously

In Naked Security

Holding People Responsible for Ethical Violations: The Surprising Benefits of Accusing Others | Kennedy, Schweitzer

Jessica A. Kennedy (Owen, Vanderbuilt), Maurice E. Schweitzer (Wharten, U. Penn.); Holding People Responsible for Ethical Violations: The Surprising Benefits of Accusing Others; draft; Destined for Some Social Science Journal; 2017-now; 65 pages.

tl;dr → “High-Horse” Sanctimony Works.

Abstract

Individuals who accuse others of unethical behavior can derive significant benefits. Compared to individuals who do not make accusations, accusers engender greater trust and are perceived to have higher ethical standards. In Study 1, accusations increased trust in the accuser and lowered trust in the target. In Study 2, we find that accusations elevate trust in the accuser by boosting perceptions of the accuser’s ethical standards. In Study 3, we find that accusations boosted both attitudinal and behavioral trust in the accuser, decreased trust in the target, and promoted relationship conflict within the group. In Study 4, we examine the moderating role of moral hypocrisy. Compared to individuals who did not make an accusation, individuals who made an accusation were trusted more if they had acted ethically but not if they had acted unethically. Taken together, we find that accusations have significant interpersonal consequences. In addition to harming accused targets, accusations can substantially benefit accusers.