Combine product attribute based on selection and compatibility
I'm trying generate cross-dependent product attribute dropdown-list.
With chosen option (from dropdown list) system generate appropriate variant id (based on chosen product attribute combinations from droplist).
Example: https://imgur.com/a/fXIMIcf
We have product X with SIZE and COLOR:
- 45mm, black
- 45mm, green
- 60mm, black
- 80mm, black
When we chose size 45mm, COLOR attribute droplist needs to be updated to black and green. And when we chose 60mm there will be only black option in COLOR.
My question is - How is possible to get variant id based on my selection
If you know any demos, tutorials, i would be glad if you'd sent them to me.
Thank you.
See also questions close to this topic
-
Generating multiple combinations of strings
I have a list of n letters as strings such as:
input: ["A", "B", "C", "D"]
What I need to do is create all possible combinations of these letters with given length, for example if:
L = 2 output: ["A", "B"], ["A", "C"], ["A", "D"], ["B", "C"], ["B", "D"], ["C", "D"] L = 3 output: ["A", "B", "C"], ["A", "B", "D"], ["A", "C", "D"], ["B", "C", "D"]
-
Combination of list element
I'm new to Python. I'm wondering is there a better way to modify my code. Below is my code using PyCharm. The result I wish to get is something like (ab and ac and ad and ae) or (ab and ac and ad and af)... Which are all the possible combination of the list a.
a = 'ab ac ad ae af bc bd be bf cd ce cf de df ef' b = a.split() for test in range(15): if test == 0: print( f'({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 3]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 4]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 5]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 6]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 7]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 8]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 9]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 2]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 4]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 5]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 6]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 7]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 8]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 9]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 3]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 5]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 6]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 7]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 8]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 9]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 4]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 6]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 7]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 8]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 9]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 5]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 7]}) or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 8]}) or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 9]}) or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 6]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 7]} and {b[test + 8]}) or ({b[test]} and {b[test + 1]} and {b[test + 7]} and {b[test + 9]}) or ({b[test]} and {b[test + 1]} and {b[test + 7]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 7]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 7]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 7]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 7]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 8]} and {b[test + 9]}) or ({b[test]} and {b[test + 1]} and {b[test + 8]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 8]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 8]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 8]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 8]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 9]} and {b[test + 10]}) or ({b[test]} and {b[test + 1]} and {b[test + 9]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 9]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 9]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 9]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 10]} and {b[test + 11]}) or ({b[test]} and {b[test + 1]} and {b[test + 10]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 10]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 10]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 11]} and {b[test + 12]}) or ({b[test]} and {b[test + 1]} and {b[test + 11]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 11]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 1]} and {b[test + 12]} and {b[test + 13]}) or ({b[test]} and {b[test + 1]} and {b[test + 12]} and {b[test + 14]})') print(f'or ({b[test]} and {b[test + 1]} and {b[test + 13]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 4]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 5]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 6]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 7]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 8]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 9]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 10]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 3]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 5]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 6]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 7]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 8]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 9]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 10]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 4]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 6]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 7]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 8]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 9]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 10]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 5]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 7]}) or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 8]}) or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 9]}) or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 10]}) or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 6]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 7]} and {b[test + 8]}) or ({b[test]} and {b[test + 2]} and {b[test + 7]} and {b[test + 9]}) or ({b[test]} and {b[test + 2]} and {b[test + 7]} and {b[test + 10]}) or ({b[test]} and {b[test + 2]} and {b[test + 7]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 7]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 7]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 7]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 8]} and {b[test + 9]}) or ({b[test]} and {b[test + 2]} and {b[test + 8]} and {b[test + 10]}) or ({b[test]} and {b[test + 2]} and {b[test + 8]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 8]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 8]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 8]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 9]} and {b[test + 10]}) or ({b[test]} and {b[test + 2]} and {b[test + 9]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 9]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 9]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 9]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 10]} and {b[test + 11]}) or ({b[test]} and {b[test + 2]} and {b[test + 10]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 10]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 10]} and {b[test + 14]})') print( f'or ({b[test]} and {b[test + 2]} and {b[test + 11]} and {b[test + 12]}) or ({b[test]} and {b[test + 2]} and {b[test + 11]} and {b[test + 13]}) or ({b[test]} and {b[test + 2]} and {b[test + 11]} and {b[test + 14]})')
-
How to create a method for different combinations in Java?
I am working on a currency converter. I need to create a method for each combination that exists which is really inconvenient. Is there something that can achieve this without having to make so many methods? for example: dollar to pound, pound to yuan, yuan to dollar, euro to pound, euro to dollar, euro to yuan, and more. Each combination are not using the same formula.
Here is a code which might be more understandable
public int convert(String from, String to, int value){ return value * 1.33; //convert Canadian Dollar to US Dollar }
But it only works with Canadian Dollar to US Dollar and not for other conversions
-
How to force a dropdown list to behave like a list box using javascript
I need to add
multiple
attribute to aselect list
, but unfortunately the dropdown list is not editable through HTML since it is a drag and drop feature of a CMS (Spiceworks user portal) I am using.The CMS is quite outdated; my only other option is to add checkboxes which would make the page extremely long, since there are a total of 15 options to select. (In my example, this is different)
There is no listbox option in the CMS, which is why I need to use javascript to force the dropdown to act like a listbox.
Please look here at what I tried to do: https://jsfiddle.net/jamiedewitz/sdyn0xqz/
Is there a way to force javascript to add the
multiple
attribute to the dropdown list or is this just wishful thinking? -
Swift DropDown Array
I want to put
dropDownName
as the datasource of dropDown, but I don't know what to do. This is the code to use the drop-down.@IBAction func selectAllocator(_ sender: UIButton){ httpclient.get(NetworkingAPI.getUserList).responseJSON {(res) in print(res.data) switch res.response?.statusCode{ case 200 : do { print("Major OK") let data = res.data let model = try JSONDecoder().decode(User.self, from: data!) print(model.userInfoResponses) self.userListModel.userInfoResponses.removeAll() self.userListModel.userInfoResponses.append(contentsOf: model.userInfoResponses) let indexPath = IndexPath() let userName = self.userModel[indexPath.row].name let userMajor = self.userModel[indexPath.row].major let dropDownName = userName + " (" + userMajor + ")" let dropDown = DropDown() dropDown.dataSource = [dropDownName] dropDown.show() dropDown.selectionAction = {[unowned self] (index: Int, item: String) in allocatorButton.setTitle("\(item)", for: .normal) allocatorItem = item } } catch { print("error") print(error) } case 401 : print("401 - Unauthorized") default : print(res.response?.statusCode) } }
This is Model.
private var userModel : [UserList] = [UserList]() private var userListModel : User = User()
struct User: Codable { var userInfoResponses : [UserList] = [UserList]() } struct UserList: Codable { var email = String() var name = String() var major = String() init(email: String, name: String, major: String) { self.email = email self.name = name self.major = major } }
-
Mui autocomplete search in nested dropdowns
Guys I am trying to create a react component where i need to implement the material ui autocomplete's search functionality but instead of a single level drop down structure, we have nested dropdowns. Each label inside the dropdown is clickable at all levels. Is that possible? If not is there any other way to achieve it?
Sample data and structure: https://codesandbox.io/s/upbeat-feynman-89ozi?file=/src/styles.ts
Expected Design:
Search in nested dropdowns -
How can I make WooCommerce Product Price in Category Page clickable?
On any product archive / category page I'd like to be able to click on the product price and have it take me to that products page just like clicking on the product image or title does by default. This is because I've used CSS to make the price look more like a button, here's an example.
This website is using the Astra Pro theme and WooCommerce.
-
Details of Google product calculator
I tried to use the product calculator
https://cloud.google.com/products/calculator/#id=f5b35a8e-b8a3-4412-a9f3-af00bfb113c6
and got a result of $67.91 in Cloud SQL
Does anyone know how this result comes up? because if I refer to this page
https://cloud.google.com/sql/pricing
it should be $52.28
=================
db-g1-small, $0.0455 > 8/5 hour (160h/month) > $0.0455 x 160 = $7.28
$0.090 per GB/month for HDD storage capacity > 500gb/month > $0.090 x 500 = $45
The grand total will be $52.28
-
Grey out Woocommerce sold out variation, but leave clickable
I would like to grey out my sold out variations. However I would like to leave these clickable. I know we can grey them out and disable the click... but this is not what I need.
Is there a way with this could be achieved at all? The reason I would like to leave clickable is so I can have a back in stock notifier, on the styles that are sold out.
Thanks,
-
Nuxt full static generated page issue with cyrillic URI
in my multilangague nuxt app with static target, i have an issue related to the static page generated:
the pages that need dynamic data on generation via asyncData and with ciryllic endocoedURI they can be accessed in 2 ways in the final dist:
http://localhost:3000/bg/%D0%B2%D0%B8%D0%BB%D0%B8-%D1%85%D0%B0%D0%BB%D0%BA%D0%B8%D0%B4%D0%B8%D0%BA%D0%B8 This URL fallback to the SPA page (the issue)
http://localhost:3000/bg/%D0%B2%D0%B8%D0%BB%D0%B8-%D1%85%D0%B0%D0%BB%D0%BA%D0%B8%D0%B4%D0%B8%D0%BA%D0%B8/ This is full static page
The problem is the "/" at the end of the second link and i don't know why this happens.
I use nuxt-i18n on my project (latest version) The path configuration inside my component is as follow:
nuxtI18n: { paths: { en: encodeURI(`/${process.env.VILLAS_EN}`), bg: encodeURI(`/${process.env.VILLAS_BG}`), ru: encodeURI(`/${process.env.VILLAS_RU}`) } },
inside the .env file i have these values:
VILLAS_EN = 'villas' VILLAS_BG = 'вили-халкидики' VILLAS_RU = 'халкидики-виллы'
Inside nuxt.config.js:
modules: [ '@nuxtjs/axios' ,['nuxt-i18n', { strategy: 'prefix_except_default', locales: [ //{ name: 'Italiano', code: 'it', iso: 'it-IT', file: 'it-IT.js' }, { name: 'Bulgarian', code: 'bg', iso: 'bg-BG', file: 'bg-BG.js' }, { name: 'Russian', code: 'ru', iso: 'ru-RU', file: 'ru-RU.js' }, { name: 'English', code: 'en', iso: 'en-US', file: 'en-US.js' }, ] , lazy: true , langDir: 'locales/' , defaultLocale: 'en' //, encodePaths: false , seo: true //, parsePages: false //, pages: i18nConfig.pages /* , detectBrowserLanguage: { useCookie: true, cookieKey: 'i18n_redirected', onlyOnRoot: true }*/ }]
I honestly don't know how to fix this issue. I made a test adding the final slash at all paths but it doesn't work. Thanks in advance for your help.
Below the complete nuxt.config.js
/* ** Load .env configuration base on profile ( development | staging | production ) */ /* ** Vuetify local settings */ import colors from 'vuetify/es5/util/colors' import axios from 'axios' require('dotenv').config() // import i18nConfig from './i18n.config' export default { ssr: true, target: 'static', publicRuntimeConfig: { apiBaseUrl: process.env.API_BASE_URL, apiBasePath: process.env.API_BASE_PATH, baseTitle: process.env.BASE_TITLE || 'SiteTitle', pathVillasEn: 'villas', pathVillasBg: 'вили-халкидики', pathVillasRu: 'халкидики-виллы', sendGridApiKey: process.env.SENDGRID_API_KEY, recaptcha: { siteKey: process.env.RECAPTCHA_SITE_KEY, }, contactFormApi: process.env.CONTACT_FORM_API, }, /* ** Headers of the page */ head: { // titleTemplate: '%s - ' + process.env.npm_package_name, // title: process.env.npm_package_name || '', titleTemplate: '%s - SiteTitle', title: process.env.BASE_TITLE || '', meta: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }, { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge' }, ], link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], }, /* ** Customize the progress-bar color */ loading: { color: '#f00' }, /* ** Plugins to load before mounting the App */ plugins: [ '~/plugins/axios', '~/plugins/helper', '~/plugins/calculator', //, '~/plugins/composition-api' ], /* ** Nuxt.js dev-modules */ buildModules: [ ['@nuxtjs/dotenv', { filename: '.env.' + process.env.NODE_ENV }], '@nuxtjs/axios', ['@nuxtjs/vuetify', { treeShake: true }], ['@nuxtjs/google-analytics', { id: process.env.GOOGLE_ANALYTICS }], ], /* ** Nuxt.js modules */ modules: [ '@nuxtjs/axios', [ 'nuxt-i18n', { strategy: 'prefix_except_default', locales: [ { name: 'Bulgarian', code: 'bg', iso: 'bg-BG', file: 'bg-BG.js' }, { name: 'Russian', code: 'ru', iso: 'ru-RU', file: 'ru-RU.js' }, { name: 'English', code: 'en', iso: 'en-US', file: 'en-US.js' }, ], lazy: true, langDir: 'locales/', defaultLocale: 'en', //, encodePaths: false seo: true, //, parsePages: false //, pages: i18nConfig.pages /* , detectBrowserLanguage: { useCookie: true, cookieKey: 'i18n_redirected', onlyOnRoot: true } */ }, ], //, '@nuxtjs/sitemap' 'nuxt-lazy-load', '@nuxtjs/robots', [ '@nuxtjs/recaptcha', { hideBadge: true, siteKey: process.env.RECAPTCHA_SITE_KEY, version: 3, }, ], //, '@nuxtjs/auth' //, '@nuxtjs/proxy' ], /* ** Robots.txt */ robots: { UserAgent: '*', Disallow: '/', }, /* ** Purge CSS */ purgeCSS: { whitelistPatterns: [/^v-*/, /^theme-*/, /^application--*/], whitelistPatternsChildren: [/^v-*/, /^theme-*/, /^application--*/], whitelist: ['spacer', 'primary', 'secondary', 'accent', 'error', 'warning', 'info', 'success'], }, /* ** Axios configurations */ axios: { baseURL: `${process.env.API_BASE_URL}${process.env.API_BASE_PATH}`, https: true, // //debug: true, // //proxyHeadersIgnore: ['host', 'accept', 'cf-ray', 'cf-connecting-ip'], // proxyHeaders: false, // https:false, // credentials: false, // proxy: true }, /* ** Static HTML generator */ generate: { interval: 100, crawler: false, fallback: '404.html', gzip: true, async routes() { const slugs = [] async function postRoutes(type, lang = '') { const _lang = `/${lang}` || '' return await axios .post(`${process.env.API_BASE_URL}${_lang}${process.env.API_BASE_PATH}/post-type-list`, { postType: type, }) .then((r) => { if (r.data.data.type == 'villas') { r.data.data.items.map((item) => { let slug = '' switch (lang) { case 'bg': slug = encodeURI( `${_lang}/${process.env.VILLAS_BG}/${decodeURI(item.slug).toString()}`, ).toString() break case 'ru': slug = encodeURI( `${_lang}/${process.env.VILLAS_RU}/${decodeURI(item.slug).toString()}`, ).toString() break default: slug = encodeURI( `/${process.env.VILLAS_EN}/${decodeURI(item.slug).toString()}`, ).toString() break } if (slug !== undefined) slugs.push({ route: slug, payload: item }) }) } }) } await axios .all([postRoutes('villas'), postRoutes('villas', 'bg'), postRoutes('villas', 'ru')]) .then((results) => { }) return slugs }, }, /* ** Sitemap */ sitemap: { hostname: process.env.API_BASE_URL, path: '/sitemapindex.xml', defaults: { changefreq: 'daily', priority: 1, lastmod: new Date(), }, // notation (basic) //, i18n: true // nuxt-i18n notation (advanced) i18n: { locales: ['en', 'bg', 'ru'], routesNameSeparator: '___', }, }, /* ** vuetify module configuration ** https://github.com/nuxt-community/vuetify-module */ vuetify: { customVariables: ['~/assets/variables.scss'], treeShake: true, defaultAssets: false, icons: { iconfont: 'mdi', }, theme: { dark: false, themes: { dark: { primary: colors.blue.darken2, accent: colors.grey.darken3, secondary: colors.amber.darken3, info: colors.teal.lighten1, warning: colors.amber.base, error: colors.deepOrange.accent4, success: colors.green.accent3, }, light: { primary: colors.blue.darken2, accent: colors.grey.darken3, secondary: colors.amber.darken3, info: colors.teal.lighten1, warning: colors.amber.base, error: colors.deepOrange.accent4, success: colors.green.accent3, }, }, }, }, /* ** Build configuration */ build: { html: { minify: { collapseBooleanAttributes: true, decodeEntities: true, minifyCSS: true, minifyJS: true, processConditionalComments: true, removeEmptyAttributes: true, removeRedundantAttributes: true, trimCustomFragments: true, useShortDoctype: true, preserveLineBreaks: false, collapseWhitespace: true, }, }, extractCSS: true, /* ** You can extend webpack config here */ extend(config, ctx) { config.node = { console: true, fs: 'empty', net: 'empty', tls: 'empty', } }, //, analyze: true }, }
-
How to change boxStrokeColor Of TextInputLayout in Android?
I dynamically create textInputlayout and add it to my lienarlayot using the code below:
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.setMargins(10,10,10,10); til.setLayoutParams(params); til.setHint("Label"); til.setId(i+1); TextInputEditText et = new TextInputEditText(til.getContext()); et.setSingleLine(true); til.addView(et); til.setBoxCornerRadii(R.dimen.CornerRadious,R.dimen.CornerRadious,R.dimen.CornerRadious, R.dimen.CornerRadious); information.addView(til);
I want to change boxStrokeColor , CursorColor and HintTextColor.
I use the following code block to change boxStrokeColor
til.setBoxStrokeColor(getResources().getColor(R.color.white));
But that code block only change the boxStrokeColor of TextInputLayout (white) when I click the TextInputLayout ,without click it's color is black. How can I set it's color white ?
-
How Can I set style to TextInputLayout by dynamically in android?
I want to create TexInputLayout by dynamically. I can create TextInputLayout using following code block :
TextInputLayout til = new TextInputLayout(this); EditText et = new EditText(this); til.addView(et); et.setHint("Enter"); information.addView(til);
information is name of my linear layout which I use in the project.
But I want to change style of the TextInputLaout which I created by dynamically, I want to use @style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.
I tried the following code block to change style :
TextInputLayout till= new TextInputLayout(new ContextThemeWrapper(this, R.style.Widget_MaterialComponents_TextInputLayout_OutlinedBox)); EditText et = new EditText(this); til.addView(et); et.setHint("Enter"); information.addView(til);
but these code is not working. How can add style to TextInputLayout which I created dynamically ?
-
Perform operations on std::variant<POD_PTR*...> in a generic way
Say the following
variant
is given:
using Variant = std::variant<uint32_t*, uint16_t*>
And then, avector
of suchvariant
s is needed:
using VariantVecType = std::vector<Variant>
How would one go about accessing the underlying values (pointed to by those pointers) to perform arithmetic operations on them in a more generic way (i.e. without usingstd::get_if
) e.g.uint32_t i0 = 1; uint16_t i1 = 2; Variant v0{ &i0 }; Variant v1{ &i1 }; VariantVecType vec{v0, v1}; for(auto& v : vec) if(auto pval = std::get_if<uint32_t*>(&v)) std::cout << "Underlying int value: " << *(*pval) << '\n'; else if(auto pval = std::get_if<uint16_t*>(&v)) std::cout << "Underlying int value: " << *(*pval) << '\n'; else std::cout << "failed to get value!" << '\n';
-
How to use a variant option to type function parameters in rescript?
I would like to do the following. But it seems I cannot type the function parameter with one of the variant option. What would be the proper way to achieve this in rescript?
type subject = Math | History type person = | Teacher({firstName: string, subject: subject}) | Student({firstName: string}) let hasSameNameThanTeacher = ( ~teacher: Teacher, // syntax error here ~student: Person, ) => { teacher.firstName == student.firstName }
-
how to print values in a range but in that range skip rows 41-55 then continue after row 55
This code works great, but i like for var and d(var) to only print values in rows 10:40 and skip rows 41:55
Dim rng As Range Dim var As Variant Dim i As Integer i = 0 Set D = CreateObject("Scripting.Dictionary") Sheet6.Range("a2:a10000").Select For Each rng In Selection If rng <> "" Then If D.exists(rng.Value) Then D(rng.Value) = D(rng.Value) + 1 Else D.Add rng.Value, 1 End If End If Next For Each var In D.Keys Sheet6.Range("C" & (i + 2)) = var Sheet6.Range("B" & (i + 2)) = D(var) Sheet4.Range("B" & (i + 10)) = var Sheet4.Range("A" & (i + 10)) = D(var) i = i + 1 Next Set D = Nothing