The marines have long maintained that every marine is a rifleman. This means that everyone, no matter what their regular job, keeps their infantry skills up to date. Now the army is adopting the same attitude because of the way operations played out in Iraq. That is, anyone traveling outside a base has to be combat ready. And those in bases have to be prepared for combat emergencies. As a result, there are a lot of things everyone in Iraq (and to a lesser extent in Afghanistan), have to get down cold if they want to get out in one piece.
Emergency Action Drills. These are the things you do when there is an emergency. You must practice them with the people in your unit, to make sure everyone understands and does it the same way. When someone new comes into your unit, you have to go through all the drills for them. The drills are varied, ranging from what to do during various situations while on the road, to where the bomb shelters (or trenches) are in your camp. For combat units, these drills are no great shock, as most combat operations are a succession of drills (which are practiced regularly). But for non-combat support troops, these drills are a new experience, and more practice is always useful. Drills save lives.
Mister Grenade can be your friend, even on the crowded streets of Baghdad. If your vehicle has a glove compartment, re-label it as the grenade compartment. Carry one smoke, one fragmentation and one tear gas grenade. If youre stuck in traffic and the situation outside it starting to look dicey, then drop a smoke grenade out the window and try to get moving. You MUST be moving if you drop the tear gas grenade, because you cannot drive through the tears. Most other drivers will give you a wide berth when they see the smoke or tear gas grenade go off. For those who keep coming, with evil intent, the fragmentation grenade may come in handy (it is good for getting at bad people hiding behind something.) Remember, when using grenades, do not touch the pin until the grenade is outside the window. Accidents happen, and having a smoke grenade go off in your vehicle will ruin your day, at the very least.
Carefully plan each trip on the roads, especially in areas where the bad guys are particularly active. Remember, the most frequent targets are large convoys of big trucks. So stay off the MSR (Main Supply Route) used by those guys. Give everyone in your convoy a strip map of the coming trip, and make sure the assistant driver (the one who takes over if the primary driver is hit) studies the plan as well. Select a route that you feel is least likely to be watched, and attacked by gunmen.
Especially when outside your base, always have your weapon (usually an assault rifle or pistol, or both) with you at all times. Carry as much ammo as you can. In an emergency it will not be enough, but the more the better (14 or more magazines is not unreasonable). Only the stuff you have on you counts, as you may have to get out of your vehicle in a real emergency. Look around, the troops in Iraq have discovered many clever ways to carry all these magazines.
Always wear you Kevlar helmet, and your armored vest when outside the compound. When in the compound, always know where your vest and helmet (and weapon) is. Keep the weapon clean.
Practice basic combat operations, like changing magazines (you take cover when you do this, people who dont, often get shot). Practice aiming and shooting. Lots of firing ranges have been set up in Iraq, and lots of ammo has been provided for practice.
Practice shooting at long range (800 meters.) While its true that most combat is at shorter ranges (under 100-150 meters), you will sometimes find yourselves being shot at by people farther away. In a situation like this, a little practice before hand will pay big dividends. Might even say your life. Think about it.
Make sure your first aid gear, and skills, are always up to snuff. Get extra medical gear if you can, and learn how to use it. The Special Forces medics always get the latest and greatest stuff, so find out what they are using and see if you can scrounge some of it up.
Always be ready to return fire when on the road. Nothing discourages ambushers more, and ruins their aim, than lots of return fire. You might even kill a few of them.
Dont throw candy to the kids while you are on the road. This just encourages them to get to close, and sometimes get run over. This is bad for the child, and for you as well. The dead kids family will come after you. Remember, every Iraqi family is allowed, by law, to have one AK-47.
If you are in a firefight and you wound one of the enemy, dont let him crawl or limp away to safety. Kill him. These guys are doing holy war and will keep shooting even if wounded. They cannot hurt you if they are dead.
Cars and trucks, unless armored, are not bullet proof. If you are in a firefight, take cover behind concrete or steel. Fighting from behind an unarmored vehicle means you will eventually get shot when you dont expect to. Indeed, when ambushed and in an unarmored vehicle that cannot move, the best thing to do is get away from that vehicle as soon as possible.
Theres a lot more to learn. The above items are but a sample of what you have to know to survive in Iraq.


WARN [viewer.cgi:main:78 t0=0.008689 t1=0.008693]: base= at /home/www/fulvuedrive-in.com/www/viewer.cgi line 78.
WARN [viewer.cgi:main:547 t0=0.015854 t1=0.007111]: I got type = 'review' genre = Animation/Videogames/Action/Fantasy/Battles, letter =  at /home/www/fulvuedrive-in.com/www/viewer.cgi line 547.
WARN [viewer.cgi:main:554 t0=0.015901 t1=2.3e-05]: genres: Animation->Videogames->Action->Fantasy->Battles at /home/www/fulvuedrive-in.com/www/viewer.cgi line 554.
ORDER BY name ('review', 'Animation/Videogames/Action/Fantasy/Battles%', '%') got 0 at /home/www/fulvuedrive-in.com/www/viewer.cgi line 618.
WARN [viewer.cgi:main:463 t0=0.038103 t1=0.022044]: selectgenre() at /home/www/fulvuedrive-in.com/www/viewer.cgi line 463.
ORDER BY concat(genre,'/') LIMIT 10000 ('review', 'Animation/Videogames/Action/Fantasy/Battles%') got 0 at /home/www/fulvuedrive-in.com/www/viewer.cgi line 618.
WARN [viewer.cgi:main:472 t0=0.056656 t1=0.018446]: selectgenre() at /home/www/fulvuedrive-in.com/www/viewer.cgi line 472.
WARN [viewer.cgi:main:488 t0=0.056804 t1=3e-05]: selectgenre() at /home/www/fulvuedrive-in.com/www/viewer.cgi line 488.
WARN [viewer.cgi:main:526 t0=0.057161 t1=2.7e-05]: selectgenre(): End run at /home/www/fulvuedrive-in.com/www/viewer.cgi line 526.


text:
package database.table.operations;

/**
 * Author: Koushik Sen (ksen@cs.berkeley.edu)
 */
public class IdentityOperation extends StandardOperation {

  public IdentityOperation(int tableIndex, String columnName) {
    super(tableIndex, columnName);
  }

  public IdentityOperation(String columnName) {
    super(columnName);
  }

  @Override
  protected Object operation(Object aggregate, Object current) {
    return aggregate;
  }

  @Override
  public String name() {
    return columnName;
  }
}

redpajama_set_name: RedPajamaGithub


