Question: Are good family members or good friends more important? Why?

Question: Are good family members or good friends more important? Why?

Question: Are good family members or good friends more important? Why?

All topic

DDD: How to resolve aggregate members needing dependecies?

I have the following aggregate:

  • Checkout (root)
  • Requirement: CouponRequirement, AnotherRequirement, YetAnotherRequirement
  • Coupon

A Checkout has many requirements that need to be fulfilled in order for a Checkout to complete. Each Requirement has a fulfill(data) method that is responsible for the fulfillment process.

One of those requirements is a CouponRequirement which, when fulfilled, needs to make sure there is stock for a particular coupon and reserve it. For this to happen I need access to a CouponRepository or CouponService.

How could I tailor my design to accomodate that dependency?

FulfillRequirementCommand

function handle($cmd) {
   $cho = $this->checkoutRepository->get($cmd->checkoutId);
   $cho->fulfillRequirement($cmd->requirementType, $cmd->requirementData);
}

Checkout

function fulfillRequirement($reqType, $reqData) {
    $req = $this->getRequirement($reqType);
    $req->fulfill($reqData);
}

CouponRequirement

function fulfill($data) {
    // check stock / reserve coupon
}

The common solution would be to pass a CouponService to fulfillRequirement. But fulfillRequirement takes care of many Requirement types, not just one.

Maybe I just need to abandon the generic approach and have multiple fulfillRequirement:

fulfillCouponRequirement($data, $couponService)
fulfillClientInformationRequirement($data)

.. etc

What do you guys think? even if you think of a different approach altogether I’d love to read about it.

All topic

Static members in object literal JavaScript

I can create static members in the function below like this:

function Base () {
        Base.mask = 0;
}

But I would like to create these static members in a literal object:

const Base = {
        // ?
};

Is that possible, or am I wrong?

All topic

set and get functions to modify class members

I would like to pass my arduino uno serial commands of the form command:key:value or by extension command:key:value:key:value.... if I want to provide multiple sets of keys and values. The two basic commands are set and get

example: set:key1:10 UNO sets key to given value
example: get:key1 UNO return key value

I wanted to know the best way to store my key value data and update it once the command comes in.

I spoke to users in the C++ chatroom, and they suggested a class structure like this, but I know the arduino does not support c++ standard map. I could download and include it, but I wanted to know if you guys had a better way since memory is limited.

I was also thinking I could create a struct and then update the values there, but wasn’t sure on how to have a single set and get function to evaluate the string key and update the struct accordingly.

#include 
#include 
#include 
#include 

class Uno{
  //private
    int key1;
    int key2;
    std::map keys;
  public:
  //Constructor
    Uno(){
      key1 = 0;
      key2 = 0;
      keys["key1"] = &Uno::key1;
      keys["key2"] = &Uno::key2;
    }
    bool set(std::string key, int value){
      if (keys.count(key)) {
          this->*keys[key] = value;
          return true;
      }
      return false;
    }
    int get(std::string key){
      if (keys.count(key)) {
          return this->*keys[key];
      }
      throw std::runtime_error("Invalid key: " + key);
    }
};

Example usage

  Uno myUno;
  myUno.set("key1", 10);
  Serial.println(myUno.get("key1"));

All topic

If 50 members of a species were given intelligence, how long would it take to evolve?

On the planet Qualis, about 2 million years ago, their was a species of lizards, called “Quals”. They were about as smart at the common Earth rat, not very smart. They dwelled in the semi-arid regions and tropical rainforests of Qualis, and were the prey of larger, more ferocious lizards like Kols and such. Not very impressive.

Than, they cane to Qualis. They were a race of ancient creatures, who were quite skilled at genetic engineering and altering. They stumbled upon a group of Quals, and thought that they might be good specimens for their genetic testing. So, they took a group of 50 Quals, 33 of them female, 17 male. They gave this group of 50 increased strength, and intelligence. Then they left.

Eventually, those group of 50 breed with other Quals, with their increased abilities making it easier for them to survive long enough to breed. Generation after generation, Quals got more intelligent, until eventually the evolved into the intelligent Qualian species. My question is, if 50 members if a species gained intelligence, could they evolve to sapience in 2 million years?

All topic

Kit Carson & John Fremont expedition members

I am trying to confirm that an ancestor traveled west with Kit Carson and John Fremont in 1842-1846, in one or several of their expeditions to map out western trails. I am having trouble locating any sort of listing or schedule of the expedition members. It appears that there were several expeditions to California and at least two appeared in published Congressional reports.

I have not yet located a source that lists the presence or enlistment of general members of these forays. I don’t have reason to know whether such exists, though I suppose as government expeditions there may have been some reporting or pay schedule. It’s also a subject of study as a historical event.

