theming – Resize “Select” Webform Element

I’m rather new with Drupal and especially the webform module. I’ve created a basic form with one of the elements being a “Select” type. When I referenced the form on my page, my drop-down (select) element is slightly hidden behind my right-side panels. Is there any way to shrink the text field so there’s no overhang (see attached image for reference)?

I’ve tried messing around with the different attributes settings and adding custom CSS to see if I can resize the textfield, but no success. I’m not sure if I’m adding it correctly which explains if it’s not working. I feel like it’s probably something simple, but I simply cannot figure it out. Any help is greatly appreciated.enter image description here

co.combinatorics – Given index $i$, what element is at position $i$ in sorted subsets

Given a number $n in mathbb{N}$, you can create the following sequence:

$n, n-1, n-2, …, 2, 1, n, n-1, n-2, …, 3, 2, …, …, n$

For example, when $n = 4$, the sequence would be

$4, 3, 2, 1, 4, 3, 2, 4, 3, 4$

Given an index $i$ (you can assume it is within range of the sequence), can you calculate what the number will be at position $i$ for sequence generated using $n$?

For example $i = 6$ and $n = 4$, the element at position $i$ in the sequence would be $3$.

I know that sequence is all (sorted) subsets you can make with $n$ elements written after each other and you can enumerate all subsets, but I’m stuck ‘linking’ the index to the number in the sequence.

android Studio UI element can’t work offline?

i’m new to Android Studio,i’m using android studio version 4 each time i create a new project it ask’s me to download UI elements like CardView,GridLayout…here in my area internet connection is too slow and i’m trying to use android studio offline.i’m able to download the elements for single project but not for all.
really needs your help guys.

java – Find max non-adjacent element subset sum

This question is regarding this hackerrank problem which has the following statement:

Given an array of integers, find the subset of non-adjacent elements with the maximum sum. Calculate the sum of that subset.

This seems similar to the Subset Sum Problem but I’m still not being able to solve it.

This is my current solution, based on the idea of considering the current element as part of the solution or not (and in the former case just skip the next element):

    static int maxSubsetSum(int() arr, int i, Integer() m) {
        if (i < 0) return 0;
        if (m(i) != null) return m(i);

        int sol1 = arr(i) + maxSubsetSum(arr, i-2, m);
        int sol2 = maxSubsetSum(arr, i-1, m);

        int result = Math.max(sol1, sol2);
        m(i) = result;
        return result;
    }


    static int maxSubsetSum(int() arr) {
        return maxSubsetSum(arr, arr.length - 1, new Integer(arr.length));
    }

I’m getting a Runtime Error and I don’t understand why. Do you see something weird with this implementation?

Thanks in advance.

dynamic programming – Find max non-adjacent element subset sum

This question is regarding this hackerrank problem which has the following statement:

Given an array of integers, find the subset of non-adjacent elements with the maximum sum. Calculate the sum of that subset.

This seems similar to the Subset Sum Problem but I’m still not being able to solve it.

This is my current solution, based on the idea of considering the current element as part of the solution or not (and in the former case just skip the next element):

    static int maxSubsetSum(int() arr, int i, Integer() m) {
        if (i < 0) return 0;
        if (m(i) != null) return m(i);

        int sol1 = arr(i) + maxSubsetSum(arr, i-2, m);
        int sol2 = maxSubsetSum(arr, i-1, m);

        int result = Math.max(sol1, sol2);
        m(i) = result;
        return result;
    }


    static int maxSubsetSum(int() arr) {
        return maxSubsetSum(arr, arr.length - 1, new Integer(arr.length));
    }

I’m getting a Runtime Error and I don’t understand why. Do you see something weird with this implementation?

Thanks in advance.

PageSpeed Insights, WebP and CSS picture element

Hello,

I recently launched a new website. It scores 100/100 on PageSpeed Insights but PSI gives me the suggestion to use next-gen image formats. And I would love to! My very optimized banner is about 200k in jpg but about 75k in webp. However, Safari doesn’t support webp. It is starting to support webp with the new Safari 14 (Sept 2020) BUT it seems that’s only if it’s Safari 14 used on the new OS/iOS, Big Sur. Since Big Sur does not support my iMac (and I believe adoption will be too low for the time being) I can’t rely on Safari’s webp support.