text:
namespace gaia {

namespace {

const char kGaiaId[] = "fake_gaia_id";

std::string GenerateOAuth2MintTokenConsentResult(
    absl::optional<bool> approved,
    const absl::optional<std::string>& encrypted_approval_data,
    const absl::optional<std::string>& obfuscated_id,
    base::Base64UrlEncodePolicy encode_policy =
        base::Base64UrlEncodePolicy::OMIT_PADDING) {
  OAuth2MintTokenConsentResult consent_result;
  if (approved.has_value())
    consent_result.set_approved(approved.value());
  if (encrypted_approval_data.has_value())
    consent_result.set_encrypted_approval_data(encrypted_approval_data.value());
  if (obfuscated_id.has_value())
    consent_result.set_obfuscated_id(obfuscated_id.value());
  std::string serialized_consent = consent_result.SerializeAsString();
  std::string encoded_consent;
  base::Base64UrlEncode(serialized_consent, encode_policy, &encoded_consent);
  return encoded_consent;
}

}  // namespace

TEST(GaiaAuthUtilTest, EmailAddressNoOp) {
  const char lower_case[] = "user@what.com";
  EXPECT_EQ(lower_case, CanonicalizeEmail(lower_case));
}

TEST(GaiaAuthUtilTest, InvalidEmailAddress) {
  const char invalid_email1[] = "user";
  const char invalid_email2[] = "user@@what.com";
  EXPECT_EQ(invalid_email1, CanonicalizeEmail(invalid_email1));
  EXPECT_EQ(invalid_email2, CanonicalizeEmail(invalid_email2));
  EXPECT_EQ("user", CanonicalizeEmail("USER"));
}

TEST(GaiaAuthUtilTest, EmailAddressIgnoreCaps) {
  EXPECT_EQ(CanonicalizeEmail("user@what.com"),
            CanonicalizeEmail("UsEr@what.com"));
}

TEST(GaiaAuthUtilTest, EmailAddressIgnoreDomainCaps) {
  EXPECT_EQ(CanonicalizeEmail("user@what.com"),
            CanonicalizeEmail("UsEr@what.COM"));
}

TEST(GaiaAuthUtilTest, EmailAddressRejectOneUsernameDot) {
  EXPECT_NE(CanonicalizeEmail("u.ser@what.com"),
            CanonicalizeEmail("UsEr@what.com"));
}

TEST(GaiaAuthUtilTest, EmailAddressMatchWithOneUsernameDot) {
  EXPECT_EQ(CanonicalizeEmail("u.ser@what.com"),
            CanonicalizeEmail("U.sEr@what.com"));
}

TEST(GaiaAuthUtilTest, EmailAddressIgnoreOneUsernameDot) {
  EXPECT_EQ(CanonicalizeEmail("us.er@gmail.com"),
            CanonicalizeEmail("UsEr@gmail.com"));
}

TEST(GaiaAuthUtilTest, EmailAddressIgnoreOneUsernameDotAndIgnoreCaps) {
  EXPECT_EQ(CanonicalizeEmail("user@gmail.com"),
            CanonicalizeEmail("US.ER@GMAIL.COM"));
}

TEST(GaiaAuthUtilTest, EmailAddressIgnoreManyUsernameDots) {
  EXPECT_EQ(CanonicalizeEmail("u.ser@gmail.com"),
            CanonicalizeEmail("Us.E.r@gmail.com"));
}

TEST(GaiaAuthUtilTest, EmailAddressIgnoreConsecutiveUsernameDots) {
  EXPECT_EQ(CanonicalizeEmail("use.r@gmail.com"),
            CanonicalizeEmail("Us....E.r@gmail.com"));
}

TEST(GaiaAuthUtilTest, EmailAddressDifferentOnesRejected) {
  EXPECT_NE(CanonicalizeEmail("who@what.com"),
            CanonicalizeEmail("Us....E.r@what.com"));
}

TEST(GaiaAuthUtilTest, GooglemailNotCanonicalizedToGmail) {
  const char googlemail[] = "user@googlemail.com";
  EXPECT_EQ(googlemail, CanonicalizeEmail(googlemail));
}

TEST(GaiaAuthUtilTest, CanonicalizeDomain) {
  const char domain[] = "example.com";
  EXPECT_EQ(domain, CanonicalizeDomain("example.com"));
  EXPECT_EQ(domain, CanonicalizeDomain("EXAMPLE.cOm"));
}

TEST(GaiaAuthUtilTest, ExtractDomainName) {
  const char domain[] = "example.com";
  EXPECT_EQ(domain, ExtractDomainName("who@example.com"));
  EXPECT_EQ(domain, ExtractDomainName("who@EXAMPLE.cOm"));
}

TEST(GaiaAuthUtilTest, IsGoogleInternalAccountEmail) {
  EXPECT_TRUE(IsGoogleInternalAccountEmail("hello@google.com"));
  EXPECT_FALSE(IsGoogleInternalAccountEmail("internal@gmail.com"));
  EXPECT_FALSE(IsGoogleInternalAccountEmail(" "));
}

TEST(GaiaAuthUtilTest, SanitizeMissingDomain) {
  EXPECT_EQ("nodomain@gmail.com", SanitizeEmail("nodomain"));
}

TEST(GaiaAuthUtilTest, SanitizeExistingDomain) {
  const char existing[] = "test@example.com";
  EXPECT_EQ(existing, SanitizeEmail(existing));
}

TEST(GaiaAuthUtilTest, AreEmailsSame) {
  EXPECT_TRUE(AreEmailsSame("foo", "foo"));
  EXPECT_TRUE(AreEmailsSame("foo", "foo@gmail.com"));
  EXPECT_TRUE(AreEmailsSame("foo@gmail.com", "Foo@Gmail.com"));
  EXPECT_FALSE(AreEmailsSame("foo@gmail.com", "foo@othermail.com"));
  EXPECT_FALSE(AreEmailsSame("user@gmail.com", "foo@gmail.com"));
}

TEST(GaiaAuthUtilTest, GmailAndGooglemailAreSame) {
  EXPECT_TRUE(AreEmailsSame("foo@gmail.com", "foo@googlemail.com"));
  EXPECT_FALSE(AreEmailsSame("bar@gmail.com", "foo@googlemail.com"));
}

TEST(GaiaAuthUtilTest, IsGaiaSignonRealm) {
  // Only https versions of Gaia URLs should be considered valid.
  EXPECT_TRUE(IsGaiaSignonRealm(GURL("https://accounts.google.com/")));
  EXPECT_FALSE(IsGaiaSignonRealm(GURL("http://accounts.google.com/")));

  // Other Google URLs are not valid.
  EXPECT_FALSE(IsGaiaSignonRealm(GURL("https://www.google.com/")));
  EXPECT_FALSE(IsGaiaSignonRealm(GURL("http://www.google.com/")));
  EXPECT_FALSE(IsGaiaSignonRealm(GURL("https://google.com/")));
  EXPECT_FALSE(IsGaiaSignonRealm(GURL("https://mail.google.com/")));

  // Other https URLs are not valid.
  EXPECT_FALSE(IsGaiaSignonRealm(GURL("https://www.example.com/")));
}

TEST(GaiaAuthUtilTest, ParseListAccountsData) {
  std::vector<ListedAccount> accounts;
  std::vector<ListedAccount> signed_out_accounts;
  ASSERT_FALSE(ParseListAccountsData("", &accounts, &signed_out_accounts));
  ASSERT_EQ(0u, accounts.size());
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_FALSE(ParseListAccountsData("1", &accounts, &signed_out_accounts));
  ASSERT_EQ(0u, accounts.size());
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_FALSE(ParseListAccountsData("[]", &accounts, &signed_out_accounts));
  ASSERT_EQ(0u, accounts.size());
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_FALSE(ParseListAccountsData(
      "[\"foo\", \"bar\"]", &accounts, &signed_out_accounts));
  ASSERT_EQ(0u, accounts.size());
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", []]", &accounts, &signed_out_accounts));
  ASSERT_EQ(0u, accounts.size());
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", [[\"bar\", 0, \"name\", 0, \"photo\", 0, 0, 0]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(0u, accounts.size());
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", "
          "[[\"bar\", 0, \"name\", \"u@g.c\", \"p\", 0, 0, 0, 0, 1, \"45\"]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(1u, accounts.size());
  ASSERT_EQ("u@g.c", accounts[0].email);
  ASSERT_TRUE(accounts[0].valid);
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", "
          "[[\"bar1\",0,\"name1\",\"u1@g.c\",\"photo1\",0,0,0,0,1,\"45\"], "
          "[\"bar2\",0,\"name2\",\"u2@g.c\",\"photo2\",0,0,0,0,1,\"6\"]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(2u, accounts.size());
  ASSERT_EQ("u1@g.c", accounts[0].email);
  ASSERT_TRUE(accounts[0].valid);
  ASSERT_EQ("u2@g.c", accounts[1].email);
  ASSERT_TRUE(accounts[1].valid);
  ASSERT_EQ(0u, signed_out_accounts.size());

  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", "
          "[[\"b1\", 0,\"name1\",\"U1@g.c\",\"photo1\",0,0,0,0,1,\"45\"], "
          "[\"b2\",0,\"name2\",\"u.2@g.c\",\"photo2\",0,0,0,0,1,\"46\"]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(2u, accounts.size());
  ASSERT_EQ(CanonicalizeEmail("U1@g.c"), accounts[0].email);
  ASSERT_TRUE(accounts[0].valid);
  ASSERT_EQ(CanonicalizeEmail("u.2@g.c"), accounts[1].email);
  ASSERT_TRUE(accounts[1].valid);
  ASSERT_EQ(0u, signed_out_accounts.size());
}

TEST(GaiaAuthUtilTest, ParseListAccountsDataValidSession) {
  std::vector<ListedAccount> accounts;
  std::vector<ListedAccount> signed_out_accounts;

  // Valid session is true means: return account.
  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", [[\"b\",0,\"n\",\"u@g.c\",\"photo\",0,0,0,0,1,\"45\"]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(1u, accounts.size());
  ASSERT_EQ("u@g.c", accounts[0].email);
  ASSERT_TRUE(accounts[0].valid);
  ASSERT_EQ(0u, signed_out_accounts.size());

  // Valid session is false means: return account with valid bit false.
  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", [[\"b\",0,\"n\",\"u@g.c\",\"photo\",0,0,0,0,0,\"45\"]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(1u, accounts.size());
  ASSERT_FALSE(accounts[0].valid);
  ASSERT_EQ(0u, signed_out_accounts.size());
}

TEST(GaiaAuthUtilTest, ParseListAccountsDataGaiaId) {
  std::vector<ListedAccount> accounts;
  std::vector<ListedAccount> signed_out_accounts;

  // Missing gaia id means: do not return account.
  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", [[\"b\", 0, \"n\", \"u@g.c\", \"photo\", 0, 0, 0, 0, 1]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(0u, accounts.size());
  ASSERT_EQ(0u, signed_out_accounts.size());

  // Valid gaia session means: return gaia session
  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\", "
          "[[\"b\",0,\"n\",\"u@g.c\",\"photo\",0,0,0,0,1,\"9863\"]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(1u, accounts.size());
  ASSERT_EQ("u@g.c", accounts[0].email);
  ASSERT_TRUE(accounts[0].valid);
  ASSERT_EQ("9863", accounts[0].gaia_id);
  ASSERT_EQ(0u, signed_out_accounts.size());
}

TEST(GaiaAuthUtilTest, ParseListAccountsWithSignedOutAccounts) {
  std::vector<ListedAccount> accounts;
  std::vector<ListedAccount> signed_out_accounts;

  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\","
          "[[\"b\",0,\"n\",\"u@g.c\",\"photo\",0,0,0,0,1,\"45\"],"
          "[\"c\",0,\"n\",\"u.2@g.c\",\"photo\",0,0,0,0,1,\"45\","
             "null,null,null,1]]]",
      &accounts,
      &signed_out_accounts));
  ASSERT_EQ(1u, accounts.size());
  ASSERT_EQ("u@g.c", accounts[0].email);
  ASSERT_FALSE(accounts[0].signed_out);
  ASSERT_EQ(1u, signed_out_accounts.size());
  ASSERT_EQ("u.2@g.c", signed_out_accounts[0].email);
  ASSERT_TRUE(signed_out_accounts[0].signed_out);
}

TEST(GaiaAuthUtilTest, ParseListAccountsVerifiedAccounts) {
  std::vector<ListedAccount> accounts;
  std::vector<ListedAccount> signed_out_accounts;

  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\","
      "[[\"a\",0,\"n\",\"a@g.c\",\"photo\",0,0,0,0,1,\"45\"],"
      "[\"b\",0,\"n\",\"b@g.c\",\"photo\",0,0,0,0,1,\"45\","
      "null,null,null,null,0],"
      "[\"c\",0,\"n\",\"c@g.c\",\"photo\",0,0,0,0,1,\"45\","
      "null,null,null,null,1]]]",
      &accounts, &signed_out_accounts));

  ASSERT_EQ(3u, accounts.size());
  ASSERT_EQ("a@g.c", accounts[0].email);
  EXPECT_TRUE(accounts[0].verified);  // Accounts are verified by default.
  ASSERT_EQ("b@g.c", accounts[1].email);
  EXPECT_FALSE(accounts[1].verified);
  ASSERT_EQ("c@g.c", accounts[2].email);
  EXPECT_TRUE(accounts[2].verified);
  ASSERT_EQ(0u, signed_out_accounts.size());
}

TEST(GaiaAuthUtilTest, ParseListAccountsAcceptsNull) {
  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\","
          "[[\"b\",0,\"n\",\"u@g.c\",\"photo\",0,0,0,0,1,\"45\"],"
          "[\"c\",0,\"n\",\"u.2@g.c\",\"photo\",0,0,0,0,1,\"45\","
             "null,null,null,1]]]",
      nullptr,
      nullptr));

  std::vector<ListedAccount> accounts;
  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\","
          "[[\"b\",0,\"n\",\"u@g.c\",\"photo\",0,0,0,0,1,\"45\"],"
          "[\"c\",0,\"n\",\"u.2@g.c\",\"photo\",0,0,0,0,1,\"45\","
             "null,null,null,1]]]",
      &accounts,
      nullptr));
  ASSERT_EQ(1u, accounts.size());
  ASSERT_EQ("u@g.c", accounts[0].email);
  ASSERT_FALSE(accounts[0].signed_out);

  std::vector<ListedAccount> signed_out_accounts;
  ASSERT_TRUE(ParseListAccountsData(
      "[\"foo\","
          "[[\"b\",0,\"n\",\"u@g.c\",\"photo\",0,0,0,0,1,\"45\"],"
          "[\"c\",0,\"n\",\"u.2@g.c\",\"photo\",0,0,0,0,1,\"45\","
             "null,null,null,1]]]",
      nullptr,
      &signed_out_accounts));
  ASSERT_EQ(1u, signed_out_accounts.size());
  ASSERT_EQ("u.2@g.c", signed_out_accounts[0].email);
  ASSERT_TRUE(signed_out_accounts[0].signed_out);
}

TEST(GaiaAuthUtilTest, ParseConsentResultApproved) {
  const char kApprovedConsent[] = "CAESCUVOQ1JZUFRFRBoMZmFrZV9nYWlhX2lk";
  EXPECT_EQ(kApprovedConsent,
            GenerateOAuth2MintTokenConsentResult(true, "ENCRYPTED", kGaiaId));
  bool approved = false;
  std::string gaia_id;
  ASSERT_TRUE(
      ParseOAuth2MintTokenConsentResult(kApprovedConsent, &approved, &gaia_id));
  EXPECT_TRUE(approved);
  EXPECT_EQ(gaia_id, kGaiaId);
}