If it helps, my specific ancestor born 1809 would’ve been in his early to mid-30s for the expeditions, and the timing of his children did not seem to clearly preclude any of the missions. His name was Harberd Rose, but with half a dozen different spellings and nicknames and misspellings: Harbird, Herberd, Harbert, Horbane, Harbans, Hary, etc. I have him in North Carolina 1840 and Kentucky 1850, finally settling in Kansas.

Post-Script (8/18/2014): After discussing this myth more with family, my partner did research on different people in the same line. She started with ancestors of my grandfather, from whom the myth started. She eventually determined that it was most likely a different line, one where my 4th-great-grandfather was probably merely in California at the right time and maybe knew Kit Carson and John Fremont. My ancestor was there early on, but was probably not part of one of the expeditions and may not have had much if any interaction with that group.

I would still be interested if anybody knew of a source for information about these trips, or a source that covers a number of such historical expeditions. It would confirm that my ancestor was not part of an official expedition there.

All topic

Do clan members ever get matched against each other in standard Arena battles?

When playing a standard arena battle in Clash Royale (not a “friendly” or “tournament” battle), is it possible (however remotely) for two members of the exact same clan to end up being matched together to battle each other?

Follow-up question: same question as above, but for a “challenge” battle.

All topic

OpenLDAP : retrieve members of a group

I enabled memberof module in openldap. Added two groups and some members under them. (groupOfNames)

When I printed the members of a particular group using the filter (&(objectClass=groupOfNames)(cn=bowlers)), it prints only the first member of the group though it has got multiple members.

How to list all members of a group?

# extended LDIF
#
# LDAPv3
# base  with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# example.com
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: Sierraware
dc: example

# admin, example.com
dn: cn=admin,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword:: e1NTSEF9NFZXYit2MlVBS2xRVUdBOWVjK2IrSHBac3VpYnV6ZlM=

# People, example.com
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: People

# Groups, example.com
dn: ou=Groups,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: Groups

# adam, People, example.com
dn: uid=adam,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: adam
sn: hanks
givenName: adam
cn: Adam hanks
displayName: Adam hanks
uidNumber: 10000
gidNumber: 5000
userPassword:: YWRhbWxkYXA=
gecos: Adam hanks
loginShell: /bin/bash
homeDirectory: /home/adam

# john, People, example.com
dn: uid=john,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: john
sn: doe
givenName:: am9obiA=
cn: John Doe
displayName: John Doe
uidNumber: 10000
gidNumber: 5000
userPassword:: am9obmxkYXA=
gecos: John Doe
loginShell: /bin/bash
homeDirectory: /home/john


# wahab, People, example.com
dn: uid=wahab,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: wahab
sn: riyaz
givenName:: d2FoYWIg
cn: Wahab Riaz
displayName: Wahab Riaz
uidNumber: 10008
gidNumber: 5008
userPassword:: d2FoYWJsZGFw
gecos:: V2FoYWIgUmlheiA=
loginShell: /bin/bash
homeDirectory: /home/wahab

# sachin, People, example.com
dn: uid=sachin,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: sachin
sn: ramesh
givenName:: c2FjaGluIA==
cn: Sachin Ramesh
displayName: Sachin Ramesh
uidNumber: 10009
gidNumber: 5009
userPassword:: c2FjaGlubGRhcA==
gecos:: U2FjaGluIFJhbWVzaCA=
loginShell: /bin/bash
homeDirectory: /home/sachin

# bowlers, People, example.com
dn: cn=bowlers,ou=People,dc=example,dc=com
objectClass: groupOfNames
cn: bowlers
description: IT security group
member: cn=wahab,ou=People,dc=example,dc=com
member: cn=sachin,ou=People,dc=example,dc=com

All topic

Delete a bulk of members from a facebook group script?

I have a 9K group on Facebook that is very old and a lot of profiles are old and non active.
I want to refresh the group and get rid of inactive members.

Trust me, I have tried the famous java scripts to make it happen automatically, no one works.

Please advise what script will actually delete N non active members (arrange members in ascending order by join date and delete N)

All topic

Does a subset generate a group if only infinite combinations of members of that subset can create every member of that group?

In Algebra by Michael Artin, he says the group generated by a subset “consists of all elements of G that can be expressed as a product of a string of elements of U and of their inverses,” but must this be a finite string of elements? For example, does the set of rationals minus zero generate the group of reals minus zero, since every real can be expressed as an infinite product of rationals? I would guess not, since the rationals minus zero is generally considered a group itself, and Artin says the group generated is the smallest group containing the subset, but I want to make sure.

All topic