loop – How do I pass a default parameter value in a foreach in C #?

Dear friend

How can I pass a default parameter value in a foreach?

For example, in my foreach, I have an if that makes a certain comparison with an attribute of my correct class. However, in C #, when fetching the data of an attribute, I must by default pass which ID of the list position I want to receive for such data (for example, EmployeeList ().0) .getCode (), EmployeeList ()1) .getCode (), etc).

But my problem is that, I would like to get all the records with this attribute if I did not know the location of my ID (eg: EmployeeList (N) .getCode (), EmployeeList ()N) .getCode ()).

I do not know if I was very clear, but is there a "default" parameter or something that helps me in this case? grateful!

var ListaEmpregadosPorCodigo = ListaEmpregados.OrderBy(p => p.getCodigo());

foreach ( var codigo in ListaEmpregadosPorCodigo)
{
    int iCodigo = Convert.ToInt32(codigo.getCodigo());

    if (iCodigo == ListaEmpregados().getCodigo())
    {
        //Código
    }
}

amazon ec2 – What is the default password for EC2 Ubuntu?

I'm trying to execute the command systemctl enable mongod.service on an EC2 instance on Ubuntu, but it prompts me for the password for the ubuntu User. I do not use a password to connect to the server, and as far as I can remember I never set one. When I try to run passwdI am prompted to enter the user's existing password, but I do not have it (pressing Enter without unsuccessfully typing).

What is the default password? Can I stop with the root user? For some reason, the Ubuntu user had set a password by default, but root Not?

Set the default gateway for Wireguard clients

I've followed several instructions (here, for example) on how to set up a Wireguard server, but my client can never get the default gateway.

This is my eth0 on Ubuntu 18.04 Server:

eth0: flags=4163  mtu 1500
        inet 146.24.25.224  netmask 255.255.255.192  broadcast 146.24.25.255
        inet6 fe40::250:33ff:fe00:e892  prefixlen 64  scopeid 0x20
        ether 00:50:56:00:e8:88  txqueuelen 1000  (Ethernet)
        RX packets 52470  bytes 57437334 (57.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17989  bytes 1480755 (1.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Here is my wg0.conf on the server:

(Interface)
Address = 146.24.25.224/24
SaveConfig = true
PrivateKey = ****
ListenPort = 51820

(Peer)
PublicKey = ****

and my client configuration file:

(Interface)
PrivateKey = ****
Address = 146.24.25.224/24

(Peer)
PublicKey = ****
AllowedIPs = 0.0.0.0/0
Endpoint = 146.24.25.224:51820
PersistentKeepalive = 21

I can connect to the Wireguard and get an IP address, but my default gateway is always: 146.24.25.0

How can I fix this?

amazon web services – Optional user pool for AWS Cognito MFA – Why MFA is not enabled by default

In my AWS console, the user always sees SMS MFA-STATUS disabled, even though he asks for the MFA token through the API during login.

Steps followed

  • I have created a user pool via aws consolewith MFA optional

  • I've created a user under this user pool with an appended API code

  • After the NEW_PASSWORD_REQUIRED challenge, I logged in via api and received all the tokens

  • I changed the preference for MFA through API

  • Now I have logged in and this time I am asking for MFA code
    1. My problem is

    2. Regardless of whether the MFA is enabled or disabled through the API, my AWS console always displays the MFA status as DISABLED for that user.
    3. Another problem is that I want to enable MFA by default. The user can then disable MFA after logging in to MFA for the first time. Currently MFA is disabled by default.

      My login code is as follows

    AdminCreateUserRequest cognitoRequest = new AdminCreateUserRequest ()
    .withUserPoolId (cognitoConfig.getUserPoolId ())
    // .withUserPoolId ("us-east-1_vhXDAMWwN")
    .withUsername (signUpRequest.getUsername ())
    .withUserAttributes (new AttributeType (). withName (EMAIL) .withValue (signUpRequest.getEmail ()),
    new AttributeType (). withName (NAME) .withValue (signUpRequest.getName ()),
    new AttributeType (). withName (FAMILY_NAME) .withValue (signUpRequest.getLastname ()),
    new AttributeType (). withName (PHONE_NUMBER) .withValue (signUpRequest.getPhoneNumber ()),
    new AttributeType (). withName (EMAIL_VERIFIED) .withValue (Boolean.TRUE.toString ())
    .withTemporaryPassword (cognitoConfig.getTempPassword ())
    // Remove comment to suppress welcome e-mail and SMS
    //.withMessageAction(MESSAGE_ACTION_SUPPRESS)
    .withDesiredDeliveryMediums (DeliveryMediumType.EMAIL, DeliveryMediumType.SMS)
    .withForceAliasCreation (Boolean.FALSE);
    UserSignUpResponse userSignUpResponse = new UserSignUpResponse ();
    To attempt {
    AdminCreateUserResult createUserResult = cognitoClient.adminCreateUser (cognitoRequest);
    UserType cognitoUser = createUserResult.getUser ();
    if (cognitoUser! = null && cognitoUser.getUserStatus (). equals (FORCE_CHANGE_PASSWORD)) {
    // save / update users in rex db
    populateAndSaveUser (signUpRequest);
    userSignUpResponse.setName (cognitoUser.getUsername ());
    userSignUpResponse.setResult (SUCCESS);
    userSignUpResponse.setStatus (FORCE_CHANGE_PASSWORD);
    }
    } catch (exception ex) {
    Trigger new UserApiException (USER001, COGNITO_EXCEPTION, ex.toString ());
    }
    Code for setting the MFA settings
    // add the new password to the params map
    Map challengeParams = new HashMap ();
    challengeParams.put (USERNAME, username);
    challengeParams.put (PASSWORD, password);
    challengeParams.put (SMS_MFA_CODE, mfaCode);
    // fill in the challenge answer
    final AdminRespondToAuthChallengeRequest challengeRequest = new AdminRespondToAuthChallengeRequest ();
    challengeRequest.withChallengeName (ChallengeNameType.SMS_MFA)
    .withClientId (cognitoConfig.getClientId ())
    .withChallengeResponses (challengeParams)
    .withUserPoolId (cognitoConfig.getUserPoolId ())
    .withSession (mySession);

    magento2 – Magento 2 The lock for the cron group could not be activated: default

    We have just migrated our Magento 1 site to Magento 2. During some operations, the default cron group was no longer running. This happened after the data migration and possibly right after the first test jobs were issued. It's hard to determine the exact time. The only mistake we can see in this context is:

    report.WARNING: Could not acquire lock for cron group: default, skipping run [] []

    We tried to cut off the cron table, remove and reinstall cron, clear the cache, update the default group to run on a separate process, and run only the cron group. Every time we execute the command php-7.1 bin/magento cron:run --group defaultthe above error is logged.

    Initially, the index group did the same, but dissolved by itself.

    We just noticed that certain tasks were not performed when the order and shipping grids were not updated.

    We run Magento 2 Commerce v2.3.1.

    Command Line – Get Wifi Default from all detected SSIDs

    I want to get the WiFi standards from all detected SSIDs over the wireless interface in a Debian-like operating system. Ie a command line that distinguishes between 802.11a, 802.11b, 802.11g, 802.11n, 802.11ac,
    My wireless interface supports both 2.4GHz and 5GHz bands, as shown in the following driver description: Support for Atheros 802.11n wireless LAN cards

    So far, I've tried a few that did not bring me what I need, like:

    # nmcli device wifi list
    # nmcli connection show
    # wavemon
    # iw dev wlan0 scan
    # lshw -class network
    

    Is the default orientation specific to the hardware or software of mobile devices?

    I've noticed that switching between mobile applications sometimes changes the orientation of the UI, so I have to rotate the screen 180 degrees to point in the right direction. I assume that if the software or hardware recognizes the direction in which the user is holding the device, or at least the orientation in which the most recent application resides, the orientation should not be changed.

    This leads me to the question of whether there is actually a default orientation for devices that are configured in hardware, and whether there is also a configuration of the software (and that they are sometimes configured to conflict inadvertently).

    Is there a default orientation in landscape view for mobile devices? And if so, are they available in hardware and / or software configurations?

    sharepoint online – How do I parse JSON to return null as the default if the complex object is empty / null / undefined?

    Use the HTTP request to get an SP element. There are problems parsing JSON to return something for a zero object.

    Can return null for an empty string column, as shown below, as is done for a more complex object such as a search if no value is selected?

    {
    "type": "object",
    "properties": {
        "Area": {
            "type": "object",
            "properties": {
                "Id": {
                    "type": "integer"
                }
            }
        },
        "Package": {
            "type": ("string","null")
        }
    }
    

    If the object does not exist in the JSON output, no logic can be executed on the object.