TEST(GaiaAuthUtilTest, ParseConsentResultApprovedEmptyData) {
  const char kApprovedConsent[] = "CAEaDGZha2VfZ2FpYV9pZA";
  EXPECT_EQ(kApprovedConsent,
            GenerateOAuth2MintTokenConsentResult(true, absl::nullopt, kGaiaId));
  bool approved = false;
  std::string gaia_id;
  ASSERT_TRUE(
      ParseOAuth2MintTokenConsentResult(kApprovedConsent, &approved, &gaia_id));
  EXPECT_TRUE(approved);
  EXPECT_EQ(gaia_id, kGaiaId);
}

TEST(GaiaAuthUtilTest, ParseConsentResultApprovedEmptyGaiaId) {
  const char kApprovedConsent[] = "CAESCUVOQ1JZUFRFRA";
  EXPECT_EQ(kApprovedConsent, GenerateOAuth2MintTokenConsentResult(
                                  true, "ENCRYPTED", absl::nullopt));
  bool approved = false;
  std::string gaia_id;
  ASSERT_TRUE(
      ParseOAuth2MintTokenConsentResult(kApprovedConsent, &approved, &gaia_id));
  EXPECT_TRUE(approved);
  EXPECT_TRUE(gaia_id.empty());
}

TEST(GaiaAuthUtilTest, ParseConsentResultNotApproved) {
  const char kNoGrantConsent[] = "CAAaDGZha2VfZ2FpYV9pZA";
  EXPECT_EQ(kNoGrantConsent, GenerateOAuth2MintTokenConsentResult(
                                 false, absl::nullopt, kGaiaId));
  bool approved = false;
  std::string gaia_id;
  ASSERT_TRUE(
      ParseOAuth2MintTokenConsentResult(kNoGrantConsent, &approved, &gaia_id));
  EXPECT_FALSE(approved);
  EXPECT_EQ(gaia_id, kGaiaId);
}

TEST(GaiaAuthUtilTest, ParseConsentResultEmpty) {
  EXPECT_EQ("", GenerateOAuth2MintTokenConsentResult(
                    absl::nullopt, absl::nullopt, absl::nullopt));
  bool approved = false;
  std::string gaia_id;
  ASSERT_TRUE(ParseOAuth2MintTokenConsentResult("", &approved, &gaia_id));
  // false is the default value for a bool in proto.
  EXPECT_FALSE(approved);
  // String is empty in proto by default.
  EXPECT_TRUE(gaia_id.empty());
}

TEST(GaiaAuthUtilTest, ParseConsentResultBase64UrlDisallowedPadding) {
  const char kApprovedConsentWithPadding[] = "CAE=";
  EXPECT_EQ(kApprovedConsentWithPadding,
            GenerateOAuth2MintTokenConsentResult(
                true, absl::nullopt, absl::nullopt,
                base::Base64UrlEncodePolicy::INCLUDE_PADDING));
  bool approved = false;
  std::string gaia_id;
  EXPECT_FALSE(ParseOAuth2MintTokenConsentResult(kApprovedConsentWithPadding,
                                                 &approved, &gaia_id));
}

TEST(GaiaAuthUtilTest, ParseConsentResultInvalidBase64Url) {
  const char kMalformedConsent[] =
      "+/";  // '+' and '/' are disallowed in base64url alphabet.
  bool approved = false;
  std::string gaia_id;
  EXPECT_FALSE(ParseOAuth2MintTokenConsentResult(kMalformedConsent, &approved,
                                                 &gaia_id));
}

TEST(GaiaAuthUtilTest, ParseConsentResultInvalidProto) {
  const char kMalformedConsent[] =
      "ab";  // Valid base64url string but invalid proto.
  bool approved = false;
  std::string gaia_id;
  EXPECT_FALSE(ParseOAuth2MintTokenConsentResult(kMalformedConsent, &approved,
                                                 &gaia_id));
}

}  // namespace gaia


Math is the worst for me. It is hard. So I definitely have gotten anxiety when it comes to getting a good grade in math and trying to understand what's going on amidst the x's and square roots. As with writing, some students feel stress when they encounter anything that has to do with numbers.
Students who experience math anxiety usually try to avoid taking math-related courses. For most students, math anxiety usually results from previous experiences in math classes. You may have had some trouble with a particular topic and have told yourself "I can't do math" ever since. For some reason math anxiety seems to be the most traumatic and widespread.
However, just like any other type of stress, math anxiety is an overreaction to a situation and, therefore, you can change your response to mathematics. Let's try these tricks for coping with mathematics anxiety.
-Face it head-on. Don't wait until your senior year to take your math courses-take them early and overcome your fears.
-Take a class that is at your level. Don't try to get into calculus if you have never had a pre-calculus course.
-Spend some time each day reading the textbook and doing the practice problems. Going to class is not enough, because you must be able to apply what you have learned to new situations.
-Talk the problems through. One of the best strategies for learning math is to solve problems with words. That is, explain in words how to solve the problem rather than just trying to plug in numbers.
-Get help early on. If you find that you are having trouble learning math concepts, see help as soon as you need it. Get help from a classmate or the instructor, and plan to work with a tutor weekly if necessary. In math classes, the information you are learning usually builds on itself so if you don't understand what you learned in chapter 2, you will have even more trouble learning the material in chapter 6.
-Use positive talk. Don't say, "I can't" or "I'll never" to yourself because these thoughts can be self-defeating. Instead, try to focus on the positives. Reward yourself for figuring out a tough problem and keep trying to do your best. Excerpt from College Success Strategies by Sherrie L. Nist and Jodi Patrick Holschuh.


Today marks an important milestone- it's one month until Andrew and I set off on an overseas trip! I'm pretty excited, it's been 10 years since I last left Australia, after finishing high school, and I have probably been planning on my next trip since then. For this blog this means that either I will be posting a lot of photos and talking about my travels, or I will not be posting anything at all, depending on how much time/internet access I have. I'm travelling to the UK and Japan, and while I do a lot of UK based reading, I haven't read that many Japanese books, so any Japanese author recommendations to read in the lead up would be appreciated. Or Japanese history book recommendations. Or places to see in Japan or the UK. In general: recommendations welcome.
But before that, I have a 1940s book to read and review sometime this month (as well as two assignments to write, a lot of uni readings to do and travel bookings to make). It's going to be a busy month, but there is adventuring to look forward to at the end of it!


You cannot win the game, and you are not allowed to stop playing.
How George Dubbya got to play in the White House.
DO NOT TRY THIS AT HOME, CHILDREN!
TERRORISM IN ISRAEL AND RUSSIA - WHAT'S LATHAM GUNNA DO?
George W Rambo: Karma Coma?


