Call the selected shipping method and display it on a page

How can the selected shipping option be displayed on a page?

I think I need to use

 

But that doesn't work, can anyone help me?

forms – How to display the label instead of the value in custom drupal 8 autocomplete?

I was doing a custom autocomplete field and it worked like when I write & # 39; a & # 39; It shows me the whole list of fruits with the letter & # 39; a & # 39 ;. But when I click on any of the options. I see the autocomplete field & # 39; value & # 39 ;.

I want the functionality where when the user writes & # 39; a & # 39; It should show & # 39; Apple & # 39 ;, & # 39; Avocado & # 39 ;. and when clicking on any of them the label & # 39; Apple & # 39; should appear no & # 39; fruit-1 & # 39; in the countryside.

The following is the code:

Custom Form:

 'textfield',
      '#title' => t('Searchfield'),
      '#autocomplete_route_name' => 'custom_google_search.autocomplete',
      '#value' => 'aaa11',
    );
  $form('search_in_us') = (
    '#type' => 'submit',
    '#value' => $this->t('Search'),
    );
      return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {

  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

  }
}

Autocomplete Controller:

query->get('q')) {
      $typed_string = Tags::explode($input);
      $typed_string = Unicode::strtolower(array_pop($typed_string));
      $trimed_string = preg_replace("/s+/", "+", $typed_string);
      $results = $this->showRelatedPlaces($trimed_string);
    }
    return new JsonResponse($results);
  }

  public function showRelatedPlaces($trimed_string) {
    try {
       $results = (
         (
           'value' => 'fruit-1',
           'label' => 'Apples',
         ),
         (
           'value' => 'fruit-2',
           'label' => 'Apricots',
         ),
         (
           'value' => 'fruit-3',
           'label' => 'Avocados',
         ),
       );
      return($results);
    } catch (RequestException $e) {
    return($this->t('Error occured.'));
  }
 }  
}

The problem is that when I write & # 39; a & # 39; in the autocomplete text field. It does show me the fruit label (Apple) but when I click on the fruit label. The value of the field shows & # 39; fruit-1 & # 39 ;. I want to show & # 39; Apple & # 39; when a user selects an option.

PD: I don't want to use the same value for the tag and the value. (Apple for label and value).

javascript: how do websites like eBay, amazon and airbnb send new user listing data to the server, store it and then display that data on the website?

I am new to web development and I want to create a website where users can create profiles. How do websites like eBay, Amazon and Airbnb take data from the data entered by users, store them and then reload them to the website?
What languages ​​or frames do they use? Databases?
I'm sorry, I'm new to this, so my question may not be very simple. Any information will help a lot, thanks!

stream: compare two map objects and display relative information Java 8

There is much to comment to be honest, and I'm sorry, but I wouldn't consider the code even close to the best practice.

Code review in order of appearance:

public static String getAllExecTimes(MasterVO masterVO, boolean displayAll) {

Static methods should be avoided, why not create an object that performs formatting?

Boolean parameters are not a good idea. They are quite illegible. But in this case it is worse, since the displayAll doesn't give any clues to a user of what really it is unfolded. What about an enumeration, p. enum Display {DISPLAY_MAP_C_ONLY, DISPLAY_MAPS_A_B_C;}?

Map durationMap = null;
Map orderMap = null;
List keys = null;

Never create instances of variables before they are needed in Java, and do not use the same variable reference for two different maps (A and C). This generates a very error-prone code, especially if you are starting to assign null to the variables, which should almost Never be necessary. Create separate methods when the code is very similar or when variable names begin to collide.

durationMap = masterVO.getMapA();
orderMap = masterVO.getOrderMap();

You know, a map is a mapping of a set of keys to values. However, it only has duration and order, and it is not even clear what the key is and what the value is.

keys = new ArrayList<>(orderMap.keySet());
keys.sort(new CustomComparator());

Now this is not right. If you put the keys in a TreeSet instead, they will be sorted during insertion. Even better, why not use a TreeMap and then order when you set the Map?

if (null != target) {

First, you just have to write this as if (target != null) {; This is a well-known antipatron for Java, it is simply not necessary and impairs readability.

The most important question is why would you allow null values ​​on that map first. Even without knowing the design, I have the feeling that null values ​​should be avoidable in this case, especially since keys without values ​​are simply omitted in the resulting string.

if (null != masterVO.getMapB()) {

Now it seems that complete maps are missing in action. Use Optional<...Map> instead.

private static final class CustomComparator implements Comparator {

    public int compare(Integer first, Integer second) {
        return first.compareTo(second);
    }
}

Seriously, how is this custom comparator different from normal whole sorting?

8 – Document file size display

I am trying to show the size of a file next to a media link button on a page.

I have two types of content with a media entity reference field in each. Each field is restricted to extract only from one type of file medium. What I was trying to do was create a twig variable using a field preprocess and pop that variable into each of my field templates. However, my preprocessing below does not seem to show the file size as I want. What am I doing wrong?

function theme_preprocess_field(&$variables, $hook) {

  $pdf_fields = (
    'field_1',
    'field_2'
  );

  if (in_array($element('#field_name'), $pdf_fields) && $element('#entity_type') == 'node') {

    if ($variables('items')(0)) {

      $field_name = $element('#field_name');

      $node = $element('#object');
      // Get first referenced media id.
      $media_id = $node->$field_name->target_id;
      // Get file object.
      $file = DrupalfileEntityFile::load($media_id);
      if ($file) {
        // Get file size.
        $file_size = format_size($file->getSize());
        // Set file size variable.
        $variables('file_size') = $file_size;
      }
    }
  }
}

Twig Field Template

{% for item in items %}
  Download Paper(PDF | {{ file_size }})
{% endfor %}

display – Add 32: 9 ultra wide resolution

having trouble getting Ubuntu 18.04 to display correctly with an aspect ratio of 32: 9. I can add a new mode with xrandr to get the correct resolution and refresh rate, however, save those resolutions as 16: 9 instead of 32: 9, so it stretches a lot. How do I change the aspect ratio? The display settings only natively gives me one option: 1920×1080 (16: 9).

My monitor is 5120×1440 @ 120hz (32: 9)

How to display all web form data with the REST export?

I am trying to export all the data of a specific web form using Rest Export.

I can get all the data in a Json when I select export FIELDS -> Represented entity

but the JSON is created incorrectly.

I need the json object but I also need the properties like

Full Nome: Paulo

Email: x

Nascimento Data: x

enter the description of the image here

plugins – How to create and display data from a custom table using wordpress

Battery exchange network

The Stack Exchange network consists of 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers to learn, share their knowledge and develop their careers.

Visit Stack Exchange

linux – how to configure `DISPLAY` in acpid scripts

I have several users connected and I use acpid to listen sleep key to turn off screen usage xset dpms force off I send.

I can't turn off the screen because acpid runs and runs scripts as root. and I know how to configure correctly DISPLAY. because each connected user has their own screen, and I don't know which one is currently displayed. maybe GNOME He knows, but I don't know how to find out.

angular – How to make the function display an array of objects correctly?

I have a function:

getEmployees(val: any): void {
this._employeeService.getEmployees(val).subscribe((result) => {
  this.employee = result.items;

  this.dataGrid.length = 0;
  for (let i = 0; i < this.employee.length; i++) {
    console.log(this.employee(i).name);
    this.dataGrid.push({
      'Number': this.employee(i).number,
      'Name': this.employee(i).name,
      'Department': this.employee(i).departmentFk.name,
      'City': this.employee(i).cityFk.name,
    });
  }
});

export class Employee { Number: number; Name: string; Department: string; City: string; }

dataGrid: Employee() = ();

What is happening is that it shows this error:

Console error

but all the fields in the this.employee array are full ... I don't understand why the error.

Thank you in advance for your help.