Replicating the norwegian flag using CSS

so here I am trying to get some reviews from my code, where I have to replicate the norwegian flag using flexbox.

First to be sayed is that my teachers told me to divide the flag in two sections, where I have had to insert two of the four squares in eachone, but I ignored this since with declarations like align-content: space-between; I could send the four squares right to the corners and play with margins to adjust them, that’s why I just created 4 containers (white squares) with its respective item (red squares).

Before I show my code, I want to tell that it was so diffuicult to me to deal with the size of the elements, first a try to use flex-basis: ; and flex-grow: ; to automatically give size to the squares, but this does’nt work for me, so I have to use width: ; and height: ;.

Due to all this I want to get reccomendations to improve my code or best alternatives to reach the objective and then a kind of explanation about the size of elements.

Here’s the code:

body{
    background-color: #00205B;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-content: space-between;
}
.white-square1, .white-square2, .white-square3, .white-square4{
    background-color: #ffffff;
    display: flex;
    align-content: flex-start;
    justify-content: space-between;
    align-items: flex-start;
}
.white-square1, .white-square3{
    margin: 0 50px 50px 0;
    height: 43.8vh;
    width: 25vw;
    flex-grow: 1;
}
.white-square2, .white-square4{
    margin: 0 0 50px 50px;
    height: 43.8vh;
    width: 50vw;    
    flex-grow: 2;
}
.white-square3{
    margin: 50px 50px 0 0; 
    align-items: flex-end;
}
.white-square4{
    margin: 50px 0 0 50px;
    align-items: flex-end;
}
.red-square1, .red-square2, .red-square3, .red-square4{
    background-color: #BA0C2F;
}
.red-square1, .red-square3{
    margin: 0 50px 50px 0;
    height: 37.8vh;
    width: 25vw;
    flex-grow: 1;
    margin-left: 0;
}
.red-square2, .red-square4{
    margin: 0 0 50px 50px;
    height: 37.8vh;
    width: 50vw;
    flex-grow: 2;
    margin-right: 0;
}
.red-square3{
    margin: 50px 50px 0 0; 
    align-items: flex-end;
}
.red-square4{
    margin: 50px 0 0 50px;
    align-items: flex-end;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://codereview.stackexchange.com/style.css">
    <title>Flexbox Actividad 3</title>
</head>
<body>
    <section class="white-square1">
        <div class="red-square1"></div>
    </section>
    <section class="white-square2">
        <div class="red-square2"></div>
    </section>
    <section class="white-square3">
        <div class="red-square3"></div>
    </section>
    <section class="white-square4">
        <div class="red-square4"></div>
    </section>
</body>
</html>

Flag variety as monoid and Schubert calculus

The lattice of linear subspaces in a vector space V can be provided with a structure of monoid by considering the subspace generated by the union of two subspaces as the monoid operation.
When looking at flags in V on could consider the sum of two flags using the monoid operation on subspaces. I guess it is then possible to provide flags with a structure of monoid (algebraic monoid ?).
How is reflected this monoid structure in terms of Schubert varities or Schubert classes or Schubert polynomials etc. ?
Thank you!

Problem with bitcoin-cli -datadir flag

I moved my blockchain directory, including bitcoin.conf, to an external drive D:Bitcoin. Bitcoin Core starts and runs normally using this path, however when I try to use the command line interface, even when I specify the new directory, I keep running into this error.

C:Program FilesBitcoindaemon>bitcoin-cli -datadir=D:Bitcoin -getinfo 

   error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is  not set. See -rpcpassword and -stdinrpcpass.

I know that the issue is that bitcoin-cli is still looking in the default directory C:Users<username>AppDataRoamingBitcoin because when I copy the auth .cookie and bitcoin.conf files to to old directory my commands work.

Wondering if the -datadir flag is not working properly, if I made an error somewhere, or if there is another way to fix this? I have also tried using the -conf=D:Bitcoinbitcoin.conf flag, however that does not fix either.

Windows 10

8 – How to unflag/reset a flag again, when matching some conditions in onFlag event?

in my custom module I have an event subscriber service for flag module. I used the tutorial here as a base for learning: Link to Tutorial

Here is my code:

namespace DrupalMYMODULEEventSubscriber;

use SymfonyComponentEventDispatcherEventSubscriberInterface;
use DrupalflagEventFlagEvents;
use DrupalflagEventFlaggingEvent;
use DrupalflagEventUnflaggingEvent;
use DrupaluserUserInterface;
use DrupaluserEntityUser;

class MYMODULEFlagSubscriber implements EventSubscriberInterface {

  /**
   * Do the logic when the upgrade flag is triggered to flag.
   */
  public function onFlag(FlaggingEvent $event) {
    $flagging = $event->getFlagging();
    $flag = $flagging->getFlag();
    $flag_machine_name = $flag->id();
    if ($flag_machine_name === 'my_awesome_flag') {
      $entity_nid = $flagging->getFlaggable()->id();
      $user = User::load($entity_nid);
      $user_is_active = $user->isActive();
      $field_1 = $user->get('field_1')->value;
      $field_2 = $user->get('field_2')->value;
      $break_with_error = FALSE;
      $upgrade_message = '';
      $roles_to_ignore = (
        'administrator_junior',
        'team_sales',
        'administrator',
      );
      if (!$user->hasRole('authenticated_level_2')) {
        if (($user_is_active == TRUE) && ($field_1 == 1) && ($field_2 == 1)) {
          foreach ($roles_to_ignore as $role_to_ignore) {
            if ($user->hasRole($role_to_ignore)) {
              $break_with_error = TRUE;
              $upgrade_message = 'The User has a company role already and can not being upgraded as a Level 2 user.';
              break;
            }
          }
        }
        else {
          $break_with_error = TRUE;
          $upgrade_message = 'The User can not being upgraded as a Level 2 User. Reasons: 2. The account is not activated yet, 3. The user has not yet checked field 2';
        }
      }
      else {
        $break_with_error = TRUE;
        $upgrade_message = 'The User was upgraded as a Level 2 User already.';
      }

      switch ($break_with_error) {
        case TRUE:
          Drupal::messenger()->addError($upgrade_message);
          $flagging->unflag($flag_machine_name, $entity_nid);
          return;

        case FALSE:
          $user->addRole('authenticated_level_2');
          $user->save();
          Drupal::messenger()->addStatus('The User was upgraded as a Level 2 User sucessfully.');
          return;
      }

    }
  }

My Problem is

How can I unflag the flag again, when my logic checks settings and my variable $break_with_error becomes true?

$flagging->unflag($flag_machine_name, $entity_nid);

throws me an PHP error.

Update:

My intention was the following:

I use the flag here as a substitute for a link/button to trigger the “business logic” checks and to give the user a additional role with more privileges if the checks are passed.

In my opinion it’s a easy way to quickly have a link/button in multiple variants (e.g. in a view or as a field in user account). Another advantage is, that other people (in my case sales team or other admins) see the business logic checks have performed already when the user entity is flagged. But in case the logic checks are failing, the user entity should unflagged again.

For other opportunities to have a “business logic trigger” I’m open and thankful of course. 🙂

8 – Flag EventSubscriber: How to unflag/reset a flag again, when matching some conditions in onFlag event?

in my custom module I have an event subscriber service for flag module. I used the tutorial here as a base for learning: Link to Tutorial

Here is my code:

namespace DrupalMYMODULEEventSubscriber;

use SymfonyComponentEventDispatcherEventSubscriberInterface;
use DrupalflagEventFlagEvents;
use DrupalflagEventFlaggingEvent;
use DrupalflagEventUnflaggingEvent;
use DrupaluserUserInterface;
use DrupaluserEntityUser;

class MYMODULEFlagSubscriber implements EventSubscriberInterface {

  /**
   * Do the logic when the upgrade flag is triggered to flag.
   */
  public function onFlag(FlaggingEvent $event) {
    $flagging = $event->getFlagging();
    $flag = $flagging->getFlag();
    $flag_machine_name = $flag->id();
    if ($flag_machine_name === 'my_awesome_flag') {
      $entity_nid = $flagging->getFlaggable()->id();
      $user = User::load($entity_nid);
      $user_is_active = $user->isActive();
      $field_1 = $user->get('field_1')->value;
      $field_2 = $user->get('field_2')->value;
      $break_with_error = FALSE;
      $upgrade_message = '';
      $roles_to_ignore = (
        'administrator_junior',
        'team_sales',
        'administrator',
      );
      if (!$user->hasRole('authenticated_level_2')) {
        if (($user_is_active == TRUE) && ($field_1 == 1) && ($field_2 == 1)) {
          foreach ($roles_to_ignore as $role_to_ignore) {
            if ($user->hasRole($role_to_ignore)) {
              $break_with_error = TRUE;
              $upgrade_message = 'The User has a company role already and can not being upgraded as a Level 2 user.';
              break;
            }
          }
        }
        else {
          $break_with_error = TRUE;
          $upgrade_message = 'The User can not being upgraded as a Level 2 User. Reasons: 2. The account is not activated yet, 3. The user has not yet checked field 2';
        }
      }
      else {
        $break_with_error = TRUE;
        $upgrade_message = 'The User was upgraded as a Level 2 User already.';
      }

      switch ($break_with_error) {
        case TRUE:
          Drupal::messenger()->addError($upgrade_message);
          $flagging->unflag($flag_machine_name, $entity_nid);
          return;

        case FALSE:
          $user->addRole('authenticated_level_2');
          $user->save();
          Drupal::messenger()->addStatus('The User was upgraded as a Level 2 User sucessfully.');
          return;
      }

    }
  }

My Problem is

How can I unflag the flag again, when my logic checks settings and my variable $break_with_error becomes true?

$flagging->unflag($flag_machine_name, $entity_nid);

throws me an PHP error.

Thanks in advance 🙂

How to use the filter flag in drush config:status

If you look at the ConsolidationFilterOperatorFactory class mentioned with the error, you’ll see documentation at the top of the Class that outlines the acceptable syntax.

**
 * Convert a simple operator expression into an Operator.
 *
 * The supported operators include:
 *
 *      key=value           Equals
 *      key*=value          Contains value
 *      key~=#regex#        Regular expression match
 *
 * It is also possible to negate the result of an operator by
 * adding a logical-not operator either before the entire expression,
 * e.g. !key=value, or before the operator, e.g. key!=value.
 *
 */

Using the above documentation as a guide, the following all work for me – examples two and three should work for your example case.

// 1. Use the *Equals* option to show only the config entity with name "webform.webform.contact"
drush --filter="name=webform.webform.contact" config:status

// 2. Use the *Contains value* option to show any config entity with name containing "webform.webform"
drush --filter="name*=webform.webform" config:status

// 3. Use the *Regular expression match* option to show any config entity with name starting with "webform.webform."
drush --filter="name~=#^webform.webform.*#" config:status

bitcoin core – Is it possible to detect if flag -txindex is enabled using RPC?

You can use the getindexinfo RPC call to list (and get the status of) all the available indexes since version 0.21 (currently in rc3).

On my local bitcoind with (only) txindex enabled, here is the output:

$ bitcoin-cli getindexinfo
{
  "txindex": {
    "synced": true,
    "best_block_height": 660887
  }
}

chrome for android – Chome flag “Overscroll history navigation” by default

I have casually found this feature without having enabled anything in

chrome://flags.

Suddenly the option has disappeared.

Why this behaviour? I don’t understand why the feature was enabled, and I can’t see why it suddenly has disabled (I’ve found Default mode checked in flags section).

android – Flag not set on last RadioButton

My application uses onActivityResult to get an address, generate a RadioButton with that address, and set a flag on the last radioButton. On first launch it works. My problem is that after closing the activity and repeating the operation to add an address, no flag is set on the last radioButton. I tried to fix this by calling clearCheck() method while clicking navigationIcon in Toolbar, but it didn’t work

Adding an address and setting a flag

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (data == null) {
        return
    }
    val radioButton = RadioButton(this)
    radioButton.text = data.getStringExtra("ADDRESS")

    radioGroupAddress.apply {
        addView(radioButton)
        //Ставлю флаг на последний выбранный адрес
        check(radioGroupAddress.childCount)
    }
}