StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.4/10 (10 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

How to have else condition under rage function in helm?

28 May 2023 @ 6:40 pm

Need to have a additional else condition under the "data" and "array" section of the range function, used in the below secretproviderclass helm template. Its for picking common keyvault keys from the keyvault which doesn't have any release name prefix with them in addition to the keys which have specific releane name prefix. Also it shouldnt make any repeateation. spec: provider: azure secretObjects: - data: {{- range .Values.keyvault.secrets }}{{/* <-- only one range loop */}} - key: {{ . }} objectName: {{ $.Release.Name | upper }}-{{ . }} {{- end }} secretName: {{ $.Release.Name }}-kvsecret type: opaque parameters: usePodIdentity: "false" useVMManagedIdentity: "false" userAssignedIdentityID: "" keyvaultName: {{ .Values.keyvault.name | default "mykv01" }} objects: | array: {{- range .Values.keyvault.secrets }}{{/* &l

How to upload huge JSON file into Snowflake table?

28 May 2023 @ 6:40 pm

There is a "big.json" of about 70 GB, which is a single object {}. The main part of the file, 99.99999999% is stored in "body". Can you tell me how to load this file into a temporary Snowflake table or just a Snowflake table? And how to do it as fast as possible? Tried to use ijson library to iteratively read and split into smaller json files. Also don't understand what the table structure should be. As JSON contains nested structures. Basically, such a file only contains information about one company. There was an idea to split and convert to CSV or JSON form and implement parallel loading, but how to do it. I would be very grateful if anyone could advise how this could be implemented. Example of JSON-file structure below. { "entity_name": "Cars", "entity_type": "Manual", "last_updated_on": "2023-04-01", "version": "

Power Apps: Group By aggregation from a SharePoint list cutting off records if there are too many

28 May 2023 @ 6:38 pm

New to Power Apps and struggling to understand how it manages connections. I have a simple application that aggregates a SharePoint list based on date and warehouse location fields and sums product quantity (i.e., inventory level at a given date and warehouse). The following code groups the records, by product number, so as to get a sum: ClearCollect(collItemSummary, AddColumns( GroupBy( ShowColumns( Filter(tracker_data, inv_dt < CountDate.SelectedDate && varSelWH = wh_code), "item_no","qty"),"item_no","groupData"),"Sum of qty",Sum(groupData,qty))); The code works perfectly fine. The problem is the following: based on the selected parameters, if the resulting data source list upon which the code runs the aggregation is too long (many records), then I get an incomplete aggregation (not everything gets summed). However, if the resulting data source l

Vue files not deploying properly with django backend

28 May 2023 @ 6:36 pm

Vue/Django app deployed to Heroku. Everything works great on local machine in development. On Heroku domain the app and all django templates load fine, only issue is that no vue components render. See here: [https://brainteasers.herokuapp.com/anagram-game/] In chrome dev tools I see "(failed)net::ERR_CONNECTION_REFUSED", or simply "(failed)" for the vue specific files. The Request URL: http://localhost:8080/js/chunk-vendors.58fb68d0.js My directory structure: static (backend) ├── css ├── dist (vue build files output here) │ ├── css │ └── js └── img vue-games ├── node_modules ├── public ├── src │ ├── components │ ├── app.vue │ ├── main.js │ └── router.js ├── package.json └── vue.config.js My vue.js.config: module.exports = { publicPath: 'http://localhost:8080', // The base URL where your app wil

react-native-twitter-signin does not build on android

28 May 2023 @ 6:35 pm

As per the docs https://github.com/react-native-twitter-signin/twitter-signin there is no additional step required but i keep getting error FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':react-native-twitter-signin_twitter-signin:compileDebugAidl'. > Could not resolve all task dependencies for configuration ':react-native-twitter-signin_twitter-signin:debugCompileClasspath'. > Could not find com.twitter.sdk.android:twitter-core:3.3.0. Required by: project :react-native-twitter-signin_twitter-signin * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 10s error Failed to install the app. Make sure you have th

Removing body class based on ajax cart change woocommerce

28 May 2023 @ 6:35 pm

I have added a class with add_filter( 'body_class', '' ) But I want to remove the class if the product is removed from the cart with ajax. The filter inside the function is not working. Can you point what is wrong? add_filter( 'woocommerce_add_to_cart_validation', 'prevent_add_to_cart', 10, 3 ); function prevent_add_to_cart( $passed, $product_id, $quantity ) { $blocked_product_ids = array( 15530 ); $product_title = get_the_title( $product_id ); if ( in_array( $product_id, $blocked_product_ids ) && ! is_user_logged_in() ) { wc_add_notice( 'notice, 'error' ); $passed = false; } else{ add_filter('body_class', function (array $classes) { if (in_array('hide_paypal', $classes)) { unset( $classes[array_search('hide_paypal', $classes)] ); } return $classes; }); } return $passed; }

Component disappears when removing "setup" from script in Vue3

28 May 2023 @ 6:34 pm

I am trying to make a Vue 3 app. I am familiar with Vue 2 but not as much with Vue 3. This code works: <template> <v-app> <v-main> <Map :features="features" /> <v-btn>Submit</v-btn> </v-main> </v-app> </template> <script setup> import Map from '@/components/Map.vue' </script> But when I change it to this: <template> <v-app> <v-main> <Map :features="features" /> <v-btn>Submit</v-btn> </v-main> </v-app> </template> <script> import Map from '@/components/Map.vue'; export default { data() { return { features: [] } }, methods: { submit() { console.log("clicked submit") } } } </script> The "Map" component disappears comp

Trouble with Dynamic Color in Tailwind Component

28 May 2023 @ 6:34 pm

I'm having trouble understanding why the blue color is not working in my component. Could you please help me troubleshoot this issue on Stack Overflow? I have a Tag component that should apply different background and text colors based on the color prop provided. However, when I set the color prop to "blue", the expected blue color is not being applied to the component. I have tried various solutions, including dynamically constructing the class names and using the correct syntax for Tailwind CSS classes. However, I have been unsuccessful in resolving the issue. Any guidance or suggestions would be greatly appreciated. Thank you in advance for your assistance! import React from "react"; export default function Tag({ index, tag, color = "red" }) { return ( <li key={index} className={`inline-flex items-center rounded-full px-3 py-2 text-xs font-bold upper

React: How to use conditional render and react-hooks to update another component's state?

28 May 2023 @ 6:12 pm

I'm new to React. I'm trying to create a Login/Register Screen. I have three components called Login, Register and SlidingCard. I render these componenets on other jsx file called Screen. In SlidingCard.jsx i have a div and inside this div there are some text and button. When i clicked the button, text and button changes to login related things from register related things. Now the part that i stucked. I mentioned that when i clicked the button on SlidingCard the text changes. But with that click i want to render the Login or Register too. How can i do it? Login.jsx import React from "react"; import Input from "./Input"; function Login() { return ( <div className="loginContainer"> <div className="loginChildContainer"> <h1>Welcome Back!</h1> <p>Lorem lorem lorem lorem lorem</p> <Input type="text" placeholder="Username" />

count number of lines between two pattern match in file and delete all lines between pattern match only if count is more than 4

28 May 2023 @ 5:48 pm

I have a file which contains text like below Input file: ------start--------- first line second line third line fourth line ------end----------- xyx pqr ------start--------- first line second line third line fourth line fith line sixth line ------end----------- I want a output file such that if lines between patterns "start" and "end" is more than 4 all i want to delete all those lines between pattern else i dont wish to touch them if count is less than or equal to 4 I need the output file like below, inside which i want to delete all lines between two pattern match only if the total count of line is more than 4 expected output file: ------start--------- first line second line third line fourth line ------end----------- xyx pqr ------start--------- ------end----------- I have used this sed command sed -i '/start/,/end/{//!d}' filename to delet

jsfiddle.net

VN:F [1.9.22_1171]
Rating: 9.0/10 (2 votes cast)

A playground for web developers, use it as an online editor for snippets built from HTML, CSS and JavaScript. The code can then be shared with others, embedded on a blog, etc.

SmashingMagazine.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (6 votes cast)

Digital media magazine for designers and developers
Web design plus tips and tricks.

Designing A Better Design Handoff File In Figma

26 May 2023 @ 3:30 pm

This article provides practical tips for improving the handoff process between design and development in product development. The guidance covers effective communication, documentation, design details, version control, and plugin usage.

Meet Success At Scale, A New Smashing Book By Addy Osmani

25 May 2023 @ 8:00 pm

Meet “Success At Scale”, our upcoming book with best-practice case studies from industry experts. Print and eBook shipping in fall 2023. Pre-order the book.

The Impact Of Agile Methodologies On Code Quality

25 May 2023 @ 11:00 am

Say goodbye to traditional workflows and embrace Agile to unlock the power of high-quality code. Discover how Agile methodologies promote simplicity, modularization, readability, and continuous improvement, resulting in faster turnaround times, more responsive development processes, and ultimately, the creation of high-quality software that meets customer needs.

Smashing Podcast Episode 61 With Rachel Andrew: What Is Web Platform Baseline?

23 May 2023 @ 8:00 am

In this episode of the Smashing Podcast, we’re talking about Web Platform Baseline. What is it, and how can it help determine your browser support policy? Drew McLellan talks to expert Rachel Andrew to find out.

Practical Design Tips And Guidelines For Beginner Designers

22 May 2023 @ 11:00 am

It’s easy for beginner designers to get overwhelmed and lose confidence when creating presentations, landing pages, app and web design mockups, and even cards. Laurent Baumann shares a few simple guidelines and practical tips to help you in such situations.

How To Deal With Big Tooling Upgrades In Large Organizations

17 May 2023 @ 10:00 am

The process of upgrading large third-party packages in equally large organizations is rarely, if ever, as easy as running an npm update and calling it a day in this context. Joran Quinten shares valuable lessons from his team’s experiences in upgrading third-party code that affects codebases across the entire organization.

Design Patterns Are A Better Way To Collaborate On Your Design System

16 May 2023 @ 11:00 am

Every company and team has to have deep collaboration between engineering and design to get the value out of a design system (and not go nuts). Building design patterns first unblock people to work in parallel, keeps people synced up, and results in reusable modules that speed up your next project.

Solving Media Object Float Issues With CSS Block Formatting Contexts

15 May 2023 @ 1:00 pm

This article covers common problems using CSS floats and how to solve them using a block formatting context (BFC). Whether you are a beginner or an experienced web developer, you will learn valuable insights and practical solutions for dealing with CSS float issues.

Designing Sticky Menus: UX Guidelines

12 May 2023 @ 11:00 am

Are sticky headers always a good idea? Best practices for designing sticky headers, with examples, UX guidelines and usability considerations.

How To Boost Your Design Workflow With Setapp

11 May 2023 @ 2:00 pm

In this guide, we’ll explore efficient tools to save time and speed up your workflow. Focus on what you do best — designing high-quality work, and let these tools handle the rest!

stackblitz.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (2 votes cast)

Create, edit & deploy fullstack apps — in just one click. From Angular to React or even just HTML, JS and CSS.