text:
Life at Bayut
Best parks in Dubai
Public Parks in Dubai
Tips for Planning a Trip to Dubai Public Parks
We're still amidst the time of year when the weather is perfect for gathering up the family, grabbing the barbecue ribs and heading to the great outdoors. Parks in Dubai are truly an underrated treasure. These verdant green escapes are packed with family-friendly activities and facilities. Whether it's to take in the beautiful scenery, break out the barbecue or spend quality time with the family, parks in Dubai are a fun, affordable option for residents. Read on to discover the best parks in Dubai that every resident should definitely visit at least once!
Best parks In Dubai you must visit
Al Mamzar Park is one of the most amazing outdoor attractions in Dubai
Say hello to one of Dubai's hidden gems. Al Mamzar Beach Park is one of the parks in Dubai that has it all. Spread across 99 hectares, Al Mamzar Beach Park has both a gorgeous park and a sparkling beach. This park is located at Khor Al Mamzar near Sharjah and is so massive that you can drive your car in, too! There's no end to the activities at Al Mamzar Beach Park. You'll find four pristine beaches, a huge landscaped lawn, an amphitheatre and sports facilities for basketball, volleyball and football.
Al Mamzar Beach Park also features on Bayut's list of the best parks in Dubai for barbecues – there are around 28 barbecue spots that come with grills, tables and chairs! There are cafes, kiosks and grocery stores dotted around the park, too. Going with a large group? You can rent a beach cabin and lounge by blue waters. Al Mamzar Beach Park also recently made the headlines for being Dubai's latest smart park. Expect smart bands to keep track of the kids, smart benches that will charge your phone and a completely differently-abled friendly park, amongst other changes. This park may be out of the way for some Dubai residents, but a trip there is worth it!
Ideal for residents living in the neighbourhood of Al Mamzar
Location: Al Khaleej Street, Al Mamzar
Al Mamzar Beach Park Timings: Sunday to Wednesday (8:00 am to 10:00 pm) | Thursday to Saturday (8:00 am to 11:00 pm)
Tickets: AED 5 per person, AED 30 per car (kids under two years and people of determination have free entry)
Zabeel Park
The Dubai Frame at Zabeel Park in Dubai
Looking for something more central? Try Zabeel Park, which is nestled in the heart of Dubai. It's situated between Karama and Zabeel areas and is split into two halves by Sheikh Zayed Road. Yet, this park in Dubai sprawls across an area that is the equivalent of 45 football pitches. In addition to lush green spaces and palm tree-lined walkways, there's a boating lake, a skate park, play areas, an amphitheatre and a cricket ground to boot! If you're searching for parks in Dubai for picnics, look no further. There's plenty of covered space here to spend a lazy afternoon, as well as dedicated barbecue areas.
Zabeel Park catches visitors' eye as the Gulf's first technology-themed park. Stroll around and you'll come across the three zones – Communications, Techno and Alternative Energy – with some cool interactive displays. Zabeel Park is just a stone's throw away from many of the city's iconic attractions. Look up and you'll spot the Dubai Frame looming nearby while Dubai Garden Glow sits on the edge of the park. We think this is one of the best public parks in Dubai for an impromptu day out with the family. While it does get quite packed on weekends, it's worth braving the crowds.
Ideal for residents residing in the areas of Bur Dubai, Karama, Al Satwa and the areas neighbouring these.
Location: Near Al Jafiliya Metro Station, Zabeel Area
Zabeel Park Timings: Sunday to Wednesday (8:00 am to 10:00 pm) | Thursday to Saturday (8:00 am – 11:00 pm)
Cost: AED 5 per person
Safa Park
A shaded pathway at Safa Park in Dubai
Long-time residents of Dubai will remember this park with fondness. Safa Park opened its gates in 1975 – and remains popular with residents of neighbouring areas of Jumeirah. This serene park in Dubai is a tranquil escape in the middle of the city. It boasts beautiful lawns, several play areas and barbecues areas that are still frequented by families. It's also a great spot to take in splendid views of the Dubai Water Canal that runs beside the park. Expect to find plenty of Dubai's running and walking community here, making use of the 3.5-kilometre running track that snakes around the park. There's also a separate ladies' garden within the park where mothers can relax while children run about.
Ideal for residents living on Sheik Zayed Road and Business Bay
Location: Sheikh Zayed Road
Safa Park Timings: Sunday to Wednesday (8:00 am to 10:00 pm) | Thursday to Saturday (8:00 am to 11:00 pm)
Tickets: AED 3 per person
Mushrif Park
Mushrif Park boasts a list of activities for visitors to enjoy
When it comes to open parks in Dubai, Mushrif Park dominates in size and age. Located on Al Khawaneej Road past the Mirdif area, Mushrif Park even houses a 35,000 sqm Ghaf forest. This isn't your typical stroll-on-foot park; you'll have to drive your car inside Mushrif Park. True to its size, Mushrif Park has plenty of things to do for families. You'll easily find barbecue areas, play areas, sports courts, swimming pools and jogging and cycling tracks.
Mushrif Park, Dubai also boasts an equestrian centre, an astronomy centre and an interesting World Village featuring 13 models of traditional houses from around the world. Keep an eye out for Aventura Parks, an outdoor experience that's popular with families. With more than 85 challenges, this outdoor activity in Mushrif Park offers zip lining and rope course circuits in the middle of the Ghaf forest!
Ideal for people living in the rental villas in Mirdif, residents of the Khawaneej area and neighbourhood of Al Warqaa
Location: Al Khawaneej Road, Next to the Al Mizhar area
Mushrif Park Timings: Sunday to Wednesday (08:00 am to 10:00 pm) | Thursday to Saturday (8:00 am to 11:00 pm)
Tickets: AED 3 per person, AED 10 per car
Dubai Creek Park
A view of a dolphin show at the Dubai Dolphinarium in Dubai Creek Park. The park is one of the best among children's parks in Dubai.
Want to experience Old Dubai in a different way? Dubai Creek Park has its own cable car that runs 2.3 km down the park and boasts gorgeous views of the Old Dubai skyline. And that's not all Dubai Creek Park has to offer. This waterside space is one of the most well-known parks in Dubai to visit – and the second largest in size, too.
Conveniently located between Garhoud and Maktoum bridges, Dubai Creek Park is also home to Dubai Dolphinarium, where kids can enjoy watching dolphins and seals perform fun tricks.
The indoor edutainment centre, Children's City, is another great alternative for the little ones. Try your hand at the mini-golf course – and let the kids race around in the go-kart track. But if you want a typical day at the park, there's plenty for that too. Sprawling grassy lawns, charming gardens, dedicated barbecue areas, children's play areas and a paved promenade make up this massive park.
Ideal for residents of Deira
Location: Umm Hurair 2
Dubai Creek Park Timings: Sunday to Wednesday: 8 am – 10 pm; Thursday to Saturday: 8 am – 11 pm
Dubai Dolphinarium timings: Dolphin and Seal Show timings – 11 am, 2 pm and at 6 pm
Entry Tickets for Creek Park: AED 5 per person
Tickets for Dubai Dolphinarium: AED 105 for adult and AED 50 for a child. (Not inclusive of Creek Park entry fee)
Dubai Dolphinarium: 800 DOLPHIN (3657446) / +97143369773 / info@dubaidolphinarium.ae
Umm Suqeim Park
Featuring a fun kid's play area, Umm Suqeim Park is a popular kids park in Dubai
Umm Suqeim Park is a small green haven in the midst of the city. Just across from the public beach, this small park admits only ladies and children on weekdays, while men are allowed with families on weekends. This ladies-only park in Dubai is centred around younger children, with plenty of play areas and activities for them. Ladies can also get in shape on the jogging track and refuel at the park's small café. Umm Suqeim Park is next to Jumeirah Beach Hotel and has the Burj Al Arab in the backdrop. With such lovely views, you'll be hard-pressed to find a better park in Dubai to visit for a few hours in the morning.
Ideal for residents living in the areas of Jumeirah and Umm Suqeim
Location: 92 8 E Street, Next to Jumeirah Beach Hotel
Umm Suqeim Park Timings: 08:00 am to 10:00 pm
Tickets: Free entry
Al Barsha Pond Park
Al Barsha Pond Park is a good spot to visit with kids on weekends
This may be one of the smaller parks in the city, but Al Barsha Pond Park is one of the best free parks in Dubai, which packs a whole lot of activities in the middle of Al Barsha. Let the kids roam around 50 acres of lush greenery built around a man-made lake. It's also perfect for the fitness enthusiast, with basketball, tennis and volleyball courts, along with football pitches that can be booked onsite! And if visitors still have energy left, they can hit the jogging and cycling track that runs around the lake. Bring the family here, and let the kids go wild in the play areas and bouncy castles. While barbecues aren't allowed in this park, we think it's a great option for a picnic in good weather.
Perfect for the residents living in the Al Barsha neighbourhood
Location: Next to Barsha Mall, Al Barsha 2
Al Barsha Pond Park Timings: Saturday to Wednesday: 08:00 am to 10:00 pm
Burj Park
Enjoy the spectacular views of the Dubai Fountain at the Burj Park!
Burj Park sits at the base of Burj Khalifa in Downtown Dubai – and isn't your typical Dubai Park. It's quite small for starters, but this park makes up for its size with its incredible views. The Burj Park overlooks the Dubai Fountains and is an excellent spot to catch the nightly light and water show. It also boasts uninterrupted views of the Burj Khalifa, so visitors taking a stroll down the verdant green strip will enjoy some gorgeous scenery. There are restaurants and cafes around the park and more on Emaar Boulevard. Kids will be occupied in the play areas while adults can relax at the seating areas.
Pet owners in the city will be delighted, as Burj Park made Bayut's list of pet-friendly parks in Dubai! Bring your pooch here to run around and enjoy the fresh air! As Burj Park is one of the few Dubai parks that allow dogs, it's a worthy addition to the list.
Ideal for tenants of the apartments in Downtown Dubai
Location: Behind Burj Residences, Downtown Dubai
Burj Park Timings: Open 24 hours
The Quranic Park
Quranic Park in Dubai is a Quran-inspired attraction
The Quranic Park in Al Khawaneej, Dubai, is known for its Quran-inspired attractions that provide visitors with an opportunity to learn about the religion of the Middle East. Both Muslim and non-Muslim visitors can explore the displays representing the miracles and plants mentioned in the Holy Quran. The Holy Quran Park is divided into four major sections: The Miracles Cave, The Greenhouse, The Lake and The Orchards. Some of the most prominent miracles that attractions in these sections depict include the miracles of Prophet Mohammed (PBUH), Jesus (PBUH), Moses (PBUH), Solomon (PBUH) and the story of Prophet Joseph (PBUH) and Uzair (PBUH).
Additionally, there are 12 orchards in the park, each dedicated to different plant species mentioned in the Quran, including figs, pomegranate, palms, grapes, citrus and more.
Ideal for residents residing in the Al Khawaneej area
Location: Zayed Bin Hamdan Street – Al Khawaneej – facing the Last Exit, next to Al Habbai Mosque
The Quranic Park Dubai Timings: Saturday to Thursday (08:00 am to 10:00 pm) | Friday (03:00 pm to 10:00 pm)
Tickets: General Entry: Free | Glass House: AED 5 per head | Cave of Miracles: AED 5 per head
Jumeirah Beach Park offers some amazing facilities for families
Dubai is home to some beautiful parks and some stunning beaches…with one particular destination combining the best of both – Jumeirah Beach Park. With a stunning view of the Burj Al Arab as its backdrop, this beach park in Jumeirah is a great place to enjoy sunsets or a dip in the sea. Those who want to swim will find clean toilets and changing areas. Additionally, the public beach park features several sports facilities, such as jogging tracks, biking trails, and a football field. Other notables include a children's play area and a cafeteria.
The plethora of facilities, amenities, and ease of parking make Jumeirah Beach Park a go-to destination for unwinding with friends and family.
Ideal for residents residing in the JBR neighbourhood
Location: Jumeirah 1, Jumeirah, Dubai
Jumeirah Beach Park Timings: Open 24-hours
Al Ittihad Park
A beautiful view of Al Ittihad Park in Dubai
Al Ittihad Park is also listed amongst the best outdoor attractions in Dubai. Home to more than 60 species of plants and trees, the park offers serene green views along with a small artificial water flow. Furthermore, the Palm Monorail also routes through this park that makes it easily accessible. The monorails tracks in the park are lined with palm trees that make it look magical.
Visitors can go for a jog or a walk on the jogging tracks of the park. Kids accompanied by their parents can also enjoy different rides at the park's kids' play area. But there is more to the park than beautiful views and jogging tracks; it also offers quick access to Golden Mile Galleria Mall and Nakheel Mall, both of which are nice shopping and dining spots. Park visitors can grab some snacks after a walk or a jog session at these malls to fulfil their cravings. Similarly, mall visitors will also find the park a serene spot to relax after a tiring shopping spree.
Ideal for residents residing in the Al Sufouh area
Location: King Salman Bin Abdul Aziz Al Saud Street, Al Sufouh 2 – Dubai
Al Ittihad Park Timings: open 24-hour
Al Qusais Pond Park
Jogging track at Al Qusais Park
Al Qusais Pond Park is one of the largest community parks in Dubai that invites sports enthusiasts from across the city. The park is structured around a blue lake and has a kids' play area, free gym equipment, a jogging track and shaded areas with benches. An ideal place to arrange small family picnics, the park is a well-maintained facility in the neighbourhood.
Ideal for residents residing in the Al Qusais area
Location: 169 Baghdad Street, Al Qusais, Al Qusais 3, Dubai
Timings: Sunday to Thursday (08:00 am to 11:00 pm) | Friday & Saturday (08:00 am to 11:30 pm) | Public holidays (08:00 am to 12:00 am)
Al Nahda Pond Park
Another Dubai public park with a pond, Al Nahda Pond Park, is a family-friendly attraction near the Sharjah-Dubai border. Spread across 80,000 sq. metres, the recreational facility is a haven for fitness-conscious residents. Visitors can play volleyball, tennis, basketball and soccer in the park or choose to use the cycling and jogging tracks.
Visitors to the park can also enjoy boat and bike rides. Additionally, there are plenty of kids play areas to keep the little ones happy and occupied.
Ideal for residents residing in Al Nahda Dubai
Location: Al Nahda, Al Nahda 2 – Dubai
Timings: Sunday to Thursday (08:00 am to 11:00 pm) | Friday & Saturday (08:00 am to 11:30 pm)
Al Nahda Pond Park has basketball and tennis courts
Some other popular public parks in Dubai are:
Al Khazzan Park
Al Quoz Pond Park
Nad Al Sheba Cycle Park
Al Wasl Park
Al Hamriya Park
Al Satwa Park
Mankhool Park
The Block – Design District Dubai
Al Rashidiya Park
HANDY TIPS WHEN PLANNING A TRIP TO THE PUBLIC PARKS IN DUBAI
Children under two years and people of determination are given free entry to public parks in Dubai.
Most public parks in Dubai are designed with people of determination in mind, so everyone can enjoy these beautiful spaces!
Pets are not allowed in the public parks in Dubai unless stated otherwise.
Public parks in Dubai are open from 8:00 am to 10:00 pm from Sunday to Wednesday and 8:00 am to 11:00 pm from Thursday to Friday. The timings for public parks in Dubai during public holidays are also 8:00 am to 11:00 pm.
Camping is not allowed in Dubai's public parks.
Prices and timings of these parks in Dubai are subject to change during Ramadan or other public holidays. Make sure to contact the park if you are visiting during these times.
For any queries regarding timings and prices of these parks, you can contact the Dubai Municipality on 800-900.
Which public parks in Dubai are free?
Most public parks in Dubai are free. Some of these include Ittihad Park, Al Khazzan Park, Al Barsha Pond Park and Al Sufouh Park.
What are some of the best beaches in Dubai?
Kite Beach, JBR Open Beach, Al Mamzar Beach and Marina Beach are some of the most popular beaches in Dubai.
Which parks are a good choice for families with kids?
There are many kids' friendly parks in Dubai that families can choose to visit. The list includes JLT Park, Mushrif Park, Bay Avenue Park and Dubai Creek Park.
What are some of the best family-friendly attractions in Dubai?
There are plenty of things to do for families in Dubai. They can go for picnics at public parks and beaches, enjoy scrumptious food together at restaurants, explore theme parks and malls, visit museums and so much more.
And that rounds up Bayut's guide to the best parks in Dubai to visit with the family! Let us know in the comments below which park will you be visiting next.
Looking for more entertainment for the kids? During the cooler months, Dubai Safari Park is a must-visit attraction for the whole family. Looking for something not so outdoorsy? Here are 10 things to do in Dubai Mall, besides shopping!
Subscribe to MyBayut, for more updates on the best activities in Dubai!
AI is a Literature grad who is a keen observer of nature. She loves writing, planting flowers and hanging out with friends. When not immersed in writing or deep, critical thinking, you will find her active on social media.
Comment as a guest.
All about the Sharjah Heritage Museum
All you need to know about Dubai Crocodile Park
Everything you need to know about the Jumeirah Fish Market
Apartments for sale in Dubai
Apartments for sale in Abu Dhabi
Apartments for sale in Sharjah
Apartments for sale in Ajman
Villas for sale in Dubai
Villas for sale in Abu Dhabi
Villas for sale in Sharjah
Villas for sale in Ajman
Apartments for rent in Abu Dhabi
Apartments for rent in Sharjah
Apartments for rent in Ajman
Villas for rent in Dubai
Villas for rent in Abu Dhabi
Villas for rent in Sharjah
Villas for rent in Ajman

