1. E

    Given a hash of arrays, how to create an array of hashes with each possible combo

    Given a hash with values containing arrays of unequal lengths, {a: [1, 2, 3], b: [1, 2], c: [1]} is it possible to create an array of hashes containing the same keys, of all permutations of single values like the following without resorting to nesting multiple loops? [ {a: 1, b: 1, c: 1}...
  2. R

    How to merge the hash this way

    I have written a huge code something like below headers, *data_rows = @testCaseSheet local = headers.zip(*data_rows) local = local[1..-1].map {|dataRow| local[0].zip(dataRow).to_h} testCaseHash = {} local.each do |value| testCaseHash[value["Locator"]] = value.tap {|hs|...
  3. F

    Why does clang reject this unordered_set definition gcc accepts?

    I wish to test unordered_set with my own hash function: #include<unordered_set> #include<iostream> #include<functional> using namespace std; struct node{ size_t value; bool operator == (const node& n){return value == n.value;} }; size_t h(const node& n){ return n.value; } int...
  4. Y

    Wordpress CheckPassword and Warning: substr()

    I'm still newbie for wordpress, I'm just trying to check password (I'm sure I missed something somewhere but I'm feeling lost and couldn't focus): $user = $_POST['user_name']; $pass = $_POST['user_password']; $wp_hasher = new PasswordHash(8, TRUE); $result=$wpdb->get_results("SELECT * FROM...