So, I turn to CSS and the <picture> element. Great, a jpg banner for Safari and a webp banner for everyone else. Awesome, it works! Except suddenly my PSI score drops and my Cumulative Layout Shift goes way up.
SEMrush

I really want to use webp images but can’t have a big white box appear for Safari users. And I don’t want to compromise my PSI score. Does anyone have a suggestion on how to solve this issue? Thanks for your help!

 

8 – How to get/print value of webform entity reference element in custom entity-print–webform-submission–testing.html.twig file

I have my webform “Testing” with some field element(field1, field2, etc…) and “person” that is entity reference element(entity automplete) that reference user.

So, I create may custom file entity-print-submission–testing.html.twig file for theming PDF.
With this {{ data.field1 }} {{ data.field2 }} i can render the value for that field, but this {{ data.person }} render the ID of user select in webform.

I want to render field surname that is present in user profile. I have try to use {{ data.person.entity.field_surname }} but return empty value.

In submission display option for person element I set custom and put this token in Item format custom HTML and Item format custom TEXT:

{{ webform_token('(webform_submission:values:person:entity:field_surname)', webform_submission) }}

This work only in submission display. It’s not render in my custom entity print twig file.

google – How To Validate Secure Traffic from Chrome with Element To Matrix.org on Linux

Are you familiar with the Element chat system of https://app.element.io ? Are you familiar with its connections to Matrix.org (for a free account)? Is there a way that I can sniff this traffic on the OS when I hit the enter key on a message so that I can confirm that Google Chrome on Linux only sends this encrypted message to Matrix.org and no other locations? A colleague believed that Google Chrome would send this same encrypted message block of data back to Google or some dubious location.

Note, I’m using Lubuntu Linux 19.10 and the Google Chrome (not Chromium) is the latest version.

magento2 – MagentoFrameworkExceptionLocalizedException: The XML in file Element ‘event’: Missing child element(s). Expected is ( observer )

i am getting below error in magento 2.4 and it is working fine in magento 2.3 and how can i resolve this one?