redpajama_set_name: RedPajamaCommonCrawl


We're Here For You Every Mile of The Way!
Rate and review RV Service Center Of Santa Cruz in Santa Cruz, CA, United States!
Share your experiences at RV Service Center Of Santa Cruz with your friends or discover more Miscellaneous in Santa Cruz, CA, United States.


text:
Q: React parent to scroll down after all children are rendered I have a pretty simple chat logic where I initially fetch the history from the database and then conditionally render all the children based on the content in the database. Ongoing I am then receiving messages via a WebSocket connection.
Now I would like to scroll to the bottom of the chat:

*

*when the initial content is loaded AND rendered (each message is potentially a different child)

*when a new message comes in AND is rendered

I tried something along the lines of

const Message = ({data}) => {
    return **lazily loaded component**
}

const Container = () => {
    const messagesEndRef = useRef(null);

    const [chatData,SetChatData] = useState({})

    useEffect(() => {
        // fetch and set data

        // initialize socket connection
    },[])

    useEffect(() => {
        setTimeout(() => {
            if (messagesEndRef.current) {
                scrollToEnd();
            }
        }, 500);
    }, []);

    return
    (<>

            {chatData.map(message => <Message data={message} key={message._id})/>}

    </>
}

However, the problem here is that the timeout is a poor man's trick, as oftentimes not all the children will be rendered and thus the scroll ends up being somewhere in the middle, but nowhere near the end.
Any idea how to go about that?

A: You could use:
useEffect(() => {
        scrollToEnd();
    },[chatData])

It listens to every changes of the state chatData.

redpajama_set_name: RedPajamaStackExchange


text:
package com.tutsplus.mapsdemo.activity;

import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.maps.android.PolyUtil;

import java.util.List;

/**
 * Created by Paul on 9/7/15.
 */
public class PolylineActivity extends BaseMapActivity {

    private static final String polyline = "gsqqFxxu_SyRlTys@npAkhAzY{MsVc`AuHwbB}Lil@}[goCqGe|BnUa`A~MkbG?eq@hRq}@_N}vKdB";

    @Override
    protected void initMapSettings() {
        List<LatLng> decodedPath = PolyUtil.decode(polyline);

        mGoogleMap.addPolyline(new PolylineOptions().addAll(decodedPath));
    }
}


As far back as I can remember, I have loved art. When I was a wee girl my Dad used to draw for me & I loved watching him when he did. He was my idle then & always will be. It was always my dream to become an Artist. In 2007 I turned professional. When this happened I was ecstatic. My Mum passed away many years before this & I wish that she was here today to see me living my dream, she would have been so happy for me.
Over the years, inspired by my love of colour & texture, I have developed unique designs & techniques. Here's something to keep in mind, good Artists create, bad ''Artists'' copy.
I take pride in the fact that I only ever use top quality materials & as a result of this, I have built up a loyal client base. I would like to thank everyone for their continuing support and loyalty.
I have worked really hard at developing my artwork & was advised to become a member of ''ACID'', as their main objective is to change the current culture that it is ''OK to steal ideas & free-ride on another persons design equity.'' Intellectual Property theft is not a victimless crime.
My solicitors Macdonald Henderson Solicitors specialise in Intellectual Property/Copyright.
All copyright, design and other intellectual property rights in my designs and products (and in the images, text and design of this website) are and will remain the property of Alexis R Bradley. Any infringement of these rights will be pursued vigorously.
Photo taken of my proud Dad at one of my shows. He truly is my inspiration!


text:
Home > News > Moneygate Acquires City-Based IFA
Moneygate Acquires City-Based IFA
Newcastle-based financial services company, Moneygate Group Limited, has acquired Equus Independent Financial Management Limited in a deal advised by leading North East commercial law firm Muckle LLP.
Moneygate, which started in 2006 from headquarters in Newcastle, has acquired the City-based IFA business for an undisclosed sum.
The acquisition has seen Moneygate take on Equus 37 advisers and a further 34 staff taking Moneygate's total number of advisers to around 100 and increasing the total value of clients' funds it advises on by £1bn.
Lee Hartley, chief executive of Moneygate, said: ""We are delighted to have completed this acquisition, as it is a significant and strategic part of our build plan."
"We have been looking to make a City-based acquisition to build our London operation around. Equus is a fantastic business with a strong management team. We intend to support its growth through investment, the extension of our technology and marketing platform and also by leveraging our process capability to enhance efficiency.""
Philip Clare, associate solicitor at Muckle LLP, who advised Moneygate on the acquisition, said: We have worked with Moneygate for several years now and have advised them on a number of transactions. We are delighted to have played an important role on this deal and it is great to see a local business pushing ahead with its exciting growth plans.
Muckle prides itself on the strong relationships it has with its clients and I look forward to continuing to work with Moneygate in the future.
Moneygate is one of the UK's fastest growing independent financial advisory companies. From its beginnings in 2006 in Newcastle, it now operates across the whole of the UK including Scotland, Wales and Northern Ireland.
In support of the deal, Equus also recently moved into new 10,000 sq ft premises in Throgmorton Street in the City and its managing director will take up a new role within Moneygate.
Lee Hartley added, We have built an excellent relationship with Muckle and it is a real asset to work with a law firm that understands your business objectives when trying to execute an acquisition that is far from simple. This deal took around 12 months to complete and the advice we received from Muckle throughout the process was invaluable.""
Above photo from left to right: Lee Hartley (Moneygate) and Philip Clare (Muckle LLP).
For more information on how Muckle can help your business, please telephone Philip Clare on 0191 211 7971, e-mail [email protected] or visit our website, www.muckle-llp.com.


Only Johan Walles can upload to this branch. If you are Johan Walles please log in for upload directions.
Fix ScoredLocation comparators to take into account last-use timestamps.
Fix ScoredLocation hashCode() and equals() implementations.
Add last-used fields to ScoredLocation.
Add project specific compiler and javadoc warning settings.
Add frame layout that got lost in the beautification.
It's "Storstockholms Lokaltrafik", not anything else.
Thanks to Markus Ohlin for the heads up.
Improve naming in NamedLocation and add support for storing address-only named locations without any coordinates associated with them.


text:
newswire article reposts global 09.Sep.2003 22:34
anti-racism | human & civil rights | imperialism & war
Pentagon targets Latinos and Mexicans to front the endless war
author: repost Independent
The global elite is now recruiting across the border for fodder for the endless war on terror.
Pentagon targets Latinos and Mexicans to man the front lines in war on terror
By Andrew Gumbel in Los Angeles
With the casualty rate in Iraq growing by the day and President George Bush's worldwide "war on terrorism" showing no signs of abating, a stretched United States military is turning increasingly to Latinos - including tens of thousands of non-citizen immigrants - to do the fighting and dying on its behalf.
Senior Pentagon officials have identified Latinos as by far the most promising ethnic group for recruitment, because their numbers are growing rapidly in the US and they include a plentiful supply of low-income men of military age with few other job or educational prospects.
Recruitment efforts have also extended to non-citizens, who have been told by the Bush administration that they can apply for citizenship the day they join up, rather than waiting the standard five years after receiving their green card. More than 37,000 non-citizens, almost all Latino, are currently enlisted. Recruiters have even crossed the border into Mexico - to the fury of the Mexican authorities - to look for school-leavers who may have US residency papers.
The aim, according to Pentagon officials, is to boost the Latino numbers in the military from roughly 10 per cent to as much as 22 per cent. That was the figure cited recently by John McLaurin, a deputy assistant secretary of the army, as the size of the "Hispanic ... recruiting market", and it has also been bandied about in the pages of the Army Times.
But while officials praise the willingness of Mexican Americans and other Latinos, the strategy has been denounced by anti-war groups as a cynical exploitation of impoverished young men who are lined up to be little more than cannon fodder.
Rick Jahnkow, of the Committee Opposed to Militarism and the Draft, said: "They are vulnerable economically. That's why they are targeting them. [These people are] going to provide them with the means to carry out future wars."
Recent statistics from the Pew Hispanic Centre, a non-partisan think-tank, show that Latinos are already doing the most dangerous combat jobs in disproportionate numbers. While they are still under- represented in the armed forces as a whole - they made up 9.4 per cent of enlisted men in 2001, compared with 13.4 per cent of the general population - they are over-represented in jobs that involve handling weapons (17.7 per cent).
In Iraq, the first US casualty was a Latino non- citizen, a Guatemalan orphan raised in Los Angeles called Jose Gutierrez. Although a precise breakdown of ethnic numbers is not available, the Pentagon's list of dead and wounded has included dozens of Spanish names. At least 10 out of almost 300 dead have been non-citizens.
An ethnic group has never before been the target of such a recruitment drive.
In the Vietnam war, when the US military was still conscripting soldiers for compulsory service, the de facto characteristic of the men who did the fighting and dying was class. Poor people - whether black, white or Mexican - were much more likely to be drafted, and more likely to find themselves in the front lines.
Now the military operates what Mr Jahnkow calls a "poverty draft" - selling itself as an attractive career option or stepping stone to further education in communities that have few other options. In the poorer parts of the country, army recruiters talk to children as early as primary school. At a predominantly Latino high school in east Los Angeles, students became so exasperated by the presence of army recruiters at careers fairs that they began a campaign to get rid of them with the slogan "students not soldiers".
Such activities are apparently common even across the border. A recruiter in San Diego told an Army radio show: "It's more or less common practice that some recruiters go to Tijuana to distribute pamphlets, or in some cases they look for someone to help distribute the information on the Mexican side." A recruiter who visited a technical high school in Tijuana in May triggered a diplomatic incident after the headmaster threw him out and the Mexican government protested vehemently to Washington. The army subsequently sought to deny that this was standard practice.
© 2003 Independent Digital (UK) Ltd
Wolfowitz Modifies Iraq Claims 10.Sep.2003 00:59
Project for a New American Catastrophe link
"No one said we would know anything other than this would be very bloody, it could be very long and by implication it could be very expensive," he said.
No one said 10.Sep.2003 05:13
anonymous link
What an interesting sentence. That Wolfy is SUCH a smart guy.
No one said it would be anything OTHER than very bloody. Therefore no one said it would be very bloody either. By implication of what "no one said" it could be very expensive.
I'm all for having smart people in positions of power.
But smart and immoral and/or insane is NOT acceptable.
Wolfy will go to hell if there is any justice in this universe. I hope he hears all the moans and screams of all the people who have suffered because of his policy. People of all nationalities.


text:
Q: All combinations that equals or exceed a given number It is different from the coin-changing problem link.
Given a dict x=[a:1,b:2,c:1,d:3,e:2], I need to calculate all possible combinations of the keys such that the sum of the values associated with those keys just exceeds or equals a given value, say 5. Just exceeding 5 means that if the selected elements are lower than 5, we can add one more element even if it exceeds 5 but once we exceed or equal 5, no more elements can be added.
There are two issues that are complicating my approach -

*

*Note that some of the values are repeated-e.g. 1 and 2 each occurs twice and they need to be considered separately.

*Ordering matters in this case.

Ordering matters too so [b,c,d], [b,d,c], [c,b,d], [c,d,b], [d,b,c], [d,c,b] are all included separately. Ideally ordering matters only when we are exceeding 5 and as long as the sum is exactly 5, ordering doesn't matter.
So some of the solution to the above question are [a,b,c,d] with sum 7, [a,b,c,e] with sum 6, [b,c,d] with sum 6, [d,e] with sum 5 etc.
How do I approach the problem. I was thinking of using the output from coin changing and then adding one element to each of the resulting lists, but that will not cover all the cases.
EDIT 1: A better way of framing the question might be to find all combinations such that the sum (i) equals 5 or (ii) just exceeds 5 as the sum until the second last element was less than 5 and therefore adding the last element made it greater than 5. Once we have 5 or >5, no additional elements will be added.
EDIT 2: Clarifying the ordering issue. To give a bit of context, the keys are devices and the values are the resources it needs. And the total resources available is 5. And the devices are allocated resources as per their keys i.e. the first key-value pair will be serviced first (sorted as per the key alphabetically). For b, it needs 2 but say only 1 resource is available - it will be assigned 1 and the remaining 1 will be assigned in the next run (spillover). So when the sum is exactly 5, the order doesn't matter as each gets whatever it wanted and there is no spillover to the next slot. E.g. ed and de means both get what they wanted so they should both be included.
But for lists that exceed 5 just due to the addition of the last element, ordering matters as spillover will happen only for the last element. E.g. dce means d and c get 3 and 1 respectively, and e gets only 1 (with 1 spilling into next run). Similarly ced means c and d get 1 and 3 respectively, with spillover happening for d as it only gets assigned 1.

A: Updated Answer
More detail about the requirements have been added to the question.  I think this version matches them.  But the expected output structure was not specified, so this is a guess.  It ends up with an array of results like this:
{initial: {a: 1, b: 2, c: 1}, last: {d: 3}}

or like this:
{initial: {b: 2, c: 1, e: 2}}

It does this by first finding all subsets of the initial values, together with their complements, using the function partitions.  partitions (['a', 'b', 'c', 'd']) would have sixteen elements including [['a', 'b', 'd'], ['c']], [['b', 'd'], ['a', 'c']], and [[], ['a', 'b', 'c', 'd']].
Then, for each partition, if its sum of the left half is equal to the target we include it.  If the sum is less than the target, we include a result for every value in the right half that brings us over the target.
Here's an implementation in Javascript:

// utility functions
const last = (xs) =>
  xs [xs .length - 1]

const partitions = (xs) =>
  xs .length === 0
    ? [[[], []]]
    : partitions (xs .slice (0, -1)) .flatMap (([p, q]) => [
        [[...p, last (xs)], q],
        [p, [...q, last (xs)]]
      ])

// helper function
const total = (xs) =>
  xs .reduce ((a, [k, v]) => a + v, 0)

// main function
const sumTo = (n, xs, parts = partitions (xs)) =>
  parts .flatMap (([incl, excl], _, __, t = total (incl)) => [
    ... (t == n ? [{initial: incl}] : []),
    ... (t < n
           ? excl .filter (([k, v]) => v + t > n)
                  .map (e => ({initial: incl, last: [e]}))
           : []
        )
  ])

// public function
const subsetSum = (n, dict) =>
  sumTo (n, Object.entries (dict))
    .map (({initial, last}) => ({
      initial: Object .fromEntries (initial),
      ... (last ? {last: Object .fromEntries (last)} : {})
    }))

// sample data
const dict = {a: 1, b: 2, c: 1, d: 3, e: 2}

// demo
console .log (subsetSum (5, dict))
.as-console-wrapper {max-height: 100% !important; top: 0}

We start with a trivial helper function, last, which simply selects the last element of an array.  Then we have partition, already described above.  Our main function is sumTo, which does the work described.  Its inputs are the target number and a structure like [['a', '1], ['b', 2'], ['c', 1], ['d', 3], ['e', 2]], which is easy to derive from a dictionary but is easier to work with.   It returns an object with two properties, something like {initial: [['a', 1], ['b', 2], ['c', 1]], last: [['d', 3]]}.  Finally we have out public function subsetSum, which converts from the dictionary format to the input needed for sumTo and then converts the result back into the output format.  This would be easy to fix to create whatever output format you need.
With a little formatting of the output, we can see our results more simply:
subsetSum  (5, dict)
  .map (({initial, last}) =>
      Object .keys (initial) .join ('') +
      (last ? '-' + Object .keys (last) .join ('') : '')
  )
//=> ["abc-d", "abc-e", "abe", "ab-d", "acd", "ace-b",
//    "ace-d", "ad-b", "ad-e", "ae-d", "bce", "bc-d",
//    "bd", "be-d", "cd-b", "cd-e", "ce-d", "de"]

This is likely ill-performant.  I don't have a real sense of the likely growth patterns of the problem.  But this algorithm is exponential in the size of the dictionary, and there's no way around it for this technique, as the subset problem at the heart of partitions has 2 ^ n results.
But it might be a starting point to compare with for other solutions.
Original Answer
If all orderings matter (and I'm confused by the details of that requirement), then this algorithm should do it, using a list of entries each with a key and a value:
if (n <= 0) or if our list of entries is empty,
  return a list containing only the empty string
otherwise return the concatenation of the following lists, one for each entry:
  a recursive call passing
    - `n - value`
    - the list excluding the current entry,
  with each result being prepended with the current entry's key

If you're comfortable with Javascript syntax, then this should work:

const excluding = (i) => (xs) =>
  [...xs .slice (0, i), ...xs .slice (i + 1)]

const sumTo = (n, xs) =>
  n <= 0 || xs.length == 0
    ? ['']
    : xs .flatMap (
        ([k, v], i) => sumTo (n - v, excluding (i) (xs)) .map (r => k + r)
      )

const subsetSum = (n, dict) =>
  sumTo (n, Object .entries (dict))

const dict = {a: 1, b: 2, c: 1, d: 3, e: 2}

console .log (subsetSum (5, dict))
.as-console-wrapper {max-height: 100% !important; top: 0}

It's hard to imagine that order could be entirely irrelevant, since 'cde' should fit but 'dec' should not.  But I don't understand the notion that order is only relevant when the total exceeds the target.  Can you explain more fully?


The platform in question here is the CMF C-D platform which will act as a base for both the models. Until now, Nissan was likely to launch X-Trail in a diesel version, but it seems Nissan is planning to roll out a petrol version of the SUV instead. Pricing is expected to be on a higher side as Nissan could import the car to India, Buy and Sell cars in Delhi, therefore, heavy duties levied on the SUV will bump up the price substantially. But to everyone's respite, being a hybrid X-Trail will also be benefitted by the FAME India scheme.
Design language will be inspired heavily from other global models of Nissan. Exterior styling will be plusher featuring a couple of new elements. Buy and Sell cars in Delhi The boxy and mundane design will be ditched for a curvier silhouette. Moreover, the SUV is likely to be leaner than before shedding off the heavy stance.
Comprehensive changes are expected to be made to the cabin donning a modish avatar, unlike previous generation model which featured suave styling. The third-generation X-Trail will get seven-seat layout allowing seven occupants to be seated inside.
Nissan was expected to launch X-Trail in a diesel engine option earlier but the company will reportedly roll out a petrol hybrid version of the SUV in India. Under the engine, hood could be a 2.0-litre petrol engine along with an electric motor generating a combined output of 179 Bhp. Buy and Sell cars in Delhi An electric motor will also be fitted inside. Transmission duties might be carried out by a CVT gearbox. Besides, the SUV will also house Nissan's electric all-wheel drive system.The Nissan X-Trail specifications that would be offered in India would have a 2.0-litre petrol engine developing 179bhp of power along with electric motors that would be put to use via CVT transmission system and an electric all-wheel drive system. Nissan X-Trail reviews are out where the car has already been launched and the impressions have so far been impressive.
The Nissan X-Trail price in India would be between 30 – 35 lacs bracket and it would compete against Hyundai SantaFe, Honda CR-V, Toyota Fortuner, Ford Endeavour etc. Nissan X-trail colours should include Black, White, Silver, Dark Blue, Dark Olive, Gray and Orange as they are available in other worldwide markets while Nissan X-trail variants would be very limited considering the engine sizes that would be on offer.
The Nissan X-trail 2016 would be making its debut again at the Delhi AutoExpo 2016, the new car was showcased at the Geneva motor show in the year 2013. The SUV was discontinued in the year 2014 last time following low sales volume. The car uses CMF (Common Module Family) architecture that has been developed along with Renault. The sleeker looks of the SUV has been inspired from the family of SUVs that include the Pathfinder, Juke, Murano, Qashqai, etc.
The SUV is sleeker and unlike its predecessor that was powered by a 2.0-litre diesel engine, this one would be powered by a 2.0-litre petrol and would use hybrid technology too. There are no covers on the Nissan X-Trail images and the car would be a strict five-seater. It would be benefitted from the FAME India scheme and offer significant benefits to the customers and offer about 400 litres of boot space. A full wheel drive system and features like active ride height would impact the car its needed Buy and Sell cars in Delhi credentials making it worthy of SUV tag. Some other technologies that might be present in the car emergency braking system and intelligent park assist.
Nissan X-Trail features what the company calls Nissan Connect would most likely be present and would offer the latest generation of Navigation coupled with information and entertainment system with the capability for smartphone apps mirroring on the screen and other features like voice control, email and SMS readout etc.
Since the car would most likely be a CBU unit, Nissan X-Trail interiors and other design features would significantly be the same. The V-motion grille is flanked by stylish looking headlamps that come integrated with DRLs. Apart from that "Hybrid" badges would be present on the left, right and tailgate door.


text:
HomeSportsFootballNFLAnd Then There Were Two
And Then There Were Two
January 18, 2012 NFL, Sports
The NFL playoffs have been outstanding so far and Championship Sunday should not be anything less than riveting. There has been record-breaking offense and blistering, ball hawking defense. There have been close games and some blowouts along with tremendous stories of personal redemption and achievement. The reason we love the NFL is that on any given Sunday anything can happen. It is such an emotional ride! Whether you still have a dog in the hunt, or are just another diehard pigskin fan, there is every reason to watch Sunday.
The NFC takes to primetime on Sunday with the fourth-seeded New York Giants traveling way out west to take on the second seeded San Francisco 49ers at Candlestick Park. These two teams have taken different paths to the Championship Game but it's safe to say they are both playing their best football when they need to most, right now.
It has been a season of ups and downs for the Giants, who began the season 6-2 before losing five of their next six games. The midseason funk left the G-Men in a must win position the last two weeks of the season to earn their NFC East division crown, and their first trip to the postseason since the '07 season. That was the year the Giants beat the undefeated Patriots in the Super Bowl preventing the Pats from completing a perfect 19-0 season. The big key for the Giants turnaround has been on the defensive side of the ball, where they have gotten healthy, and are playing at a championship level. The Giants have only given up more than 14 points once in their current four-game win streak. That came Sunday against, "All World," Aaron Rodgers and the Packers who scored 20 points on the Giants defense in New York's 37-20 victory. The Giants defense disrupted Rodgers and the Packers offense all night forcing three fumbles and an interception in the game. Rodgers completed only 50 percent of his pass attempts and at times was more effective running the ball out of the pocket than making plays with his arm. The Giants defense will be facing 49ers' quarterback Alex Smith in the championship game, who has a long way to go to be mentioned in the same breath with Rodgers.
If the Giants were inconsistent this season the San Francisco 49ers were quite the opposite going 13-3 winning a poor NFC West Division. Alex Smith's long awaited and often doubted maturity into an NFL caliber quarterback can and should be credited to working under first year head coach Jim Harbaugh. The former Stanford Cardinal head man came to the Niners NFL ready with his experience as a player and a coach. Harbaugh has brought a new attitude to the Bay that has converted Smith and tight end Vernon Davis from good football players into championship contenders in just one season. The 49ers play big boy smash mouth football under Harbaugh and their second ranked scoring defense will be ready for Eli Manning and the Giants.
This should be a classic "gut check" game. This will be a defensive struggle with the winner likely being the team that makes the least mistakes and not necessarily the team that makes a few big plays. The Packers and the Saints can attest to that. Those big play offenses were shut down by these two defenses in the divisional round. The 49ers beat the Giants 27-20 back in Week Ten of the season, but this is a different Giants team. This will be one to definitely have your popcorn ready for!


This category features specimens from a S. California collection famous for its quantity over quality.
Pages in category "Selections from the Mountain Groan Collection"
The following 200 pages are in this category, out of 6,124 total.
This page was last modified on 30 September 2012, at 18:59.


text:
use item::*;
use character::Attribute;
use rand::Rng;
use rand;
use names::{Generator, Name};
use types::AttributeValue;

/// A builder like generator for items. Missing fields are filled randomly
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct ItemGenerator {
    data_name: Option<String>,
    data_item_type: Option<ItemType>,
    data_influence: Option<Option<ItemInfluence>>,
    data_stack_size: Option<usize>,
    data_rarity: Option<ItemRarity>,
}

impl ItemGenerator {
    /// Constructs a new `ItemGenerator`.
    ///
    /// # Examples
    ///
    /// During contruction, empty fields will be filled with random values. The following example
    /// constructs a random legendary sword.
    ///
    /// ```
    /// # use rpg::item_generator::ItemGenerator;
    /// # use rpg::item::{ItemType, ItemRarity};
    /// let item = ItemGenerator::new()
    ///     .item_type(ItemType::WeaponSword)
    ///     .rarity(ItemRarity::Legendary)
    ///     .gen();
    /// ```
    pub fn new() -> ItemGenerator {
        ItemGenerator {
            data_name: None,
            data_item_type: None,
            data_influence: None,
            data_stack_size: None,
            data_rarity: None,
        }
    }

    /// Sets the `name` of the item
    pub fn name(mut self, name: &str) -> ItemGenerator {
        self.data_name = Some(name.to_owned());
        self
    }

    /// Sets the `item_type` of the item
    pub fn item_type(mut self, item_type: ItemType) -> ItemGenerator {
        self.data_item_type = Some(item_type);
        self
    }

    /// Sets the `influence` of the item
    pub fn influence(mut self, influence: Option<ItemInfluence>) -> ItemGenerator {
        self.data_influence = Some(influence);
        self
    }

    /// Sets the `stack_size` of the item
    pub fn stack_size(mut self, stack_size: usize) -> ItemGenerator {
        self.data_stack_size = Some(stack_size);
        self
    }

    /// Sets the `rarity` of the item
    pub fn rarity(mut self, rarity: ItemRarity) -> ItemGenerator {
        self.data_rarity = Some(rarity);
        self
    }

    /// Generates the item using the given data. Missing data will be filed randomly
    pub fn gen(&self) -> Item {
        // The item type
        let item_type = if let Some(ref inner_item_type) = self.data_item_type {
            inner_item_type.clone()
        } else {
            random_item_type()
        };

        // The item rarity
        let rarity = if let Some(ref inner_rarity) = self.data_rarity {
            inner_rarity.clone()
        } else {
            random_item_rarity()
        };

        let influence = if let Some(ref inner_influence) = self.data_influence {
            inner_influence.clone()
        } else {
            let is_none = rand::thread_rng().gen::<bool>();
            if is_none || item_type.attributes().is_empty() {
                None
            } else {
                Some(ItemInfluence {
                    attribute: random_influence_attribute(&item_type),
                    amount: random_influence_amount(&rarity),
                })
            }
        };

        // The stacksize, the item can grow to (1 if not stackable)
        let stack_size = if let Some(ref inner_stack_size) = self.data_stack_size {
            *inner_stack_size
        } else {
            random_stack_size(&item_type)
        };

        // The name of the item
        let name = if let Some(ref inner_name) = self.data_name {
            inner_name.clone()
        } else {
            random_item_name(&item_type)
        };

        Item {
            name: name,
            item_type: item_type,
            influence: influence,
            stack_size: stack_size,
            rarity: rarity,
        }
    }
}

fn random_influence_attribute(item_type: &ItemType) -> Attribute {
    let mut attrbute_set = item_type.attributes();
    if attrbute_set.is_empty() {
        Attribute::Charisma
    } else {
        let index = rand::thread_rng().gen_range(0, attrbute_set.len());
        attrbute_set.remove(index)
    }
}

fn random_influence_amount(item_rarity: &ItemRarity) -> AttributeValue {
    let mut rng = rand::thread_rng();
    let result = match *item_rarity {
        ItemRarity::Common => rng.gen_range(-1, 10),
        ItemRarity::Uncommon => rng.gen_range(1, 50),
        ItemRarity::Rare => rng.gen_range(10, 100),
        ItemRarity::Epic => rng.gen_range(50, 250),
        ItemRarity::Legendary => rng.gen_range(100, 500),
    };

    if result == 0 { 1 } else { result }
}

fn random_item_name(item_type: &ItemType) -> String {
    match *item_type {
        ItemType::WeaponSword | ItemType::WeaponHammer | ItemType::WeaponWand => {
            random_weapon_name()
        }
        _ => Generator::with_naming(Name::Plain).next().unwrap(),
    }
}

fn random_weapon_name() -> String {
    let mut weapon_names: Vec<String> = vec!["Sword", "Boulder", "Wand", "Dagger", "Hammer",
                                             "Rifle"]
        .into_iter()
        .map(|string| String::from(string))
        .collect();

    let weapon_name = rand::thread_rng().gen_range(0, weapon_names.len());
    let weapon_name = weapon_names.remove(weapon_name);

    let mut weapon_prefixes: Vec<String> = vec!["Shiny", "Firey", "Wonderous", "Giant"]
        .into_iter()
        .map(|string| String::from(string))
        .collect();

    let weapon_prefix = rand::thread_rng().gen_range(0, weapon_prefixes.len());
    let weapon_prefix = weapon_prefixes.remove(weapon_prefix);

    let mut weapon_suffixes: Vec<String> = vec!["Nashioce",
                                                "Gobloygro",
                                                "Vuskia",
                                                "Lawhos",
                                                "Shiyle",
                                                "Steiwana",
                                                "Ashington",
                                                "Ustistan",
                                                "Plez Chium",
                                                "Staej Slua",
                                                "Ospaewana",
                                                "Wespeugua",
                                                "Cuchein",
                                                "Keflya",
                                                "Speyle",
                                                "Swainia",
                                                "Eswijan",
                                                "Uswein",
                                                "Scok Slya",
                                                "Proz Drana",
                                                "Decruecia",
                                                "Vospoydan",
                                                "Xesneau",
                                                "Japlax",
                                                "Scuecia",
                                                "Dreina",
                                                "Uswela",
                                                "Usten",
                                                "Smen Snana",
                                                "Glan Gra",
                                                "Puswaenia",
                                                "Jepraoles",
                                                "Pasla",
                                                "Ewhium",
                                                "Floulia",
                                                "Plioso",
                                                "Aplurg",
                                                "Escines",
                                                "Groyt Thington",
                                                "Fleiw Flen"]
        .into_iter()
        .map(|string| String::from(string))
        .collect();

    let weapon_suffix = rand::thread_rng().gen_range(0, weapon_suffixes.len());
    let weapon_suffix = weapon_suffixes.remove(weapon_suffix);

    format!("{} {} of {}", weapon_prefix, weapon_name, weapon_suffix)
}

fn random_item_type() -> ItemType {
    rand::thread_rng().gen::<ItemType>()
}

fn random_item_rarity() -> ItemRarity {
    rand::thread_rng().gen::<ItemRarity>()
}

fn random_stack_size(item_type: &ItemType) -> usize {
    let mut base_sizes = vec![4, 16, 64];
    if item_type.is_stackable() {
        let index = rand::thread_rng().gen_range(0, base_sizes.len());
        base_sizes.remove(index) as usize
    } else {
        1
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use character::Attribute;
    use item::{ItemType, ItemRarity, ItemInfluence};
    use rand;
    use rand::Rng;

    #[test]
    fn builder_item_type() {
        let mut rng = rand::thread_rng();
        for _ in 0..2000 {
            let rnd_type = rng.gen::<ItemType>();

            let rnd_item = ItemGenerator::new().item_type(rnd_type.clone()).gen();

            assert_eq!(rnd_item.item_type, rnd_type);
        }
    }

    #[test]
    fn builder_name() {
        let random_name = String::from("Totally random item");

        let rnd_item = ItemGenerator::new().name(random_name.clone().as_str()).gen();

        assert_eq!(rnd_item.name, random_name);
    }

    #[test]
    fn builder_influence() {
        let influence = Some(ItemInfluence::new(Attribute::Strength, 123));
        let rnd_item = ItemGenerator::new().influence(influence).gen();

        let item_influence = rnd_item.influence.unwrap();

        assert_eq!(item_influence.attribute, Attribute::Strength);
        assert_eq!(item_influence.amount, 123);
    }

    #[test]
    fn builder_stack_size() {
        let rnd_item = ItemGenerator::new().stack_size(45).gen();

        assert_eq!(rnd_item.stack_size, 45);
    }

    #[test]
    fn builder_rarity() {
        let rnd_item = ItemGenerator::new().rarity(ItemRarity::Rare).gen();

        assert_eq!(rnd_item.rarity, ItemRarity::Rare);
    }
}


text:
Lisa Ling addresses crowd at Finger Lakes
Hilary Smith
Sep 26, 2007 at 12:01 AM Sep 26, 2007 at 7:28 AM
Lisa Ling has sought to take Americans to remote, forgotten places through her reporting in hopes they'll reach out to people in other countries.
With an enormous smile and deep-set almond eyes, Lisa Ling looks much younger than her 34 years. Yet when she speaks, it's with the voice of a confident, well-tested foreign correspondent who has seen and documented some of the most devastating — yet hopeful — stories of the human condition.
As the featured speaker in the Finger Lakes Community College Foundation's annual Visiting Scholars Series, Ling shared some of her reporting experiences with an audience of students, staff and members of the community at the Constellation Brands-Marvin Sands Performing Arts Center on Tuesday night.
There was plenty to tell. Ling has been a journalist for almost half her life.
She got her big break in the news business at 18, when after two years hosting a teen variety talk show she was hired as a correspondent for Channel One News.
"I was hired, I think, to be one of their cute fashionable reporters," Ling said of the news network, which broadcasts to middle and high schools across the country. "But then they started sending me to cover stories in the world, and it just opened my eyes in a way that propelled me to want to continue to do this kind of work."
"It's infectious," she added. "Once you have the opportunity to see how the rest of the world lives, it's hard to pretend that it doesn't exist."
Ling worked with Channel One for seven years as one of eight globe-trotting reporters ranging in age from 18 to 26. CNN host Anderson Cooper was also among the ranks.
One of Ling's most memorable assignments with Channel One was covering Afghanistan's civil war in 1994. It was her first trip to an active war zone.
"When I got off the plane, I descended into this throng of young boys carrying weapons that were literally as large as they were," she recalled.
More jarring than being surrounded by armed soldiers was "the look of lifelessness in those children's eyes." Ling said she couldn't help wondering what would happen to those boys in 10 years, since they had no educational prospects and no real future outside of the war and their duties as child soldiers.
When Ling returned to the U.S., she couldn't believe the lack of empathy among many Americans toward war-torn and poverty-stricken countries like Afghanistan. She decided then that she would make a career out of reporting from areas of the world that the American public would often rather ignore.
During Ling's seven years with Channel One, she visited more than 30 countries, including Colombia, Cambodia, Iraq, Iran and Nigeria.
When Ling aged out of Channel One's cohort — "I ceased to have the 90210-effect," she said — she took over the "young seat" on the women's talk show "The View," joining co-hosts hosts Joy Behar, Star Jones Reynolds, Meredith Vieira and Barbara Walters.
Ling enjoyed her role on the show, which she described as "empowering" yet "light and funny." She liked that "five women of different generations could discuss everything from politics to Tom Cruise's personal life."
Ling's heart was elsewhere, however, and she found it "stifling" to be in the studio every day. She had also come under fire for comments she made after the Sept. 11, 2001 attacks, when she asked Americans to think about why
the hijackers attacked them.
In 2002, Ling took the job as host of the TV documentary series "National Geographic Explorer," becoming the series' first female host. Since then, she has also become a special correspondent for the Oxygen Channel and the "Oprah Winfrey Show" and produced eight documentaries for Public Broadcasting Services Television.
She has reported from war zones in Colombia and Iraq and documented social tragedies such as the spreading American methamphetamine epidemic. She has gone under cover in North Korea to learn what life is like under Kim Jong Il and taken a camera inside maximum security prisons.
And her investigative pieces have raised more than just awareness for the causes they address. As an example, Ling cites a recent "Oprah" piece reporting on gang rape in the Congo.
"Not only did that episode get a higher rating than the episode with Matt Damon and Hilary Swank, but in one day of television, $2.5 million was raised" for a foundation that benefits the rape survivors, she said.
What sets Ling's brand of journalism apart is her determination to uncover the multiple perspectives of an issue. She called this "finding the duality in every story" and stressed the importance of "getting the facts on the ground" rather than relying on pre-existing judgments.
Ling's open-minded reporting has helped her see the strength of the human spirit in the oddest of places — in prisoners sentenced to a life behind bars, impoverished Indian women acting as surrogate mothers for wealthy Western families, and shell-shocked residents of New Orleans who lost their homes, belongings and livelihoods in hurricanes Katrina and Rita.
Every soldier, every prisoner "just wants to be heard," said Ling. "At the end of the day, everyone has a story to tell."
And once those stories of loss, violence and tragedy — and humanity — are told, and told well, it becomes harder to ignore them, said Ling.
"Now that you know, you can't pretend that you don't," said Ling, quoting her friend and inspiration, Oprah Winfrey.
Hilary Smith can be reached at (585) 394-0770, Ext. 343, or at hsmith@mpnewspapers.com.


text:
L.A. Phil delivers a dazzling reimagining of 'Nixon in China'
Ryan McKinny as Richard Nixon, left, Joélle Harvey as Pat Nixon, center right, John Matthew Myers as Mao, right, and Peter Coleman-Wright, left, perform with the L.A. Philharmonic as a large projection screen shows TV footage from China in a performance of "Nixon In China" at the Walt Disney Concert Hall on March 3, 2017, in Los Angeles.
(Patrick T. Fallon / For The Times)
Ryan McKinny as Richard Nixon, left, Joélle Harvey as Pat Nixon, John Matthew Myers as Mao, and Peter Coleman-Wright.
John Matthew Myers as Mao, left, and Ryan McKinny as Richard Nixon.
Actors as Chinese communists perform with the LA Philharmonic as a large projection screen shows TV footage from China of Air Force One arriving at the airport in a performance of "Nixon In China."
John Adams, center bottom, conducts the Los Angeles Master Chorale with the L.A. Philharmonic.
By Richard S. Ginell
Very few works can claim to have launched a trend, but John Adams' "Nixon in China" certainly can. A wag called it "CNN Headline Opera," a somewhat pejorative tag that didn't stick. But the concept — basing theater pieces on recent news events and personalities — did take hold, and a whole trail of operas, quasi-operas, monodramas, song cycles and such have followed since the "Nixon" debut at Houston Grand Opera 30 years ago.
"Nixon" took hold, too — much to the composer's surprise, establishing itself in the general operatic repertoire. It has not been easy for some — myself included — who lived and sweated through the Richard Nixon years to fully come to terms with this opera's myth-making mix of facts and fantasies about that period. And when aggrandizing accolades start flying — the Los Angeles Philharmonic website says many regard this as the great American opera — it's time to shout, "Now hold on thar!"
But after hearing Adams, now 70, lead the L.A. Phil in a musically and visually dazzling reimagining of the piece Friday night in Walt Disney Concert Hall, I have to reassess. Dropping "Nixon in China" directly into its historical frame was a brilliant idea that erased labels that have been imposed upon this work — like satirical opera, heroic opera and, closer to the mark, surreal opera — and went right back to the source.
Stage director Elkhanah Pulitzer, allied with film designer Bill Morrison and scenic and projection designer Alexander V. Nichols, rummaged through the archives in search of film of the 1972 Nixon visit to China. She found some 22 transferred reels of super 8mm home movies (Nixon's chief of staff H.R. Haldeman and deputy assistant Dwight Chapin shot a lot of amateur film) and used them as scenery for this semi-staged production.
The films were shown on a scrim, upon which the projected frame of a 1960s television set was superimposed. The vintage TV screen confronted the audience entering Disney Hall with footage of crowds surrounding the White House awaiting the departure of the Nixons for China.
The L.A. Phil performs with the Los Angeles Master Chorale on the Disney Hall stage, backed by a projection screen made to look like a vintage TV playing historical footage during "Nixon in China." (Patrick T. Fallon / For The Times)
Ultimately, the most astonishing thing was how well the films were integrated with Alice Goodman's libretto, Adams' music and, to my amazement, the live cast members themselves. In the pre-concert talk, the ever-irreverent Adams described the crescendo leading to the emergence of the Nixon plane in Act I as an "enormous sugar high." But the actual home movie taken from inside the Spirit of '76 as it descends onto the Chinese landscape gave the music even more punch than did Peter Sellars' startling original staging. For Pat Nixon's tour in Act II, when the libretto mentioned a pig farm, an elephant or Chinese schoolchildren, found film for each appeared on screen, and that made soprano Joélle Harvey's soliloquies as Pat more heartfelt.
Placing the singers on the semicircular platform in back of the orchestra or behind the scrim gave most of the audience enough distance so that when we saw Pat Nixon in her red coat on the big screen, Harvey looked like her double. As Nixon, bass-baritone Ryan McKinny must have studied old films to replicate so effectively the hunched-over Nixonian posture, and when Nixon's notorious "News" aria came to the paranoid line "the rats begin to chew the sheets," the lighting suddenly went in shadow, alluding to his dark side.
The live cast in the foreground, echoed by historical footage in the background. (Patrick T. Fallon / For The Times)
John Matthew Myers as Mao Tse-tung, left, and Ryan McKinny as President Nixon. (Patrick T. Fallon / For The Times)
SIGN UP for the free Essential Arts & Culture newsletter »
In profile, baritone Peter Coleman-Wright looked uncannily like the real Henry Kissinger, seeming less of a sinister presence than has been the case in previous productions. Tenor John Matthew Myers' Mao Tse-tung was brightly lighted to match his declaiming voice, while the penetrating coloratura soprano Kathleen Kim (Madame Mao) convincingly switched from hard-line ideologue in Act II to the seductress of memory in Act III. Baritone Joo Won Kang made hushed, delicate work of Premiere Zhou Enlai's moody closing aria.
The amusing souvenir programs. (Richard S. Ginell)
Liberated from the opera pit and handled by a first-class orchestra, Adams' score has never sounded as clear, nor as attractive. I would credit Adams' increased experience and rapport with the L.A. Phil, as well as his enormous growth as an opera composer since "Nixon," for revealing many unexpected shadings and complexities, and making the Richard Strauss/Wagner parody in Act II blossom voluptuously. The Los Angeles Master Chorale sang with its habitually keen diction; choreographer Leslie Stevens placed the garishly red-lighted depiction of "The Red Detachment of Women" ballet within the TV screen along with period film of the dancers.
The more this production reflected real history, the better it went down. And kudos for whoever had the idea of designing miniature souvenir programs that imitated Mao's "little red book." Nice touch.
♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦
L.A. Phil's 'Nixon in China'
Where: Walt Disney Concert Hall, 111 S. Grand Ave., L.A.
Tickets: $53-$183 (extremely limited availability, prices subject to change)
Running time: 2 hours, 45 minutes (with one intermission)
Follow The Times' arts team @culturemonster.
Times art critic Christopher Knight's latest reviews
Times theater critic Charles McNulty's latest reviews
Times architecture critic Christopher Hawthorne's latest columns
Times music critic Mark Swed's latest review
Hundreds in publishing sign letter objecting to book deals for the Trump administration
More than 250 members of the literary community signed a letter this week urging publishers not to sign book deals with anyone in the Trump administration.