javascript – Google Places Autocomplete API to exclude specific countries

I’m using google places autocomplete api. My main problem is i try to exclude spesific countries but there is no option inside google places api docs. So i try to give all other countries like:

//More then 5 countries
const allowedCountries=('en','be','ai','ad','ag' ...)
types: ('(regions)'),
componentRestrictions: {country: allowedCountries}

But it’s only allows to first 5 country. Other’s not working. How to i resolve this?

algorithm – Implementing an autocomplete system

Implement an autocomplete system. That is, given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix.
For example, given the query string de and the set of strings (dog, deer, deal), return (deer, deal).
Hint: Try preprocessing the dictionary into a more efficient data structure to speed up queries.

What I tried to do:
Implement prefix tree is way to go as researched from internet. So without looking at actual implementation code, I just grabbed the idea and wrote down the code to challenge myself. Of course code is a messy, but will be really appreciated if someone could advice on how it can be improved in terms of efficiency and simplicity.

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define ALP_PREFIX 97 //for numeric value of alphabets

typedef struct stTree
    struct stTree *nLetter(26);
    bool isLastChar;
    char value;
} stTree;

stTree* createNode(void)
    stTree *node = malloc(sizeof *node);
    node->value = '';
    node->isLastChar = false;
    return node;

stTree* insertNode(stTree *currNode, char value, bool isLastChar)
    if (!currNode->nLetter(value - ALP_PREFIX))
        stTree *node = malloc(sizeof *node);
        node->value = value;
        currNode->nLetter(value - ALP_PREFIX) = node;

    currNode->nLetter(value - ALP_PREFIX)->isLastChar = isLastChar;    
    return currNode->nLetter(value - ALP_PREFIX);

stTree* treeTraverse(char *chars, stTree *Node)
    stTree *nextNode = Node->nLetter(chars(0) - ALP_PREFIX);
    if (nextNode && chars(0) != '')
        return treeTraverse(chars + 1, nextNode);
        return Node;

void autoComplete(stTree *Node)
    for (int i = 0; i < 26; i++)
        if (Node->nLetter(i))
            printf("%c", Node->nLetter(i)->value);
            if (Node->nLetter(i)->isLastChar)



int main(void)
    stTree *rootNode = createNode();

    insertNode(insertNode(insertNode(insertNode(rootNode, 'c', false), 'a', false), 'r', false), 't', true);
    insertNode(insertNode(insertNode(rootNode, 'c', false), 'a', false), 'r', true);
    insertNode(insertNode(insertNode(rootNode, 'c', false), 'a', false), 't', true);

    char a() = "ca";
    printf("%c%c->n", a(0), a(1));

    stTree *lastNode = treeTraverse(a, rootNode);







It means, autocompleted words are: car, cart, cat

dropdown – Combining a drop-down with autocomplete and search

This is where a proper label helps. In your example, you have no labels above to indicate what you’re asking the user to select.

You’re correct in that this is a common UI control. You have a couple of abilities and indicators you can add here; allowing a ‘clear’ function, and proper labeling.

You don’t need the additional ‘please select’ instructions inside the dropdown. If it’s a complex instruction or reason, you can make the label clearer, or even add ‘hint text’ below the dropdown, so users can have some clarity.

enter image description here

magento2 – Browser autocomplete for address fields in checkout

I am tryng to get browser autocomplete (The HTML autocomplete attribute
) to work for the checkout address fields but I am not having much success or many ideas.

Autocomplete does work for company and telephone fields but not for others – tested with chrome 86.

The only thing I tought to try was adding attribute autocomplete=”given-name” to firstname field and that didn’t work.

Has anyone done this already and can point me in the right direction?

7 – Autocomplete field where title is replaced with NID

I’m using Drupal 7 and I have made autocomplete function to be called on a field.

File my_module.module:


function my_module_menu() {
    $items = array();

    $items('/autocomplete') = array(
        'title' => 'Autocomplete',
        'page callback' => 'companyAutocomplete',
        'access arguments' => array('autocomplete'),
        'type' => MENU_LOCAL_TASK,
        'weight' => 1,
        'file' => ''
    return $items;



function companyAutocomplete($fieldInput) {

    $returnArray = array();

    $query = db_select('node', 'n')
        ->fields('n', array('nid', 'title'))
        ->condition('n.title', '%'.db_like($fieldInput).'%', 'LIKE')
        ->condition('n.type', 'company', '=')
        ->orderBy('n.title', 'ASC')
        ->range(0, 10);

    // print strtr((string) $query, $query->arguments());

    $results = $query->execute();

    foreach ($results as $result) {
        $returnArray($result->title) = check_plain($result->title);


File template.php:


function my_theme_preprocess_field(&$vars) {

    if ($node = menu_get_object()) {

        if ($node->type == 'company') {

            if ($vars('element')('#field_name') == 'field_company') {
                $company = entity_metadata_wrapper('node', $vars('items')('0')('#markup'));
                $vars('items')('0')('#markup') = $company->label();

and I have a field company (I use this field to enter NID):

$form('field_company') = array(
    '#type' => 'textfield',
    '#default_value' => $defaultCompany,
    '#title' => 'Company',
    '#autocomplete_path' => '/autocomplete',

When I type something in field, autocomplete returns correct text value of the searched term and that is ok.

How can I modify companyAutocomplete() function or the field itself for autocomplete to works as it is, but to write NID instead title in $form(‘field_company’)(‘und’)(0)(‘value’)?

css – How do I integrate jQuery-ui autocomplete styling into my public scss?

I’m helping to maintain a plugin I did not original author.

The similar sounding posts I’ve read are older, and I understand the process for adding this support has changed to these steps:

  1. Enqueue the script associated with the widget.

In my functions.php, I have:

  1. Download and customize the jquery-ui.css.

This is where I seem to be stuck.

The plugin uses scss files compiled for distribution. In my public.scss I have added

    @import 'jquery-ui.css';

This gets picked up and the widget box appears with the minimal styling.

However, when I try to override or add custom classes later in our scss file…

    .ui-autocomplete-loading {
      background-color: red;

    .ui-autocomplete-category {
      font-weight: bold;
      padding: .2em .4em;
      margin: .8em 0 .2em;
      line-height: 1.5;
      background-color: red;

…these styles seem to get ignored.

I suspected my problem was due to my lack of css skills so put together a plain html/script demo. By doing so I was able to get the styling I wanted outside of WordPress. The issue appears to be with how I’m trying to do this in the WordPress environment.

I’ve read others say to use ThemeRoller, but we have styles I’m trying to adhere to, and I didn’t find any useful documentation about how to use ThemeRoller. I figured a small amount of customization would make more sense.

What do I need to do differently?

Kibana Elasticsearch query autocomplete outside Kibana

I’ve started dumping several hunderds of GBs to Elastic Search in an attempt to make my query faster through denormalization. They are faster indeed!

At this point I would like to exposed the data directly to our internal users, with just one little restrictions:


given an index defined as

PUT my_denormalized_index/_mapping
   "properties": {
     "allowedUsers": [ARRAY OF SOME SORT],
     "all_the_rest_of_secret_data": { 
       "type": "nested"

I want that my users are able to query only the data in which their ID is within “allowedUsers”.

Options Evaluated

  • giving straight access to Kibana –> I’m new to ES, but my understanding is that they would have full access
  • giving them access to a proxy that every time they create a query will also add match{allowedUsers: contains myId1}

Hence, since I believe that ES search is not Newby-friendly, I would like to give the same autocomplete experience you would have in Kibana, but using this kind of proxy.

Any advice?

Own lines in Chrome prediction (Omnibox addressbar autocomplete)

I would like to get predictions from my intranet-wiki into chrome.

In this example I type "teame" and get some results for "teamevent"


How could I integrate our cooperate intranet/wiki there?

What is Google Suggest or autocomplete?

Hello friends,

What is Google Suggest or autocomplete?


Girl Vashikaran mantra | Wazifa for love marriage Islamic vashikaran mantra

Where is autocomplete in Google?

Hello friends,

Where is autocomplete in Google?