MagentoFrameworkExceptionLocalizedException: The XML in file “/var/www/html/magento240/app/code/PPPL/PhonePe/etc/frontend/events.xml” is invalid: Element ‘event’: Missing child element(s). Expected is ( observer ). Line: 4 Verify the XML and try again. in /var/www/html/magento240/vendor/magento/framework/Config/Reader/Filesystem.php:156 Stack trace: #0 /var/www/html/magento240/vendor/magento/framework/Config/Reader/Filesystem.php(132): MagentoFrameworkConfigReaderFilesystem->_readFiles() #1 /var/www/html/magento240/generated/code/Magento/Framework/Event/Config/Reader/Proxy.php(95): MagentoFrameworkConfigReaderFilesystem->read() #2 /var/www/html/magento240/vendor/magento/framework/Config/Data/Scoped.php(119): MagentoFrameworkEventConfigReaderProxy->read() #3 /var/www/html/magento240/vendor/magento/framework/Config/Data/Scoped.php(97): MagentoFrameworkConfigDataScoped->_loadScopedData() #4 /var/www/html/magento240/vendor/magento/framework/Event/Config.php(37): MagentoFrameworkConfigDataScoped->get() #5 /var/www/html/magento240/vendor/magento/framework/Event/Manager.php(58): MagentoFrameworkEventConfig->getObservers() #6 /var/www/html/magento240/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): MagentoFrameworkEventManager->dispatch() #7 /var/www/html/magento240/vendor/magento/module-customer/Model/Session.php(194): MagentoFrameworkEventManagerProxy->dispatch() #8 /var/www/html/magento240/generated/code/Magento/Customer/Model/Session/Interceptor.php(14): MagentoCustomerModelSession->__construct() #9 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): MagentoCustomerModelSessionInterceptor->__construct() #10 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject() #11 /var/www/html/magento240/vendor/magento/framework/ObjectManager/ObjectManager.php(70): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create() #12 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(167): MagentoFrameworkObjectManagerObjectManager->get() #13 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(273): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument() #14 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): MagentoFrameworkObjectManagerFactoryAbstractFactory->getResolvedArgument() #15 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgumentsInRuntime() #16 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments() #17 /var/www/html/magento240/vendor/magento/framework/ObjectManager/ObjectManager.php(70): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create() #18 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(167): MagentoFrameworkObjectManagerObjectManager->get() #19 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(273): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument() #20 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): MagentoFrameworkObjectManagerFactoryAbstractFactory->getResolvedArgument() #21 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgumentsInRuntime() #22 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments() #23 /var/www/html/magento240/vendor/magento/framework/ObjectManager/ObjectManager.php(70): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create() #24 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(167): MagentoFrameworkObjectManagerObjectManager->get() #25 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(273): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument() #26 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): MagentoFrameworkObjectManagerFactoryAbstractFactory->getResolvedArgument() #27 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgumentsInRuntime() #28 /var/www/html/magento240/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments() #29 /var/www/html/magento240/vendor/magento/framework/ObjectManager/ObjectManager.php(70): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create() #30 /var/www/html/magento240/vendor/magento/framework/Interception/PluginList/PluginList.php(250): MagentoFrameworkObjectManagerObjectManager->get() #31 /var/www/html/magento240/vendor/magento/framework/Interception/Interceptor.php(119): MagentoFrameworkInterceptionPluginListPluginList->getPlugin() #32 /var/www/html/magento240/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkAppHttpContextInterceptor->MagentoFrameworkInterception{closure}() #33 /var/www/html/magento240/generated/code/Magento/Framework/App/Http/Context/Interceptor.php(78): MagentoFrameworkAppHttpContextInterceptor->___callPlugins() #34 /var/www/html/magento240/vendor/magento/framework/App/Response/Http.php(108): MagentoFrameworkAppHttpContextInterceptor->getVaryString() #35 /var/www/html/magento240/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(37): MagentoFrameworkAppResponseHttp->sendVary() #36 /var/www/html/magento240/vendor/magento/module-page-cache/Model/App/Response/HttpPlugin.php(29): MagentoFrameworkAppResponseHttpInterceptor->sendVary() #37 /var/www/html/magento240/vendor/magento/framework/Interception/Interceptor.php(121): MagentoPageCacheModelAppResponseHttpPlugin->beforeSendResponse() #38 /var/www/html/magento240/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkAppResponseHttpInterceptor->MagentoFrameworkInterception{closure}() #39 /var/www/html/magento240/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(117): MagentoFrameworkAppResponseHttpInterceptor->___callPlugins() #40 /var/www/html/magento240/vendor/magento/framework/App/ExceptionHandler.php(103): MagentoFrameworkAppResponseHttpInterceptor->sendResponse() #41 /var/www/html/magento240/vendor/magento/framework/App/ExceptionHandler.php(70): MagentoFrameworkAppExceptionHandler->handleDeveloperMode() #42 /var/www/html/magento240/vendor/magento/framework/App/Http.php(156): MagentoFrameworkAppExceptionHandler->handle() #43 /var/www/html/magento240/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppHttp->catchException() #44 /var/www/html/magento240/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkAppHttpInterceptor->___callParent() #45 /var/www/html/magento240/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkAppHttpInterceptor->MagentoFrameworkInterception{closure}() #46 /var/www/html/magento240/generated/code/Magento/Framework/App/Http/Interceptor.php(39): MagentoFrameworkAppHttpInterceptor->___callPlugins() #47 /var/www/html/magento240/vendor/magento/framework/App/Bootstrap.php(269): MagentoFrameworkAppHttpInterceptor->catchException() #48 /var/www/html/magento240/index.php(54): MagentoFrameworkAppBootstrap->run() #49 {main}

7 – Checkbox Form Element: Displaying checkboxes value based on on/off

I have a checkbox form element that uses taxonomy terms via variable_get as #default_value; storing the result. I don’t want to overwrite value, I just want the form to render/display checked initially.

  $form('search_block_topic') = array(
    '#type' => 'checkboxes',
    '#options' => $topic_options,
    '#default_value' => variable_get('search_topic_options', $topic_options)

I tried
'#return_value' => "checked"
which doesn’t work.