Posts

Showing posts from June, 2023

What do the following two Google Map error messages mean? [closed]

I am trying to get an existing map to display in a CMS collection in Webflow. I did get the messages to display individually with two different attempts on that particular blog post. Thank you for any help. I tried using the Google Maps embed code, but Webflow rejected the iframe code and wanted a standard weblink starting with http. I deleted all but the http from the code and got this error: "Google Maps Platform rejected your request. Invalid request. Unexpected parameter 'ehbc'" The second error came from trying the actual browser URL of the map: "Google Maps Platform rejected your request. Invalid request. Unexpected parameter 'll'" I wanted the map to display in the blog post. Also, this map was created by someone else (if that makes a difference), but I don't think I'm getting a permissions error.

Stream the sound of a sph0645 I2S mic in fm station on a Raspberry pi with the PiFmRds lib

I'm trying to stream the sound from a raspberry pi of a sph0645mic in fm with the PiFmRds librairy Here's what I've tried: after the install of the mic here's what I have: $ arecord -l **** List of CAPTURE Hardware Devices **** card 1: sndrpii2scard [snd_rpi_i2s_card], device 0: simple-card_codec_link snd-soc-dummy-dai-0 [simple-card_codec_link snd-soc-dummy-dai-0] then I can record normally without any problems with this command : $ arecord -D plughw:0 -c1 -r 48000 -f S32_LE -t wav -V mono -v file.wav I can stream the file : $ sox -t mp3 /home/thib/file.wav -t wav - | sudo /home/thib/PiFmRds/src/pi_fm_rds -audio - but here is my problem : I would like stream the direct output of my mic. For that I've tried : $ sudo arecord -D plughw:1 -c1 -r 48000 -f S32_LE -t wav | sudo ./pi_fm_rds -audio - after that I've tried to use the loopback fuction but I don't have any sound in my receptor. $sudo modprobe snd-aloop arecord -l **** List of CAPTURE Hardw

psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: database "

I tried running a postgres server to viewing my databases with TablePlus after not doing so for a while. Running the server: brew services start postgresql Warning: Formula postgresql was renamed to postgresql@14. Bootstrap failed: 5: Input/output error Try re-running the command as root for richer errors. Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/eliott/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist` exited with 5. ➜ ~ brew services restart postgresql Warning: Formula postgresql was renamed to postgresql@14. Stopping `postgresql@14`... (might take a while) ==> Successfully stopped `postgresql@14` (label: homebrew.mxcl.postgresql@14) ==> Successfully started `postgresql@14` (label: homebrew.mxcl.postgresql@14) When I ran psql it returned this error: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory Is the server running locally and accepting connections on that socket? … and something s

API call returns url and not a value I need [duplicate]

async function getSwInfo(url) { try { const data = await fetch(url).then((res) => res.json()); console.log(data); personData(data.results); } catch (error) { console.log(error); } }; function personData(data) { const person = data[0]; let personName = ` <h2 id="name">${person.name}</h2> <p class="aurebesh">${person.name}</p>`; nameInfo.innerHTML = personName; let personBio = ` <ul> <li><h3>Home Planet: </h3><p>${person.homeworld}</p></li> <li><h3>Birth Year: </h3><p>${person.birth_year}</p></li> <li><h3>Gender: </h3><p>${person.gender}</p></li> <li><h3>Species: </h3><p>${person.species}</p></li> <li><h3>Height: </h3><p>${person.height}</p></li> <li><h3>Wei

Sagemaker environment variable with .env

[Background] I am used to use xx.py and defining a .env file in python project in Pycharm, and by doing import os os.environ['abc'] I will get the 'abc' variable defined in .env file. [Question] Now I need to work with sagemake studio, what is the best practice to manage env var with sagemake? I tried to create a .env file, but got a rename error. Does it mean using .env is not a good try in sagemaker? Rename Error Cannot rename file or directory '/xx/untitled.txt'

Why splash screen is not working in Kotlin app?

I am trying to make a splash screen in XML file but it is not working in emulator and there is only white screen in app view. Here is activity_splash_screen.xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Activity_Splash_Screen" android:background="@color/black" > <ImageView android:id="@+id/image1" android:layout_width="150dp" android:layout_height="150dp" android:layout_centerInParent="true" android:src="@drawable/anadol" /> </RelativeLayout> Activity_Splash_Screen.kt file: package com

How to indicate high wicks of more than 10%

This is my code, but it's not working, I don't understand why!! Thanks for your help. Peio //@version=4 condition = high close wickPercentage = (high - close) * 100 / close if wickPercentage > 10 plotValue = wickPercentage >10 ? wickPercentage : na plot(wickPercentage ? close : na, color=color.rgb(76, 134, 175), style=plot.style_columns) All candles are displayed on the chart, minus the candles without a high wick. And I would like to indicate that candles with a high wick above 10%

Pulling a sed script into a perl program

I need to shorten function names, so I identify them and produce a really long sed script that looks like this: s/\breally_long_function_name1\b/A00128/g s/\breally_long_function_name2\b/A00060/g s/\breally_long_function_name3\b/A00035/g s/\breally_long_function_name4\b/A00342/g s/\breally_long_function_name5\b/A00203/g ... and then call it like this: `sed -i.bak -f $sedscript *` The problem is that I can't depend on sed being able to handle those instances of \b and it seems messy. Instead of writing out that sed script, I want to put it into an array and then do something like this for each line of each file I need to process: $targetline =~ $processing; My problem is that using $processing like that won't work and the q operators don't seem to do the job. How do I massage this to get the substitution in $processing processed and the result put in $targetline ? Note: I used Perl sed file inside script and the answer from @ron-bergin there to get this far. The

why jenkins showing git maven not found error even git and maven installed?

`hi there,hope you are doing well. I am new to Jenkins, and errors are encountered during practice. i took a sample project. error and jenkins file content posted below please have a look into it. feel free to ask if you have any questions. please suggest solution. Thank you for your support and help.` Error as below Started by user admin Obtained Jenkins-decnew from git https://github.com/kdhani/myweb-p1.git [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /var/lib/jenkins/workspace/pipeline1 [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Checkout SCM) [Pipeline] checkout **Selected Git installation does not exist. Using Default **The recommended git tool is: NONE using credential gitid > /usr/bin/git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/pipeline1/.git # timeout=10 Fetching changes from the remote Git repository > /usr/bin/git config remote.origin.url https://github.com/kdhani/myweb-p1.git # timeout=10 Fetching upstream changes

Finding (null) Value in array

The standard way to check if a value is in an array in BigQuery is using IN UNNEST(...) . For example: SELECT 2 IN UNNEST([0, 1, 1, 2, 3, 5]) AS contains_value; What is the suggested way to check if the NULL value is in an array? Is there a more direct way than doing: SELECT EXISTS(SELECT 1 FROM UNNEST([0,1,1,2,3,null,5]) v WHERE v IS NULL) Is there a more straightforward way for this? And if someone on the BigQuery team or someone familiar with performance/optimizations: does it matter if I add a LIMIT 1 to the sub-select -- i.e., does the exists operator short-circuit automatically once it finds a result or do I have to manually add in a LIMIT 1 to the subquery?

Jenkins pipeline for parallel cross browser testing

I need to find solution/s for next case. There is selenoid in docker which runs browsers in containers, the tests should be run in parallel for some browsers. I made pipeline in Jenkins for that goal. And all tests run in parallel for browsers but they work with the same workspace and I got errors from time to time. How can I make Jenkins settings or pipeline configuration to have each browser branch with its own workspace or thomething else to avoid conflicts. pipeline { agent any tools { maven 'MAVEN_HOME' } stages { stage('setup parameters') { steps { script { properties([ parameters([ choice( choices: ['chrome', 'firefox', 'all'], name: 'browser' ) ]) ]) } }

how to add support for "?" (query) in path for apple-app-site-association file?

"apple-app-site-association" file content: { "appclips": { "apps": ["**********.com.project.example.Clip"] }, "applinks": { "apps": ["**********.com.project.example"], "details": [ { "appID": "**********.com.project.example", "paths": [ "/event/*", "/ticket?v=*" ] } ] } } File is already set at "https://< fully qualified domain>/.well-known/apple-app-site-association" problem I'm facing is that it is working for "https://< fully qualified domain>/event/EVENT-ID", but it is not invoking app for "https://< fully qualified domain>/ticket?v=VOLUME-ID" Is it because of "?" or I'm missing some thing?

Serving SPA with Golang and Chi router enters a loop

I´m trying to serve a SPA with Golang and solving the 404 error became a challenge. In the init() func I buffered into memory the index.html file. I created a indexHandler that returns the index file buffered. I call the indexHandler in the router.NotFound() func so the route is returned to the SPA. I serve the rest of the static files with FileServer. The problem is that it seems to be in a loop, when I try to access the app in the browser, it reloads itself indefinitely. package main import ( "log" "net/http" "os" "path/filepath" "time" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/joho/godotenv" ) var indexBuffer []byte func main() { r := chi.NewRouter() r.Use(middleware.RequestID) r.Use(middleware.RealIP) r.Use(middleware.Logger) r.Use(middleware.Recoverer) fs := http.FileServer(http.Dir(os.Geten

Inconsistency on module in IPython

IPython seems inconsistent here: In [1]: import sys In [2]: sys.version Out[2]: '3.10.11 (main, May 16 2023, 00:28:57) [GCC 11.2.0]' In [4]: type(sys) Out[4]: module In [5]: type(module) --------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[5], line 1 ----> 1 type(module) NameError: name 'module' is not defined In [6]: type(type(sys)) Out[6]: type How can something that is not defined be a type and have a type? I found this after discovering that no class module exists, although, if I import some module of mine, it automatically inherits attributes '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', What are these attributes inherited from?

Can you attach a firewall rule to a instance template

Lets say I have the following instance template: resource "google_compute_instance_template" "label_studio_template" { name = "label-studio-template" machine_type = "e2-micro" # Free tier instance tags = ["label-studio-server-template"] disk { auto_delete = false source_image = "debian-11-bullseye-v20230509" } network_interface { network = "default" access_config { // Public IP nat_ip = google_compute_address.standard.address network_tier = "STANDARD" } } metadata = { label_studio_username = var.label_studio_username label_studio_password = var.label_studio_password label_studio_user_token = var.label_studio_user_token } metadata_startup_script = file("${path.module}/compute_metadata.sh") } is it possible to use the tags here to attach firewall policies to all instances that are created from the templa

Input clientWidth and scrollWidth are always equal

I'm using Vuetify text-fields and want to display a tooltip containing the content if the content is greater than the field width (user needs to scroll). The tooltip should only appear on hover (default behaviour). I started with the following ( Playground ) <script setup lang="ts"> import { ref, computed } from "vue"; const currentValue = ref(""); const textFieldComponent = ref<VTextField>(); const isTextFieldCuttingOffContent = computed(() => { if (!textFieldComponent.value) { return false; } if (!currentValue.value) { return false; } return ( textFieldComponent.value.$el.clientWidth < textFieldComponent.value.$el.scrollWidth ); }); </script> <template> <v-container style="width: 300px"> <v-tooltip :text="currentValue" :disabled="!isTextFieldCuttingOffContent"> <template v-slot:activator="{ prop

How to read parent attributes in Vue3 typescript

In the child component I am trying to write, I need to get the parent object. The commented out lines don't work. AccordionState is: export type AccordionKeys = | "open" | "disabled"; export type AccordionState = { [key: string]: {[key in AccordionKeys]: boolean; }; } The child code is: <script lang="ts"> import { AccordionState } from "@/types/global"; import { defineComponent, useAttrs } from "vue"; export default defineComponent({ name: "AccordionPane", props: { panelName: { type: String, required: true, }, }, computed: { open(): boolean { // const attrs = useAttrs(); // const state = attrs.state as AccordionState; // return state[this.panelName].open && !state[this.panelName].disabled; return true; }, disabled(): boolean { // const attrs = useAttrs(); //

When I create a project I did " git push -u origin master" push fail

I get this error: To https://git.misynergy.com/imal/eureka-registry.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://git.misynergy.com/imal/eureka-registry.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. When I execute the command: git push -u origin master

Migrate CRA to Vite causes "Cannot access 'store' before initialization" using Redux Toolkit

I've googled for days, and I just can't seem to solve the bug. So here I go. I know it's all about circular dependencies, but it doesn't seem like I can just rewrite it. First I'm initializing the store in its own file /redux/store const store = configureStore({ ... }) export default store; Then in an API file, I use a util function (coming later) that is used in multiple places around the app. Here is an example /api/configApi import { createApi } from '@reduxjs/toolkit/dist/query/react'; import { getConfig } from 'utils/getConfig'; const token = getConfig(env.key); export const configApi = createApi({ token, ... }) Then I am using store again, and sadly before it is initialized /utils/getConfig import store from 'redux/store' export function getConfig(key) { const config = store.getState()... // <-- Cannot access store before initialization } And the app itself /src/index.tsx ... imports ... const app = ( <StrictMode&g

Wall time with milliseconds in Linux C

Having found many quite old questions about this subject, I wonder if getting the current time in Linux C with year, month, day, hours, minutes, seconds and milliseconds still is so cumbersome these days. I searched a lot but there are either structs holding the wall time without milliseconds, or structs returning the current time in milliseconds that I have to convert into wall time separately, or functions that return seconds and milliseconds in extra fields which would be ok to use but isn't what I'd call elegant. Does a time struct like this struct TIME_WITH_ALL_FIELDS now; get_now(&now); print ("today is ...", now.year, now.month, now.day, now.hour, now.minute, now.second, now.millisecond); really not exist yet?

mysql nested level query getting very slow

Image
I have a MySQL query containing two columns that cause a delay of 25 seconds when the query is wrapped, while the inner query runs fine within 2 seconds. Both columns have already been indexed, and I have tried reducing joins to optimize the query, also replaced subqueries with joins, which reduced times by 8,9 seconds. but it did not provide significant performance improvements. Here is the original nested SQL query: SELECT first_base.case_id_c FROM ( SELECT DISTINCT (cc.case_id_c), ( SELECT CONCAT(u.first_name, ' ', u.last_name) FROM users u WHERE u.id = cc.user_id1_c ) AS Case_Advocate, ( SELECT CONCAT(u.first_name, ' ', u.last_name) FROM users u WHERE u.id = cc.user_id2_c ) AS Practitioner, ( SELECT CONCAT(u.first_name, ' ', u.last_name) FROM users u WHERE u.id = cc.user_id3_c ) AS Tax_Pr

Delete images from automatically scrolling Row in Flickable

Background.qml import QtQuick Flickable{ id:flickable anchors.fill:parent contentWidth:row.implicitWidth interactive:false Row{ id:row anchors.fill:parent } Timer{ interval:10; running:true; repeat:true onTriggered:{ if(flickable.atXEnd){ Qt.createComponent('Pic.qml').createObject(row) } flickable.contentX++ } } } Pic.qml import QtQuick Image{ sourceSize.height:parent.height fillMode:Image.PreserveAspectFit asynchronous:true source:'file://'+RandomImage } This continuously scrolls a strip of randomly chosen images from left to right. This works nicely, but the only problem that remains is that images that scroll offscreen need to be deleted. What's the best way to achieve this?

Git: receive.denyCurrentBranch=updateInstead does not update

The receive.denyCurrentBranch=updateInstead option (set on the server repo) should, according to the docs, allow the push and do a hard reset of the worktree if it's clean, or just flat out refuse the push if the worktree isn't clean. Instead, for me it allows the push, but doesn't touch the worktree - I have to git checkout -f after each push anyway, even though it's cleanish (has just untracked files present, which, if I'm not mistaken, should still count as clean). Edit: The push-to-checkout hook doesn't seem to run, either, even though it's in the .git/hooks/push-to-checkout file all right, with +x rights as needed. I made it output some lines and exit with code 1, so it should abort after producing the output - and yet the pushes come through. My client is 2.31.0.windows.1 (TortoiseGit), server is 2.39.1 if that one matters.

Dynamically change data-prefix of React-Table Header (Only works in Cell)

I am trying to dynamically change the data-prefix of an icon from far to fas when a button is clicked. This will change the folder icon into a darken folder icon to show a process is running. When the button is clicked I run this javascript: document.getElementById("DownloadSelectedFolder").setAttribute("data-prefix","fas"); Here is the table and column: const { getTableProps, getTableBodyProps, headerGroups, page, nextPage, previousPage, canNextPage, canPreviousPage, pageOptions, gotoPage, pageCount, setPageSize, state, rows, rowIndex, prepareRow, selectedFlatRows, onChangeSelectedRowsId, toggleAllRowsSelected, } = useTable({ columns, data: Documents, selectedRows : setSelectedRows, //Add this autoRe

could not convert string to float: 'Skoda Laura' [duplicate]

I am stuck here. I'm trying to make a website which make predictions on machine learning. car=cars[['name','company','year','car_prices','kms_driven','fuel_type']] car['name']=car['name'].str.split(' ').str.slice(0,3).str.join(' ') x=cars.drop(columns='car_prices') y=cars['car_prices'] from sklearn.model_selection import train_test_split x_train,y_train,x_test,y_test=train_test_split(x,y,test_size=0.3) ohe=OneHotEncoder() ohe.fit(x[['name','company','fuel_type']]) ohe.categories_ column_trans=make_column_transformer((OneHotEncoder(categories=ohe.categories_),['name','company','fuel_type']),remainder="passthrough") lr=LinearRegression() pipe=make_pipeline(column_trans,lr) pipe.fit(x_train,y_train) ValueError: could not convert string to float: 'Skoda Laura' ValueError: could not convert string to float: 'Skod

Cypress: WebAuthn.addCredential causes exception

Our mobile app uses passkey to authorize users. I am testing the API for our mobile app. We have a SignUpSignIn command that returns "challenge”, "pubKeyCredParams”, "excludeCredentials”, ”rp" and "user”. Now I need to get authenticator information from my browser i.e. "authenticatorData”,“signature”, "clientDataJSON”. I have found this code https://github.com/cypress-io/cypress/issues/6991#issuecomment-1267934998 and tried it. I successfully received _AUTHENTICATOR_ID but I’m stuck about the next step. I tried the command WebAuthn.addCredential but I just got “(uncaught exception)Error: An error occurred trying to create the credential”. I do not understand what I did wrong and if it was a correct step. This code leads to an exception it is highly likely that the reason is in 'privateKey': let elliptic = require('elliptic'); let ec = new elliptic.ec('secp256k1'); let keyPair = ec.genKeyPair(); // Generate random keys let pr

Multiple Azure AD Enterprise Apps for Single Cognito User Pool

I am trying to use our Azure AD to provide auth for an internal application which is behind an ALB on AWS. I am using a Cognito User Pool with the Azure AD configured as an identity provider. We already have one application configured in this manner, which is accessible from anyone with an identity in Azure AD. The application I am deploying now, should only be accessible by a select few users with account admin privileges. I have created an Enterprise Application in Azure AD Admin Center, but the issue I am having is that the application's Identifier(Entity ID) must be in the following format urn:amazon:cognito:sp:<region>_<userpool_id> and it must be globally unique. It must be in this format because that value is used as the aud claim in the OIDC process. Since we already have an application which is uses this AD and User Pool combination, there is no way to provide the correct Entity ID because of the need for it to be globally unique across enterprise apps. I

React Soap Call - ADDING EXTRA OPERATION

Hi I used following example to make successful react soap service and client https://github.com/officer-rosmarino/node-soap-example I tried to add in a second service/operation ie add a message joiner function as well as a message splitter but I am failing to understand the intricacies I can get change the service by changing MessageSplitter to MessageJoiner but cant publish service object to allow multiple operations ie: call MessageSplitter or MessageJoiner from Client from same service I created separate elements in wsdl as below and tried various ways I also tried combining operations under 1 port type in below but that produces errors - the below works but runs the same function when i call each service in turn in client ie it runs MessageSplitter twice and never runs MessageJoiner unless i change service object <?xml version="1.0" encoding="UTF-8"?> <!-- <definitions> must be the root of the WSDL document --> <wsdl:definitions target

For some reason I have to reboot my Macbook Pro M2 to get gradle to work again

I can work for hours just fine without any issues, then all of the sudden gradle will start getting stuck, eventually it will give this error: * What went wrong: Gradle could not start your build. > Cannot create service of type BuildSessionActionExecutor using method LauncherServices$ToolingBuildSessionScopeServices.createActionExecutor() as there is a problem with parameter #21 of type FileSystemWatchingInformation. > Cannot create service of type BuildLifecycleAwareVirtualFileSystem using method VirtualFileSystemServices$GradleUserHomeServices.createVirtualFileSystem() as there is a problem with parameter #7 of type GlobalCacheLocations. > Cannot create service of type GlobalCacheLocations using method GradleUserHomeScopeServices.createGlobalCacheLocations() as there is a problem with parameter #1 of type List<GlobalCache>. > Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal().

Find the nearest quarter on numpy array?

I have a numpy array that contains numbers with a 0.25 step. So a part of this array is [-38.25, -38,-37.75, -37.5]. I want to be able to find the nearest and lowest quarter to any number. For example if the input is -37.778 then the closest quarters would be -37.75 and -38 and the lowest would be -38. So the output should be -38 or even better the corresponding index for -38. I do it manually with approximations and later using np.searchsorted but I thought there must be a better way. Also the array is 400 elements long so I'm not sure is the best to do it this way.

running oc command using fabric8 openshift client client

I am interacting with OpenShift platform in my project using fabric8 OpenShiftClient interface. I need to run the command oc exec {some pod name} -- df -h and get the result as a string in java. Can someone help me understand how can i do that? I haven't found in the documentation of fabric8 any standard way to retrieve this information using the build in interface (for example, like getting the pods list which is very easy). So im guessing that i need to run this command in different way.

Navigating System Settings with Applescript (in Ventura)

I have been learning Applescript for several weeks — not a difficult task for a long-time programmer. One thing I am trying to do is to change system settings using Applescript. I have been searching every resource I can find, have read the Applescript online manual from cover to cover, explored many chat rooms that discuss this ... and I can find absolutely nothing about how to identify the different elements in the System Settings application. I have seen many pieces of code with lines like "... button 1 of splitter group 1 of group 1 of pane 1 of window 1 ..." But I can find no information on how to correlate this to what I see when I open System Settings manually. I have successfully been able to open a pane of my choice, and display a list of its UI elements (which don't correlate in any clear way to what I see visually in System Settings); but that's as far as I can get. Can someone explain, or direct me to a good tutorial that explains, how to under stand what

Problems handling checkboxGroupInput in R Shiny app

I'm trying to resolve an issue with the following project. I'm building a database of archives that have materials about certain festivals in history, and I want to make an interactive map out of it. I want the user to be able to filter by edition of each festival. The issue seems to be that in my dataset, some entries for festival_edition have multiple options, e.g. (ca72;ca76) because several apply. The map only renders rows that have unique entries there (just ca72 for instance). I'm a beginner and this is the first app I'm building. library(shiny) library(dplyr) library(leaflet) library(tidyr) library(readr) library(stringr) # Set working directory # Read CSV file carchives <- read_csv("carifesta-archives.csv") # Separate coordinates column into Latitude and Longitude columns carchives <- separate(carchives, col = coordinates, into = c("Latitude", "Longitude"), sep = ",") # Convert coordinates columns to numeric v

ChartJS bar chart - text over bar? [duplicate]

Image
I am using Chart JS in React. I want to do this: I currently have this: This is my code: export const options = { responsive: true, indexAxis: 'y', plugins: { legend: { display: false, }, title: { display: false, }, }, hover: { mode: null, }, }; const labels = [ 'introduction', 'html css', 'version control', 'advanced', 'intro js', 'advanced', 'intro to react', ]; export const data = { labels, datasets: [ { data: chartMock.map((item) => item.percentage), backgroundColor: chartMock.map((item) => getBarColor(item.percentage)), }, ], }; const BarChart = () => { return <Bar options={options} data={data} />; }; Is it possible to put text over the bar, as in example? Also, how can i remove padding around each row? I already tried associated answer, but nothing happens. I saw that chartjs-plugin-datalabels are something th

ESP32 WROVER - Lack of Photo Memory

Good afternoon everyone, how are you? I'm using an ESP32 WROVER I just need to put it on the network and take a picture (good quality) In the description it says that the card has 4mb flash memory, but when I go to record it appears as follows Flash: [====== ] 64.5% (used 845098 bytes from 1310720 bytes) that is, it has only 1.3mb A high resolution photo needs 1mb, but as it has no memory, it gives an error. Follow my program #include <WiFi.h> #include <ESP_WiFiManager.h> #include <esp_camera.h> #include <WiFiServer.h> const char* ssid = "ESP_Laser"; const char* password = "Laser123"; WiFiServer server(80); void setup() { Serial.begin(115200); delay(10); ESP_WiFiManager WiFiManager; WiFiManager.setConfigPortalTimeout(240); if (!WiFiManager.autoConnect(ssid, password)) { Serial.println("Falha na conexao. Resetar e tentar novamente..."); delay(3000); ESP.restart(); delay(5000); } Serial.pri

Troubleshooting Progress Bar Transition Issue in React Code

I’m having an issue with buggy code in my progress bar. The transition doesn’t start unless I wrap setStartTransition within setTimeout or requestAnimationFrame, as shown in this example: https://codesandbox.io/s/progress-bar-buggy-3pby7c?file=/src/progressBar.js . However, my understanding is that calling setStartTransition(true) after render should start the transition without the need for a timeout . fixed code : https://codesandbox.io/s/progress-bar-99nxwl?file=/src/progressBar.js . Can someone help me understand what’s happening? Is it an issue with setState?

pyspark nested for loops

I have seen many question of the same nature, but, I am still confused: some say use Groupby, some propose the use of map or flatmap. Not sure what to try. Input: A PySpark DF with date, term, brand, text column. Expected output: A list of filtered dfs [df1, df2, ...] In Python, the code looks like this (df is a big dataframe, has about 10000 records): filtered_df_list = [] for term in term_list: for br in brand_list: for dt in date_list: tcd_df = df.filter( (df.term == term) & (df.brand == brand) & (df.date == dt) ) if len(tcd_df.index) > 0: filtered_df_list.append(tcd_df) Also, can I create a dataframe out of term, brand and date lists and do a 'withColumn' to create a new column that will have the filtered dfs? I am not sure. A starter code for parallelizing this will be helpful. Update: This is what I tried and it looks like worker nodes are trying to do the filtering with the sparkContext that is not allowed. rdd2 = df.rdd.map(la

Why are there gaps in my fibonacci sphere?

Image
I recently took an interest in fibonacci spheres, so I decided to implement one. It works as expected, except for the fact that there are visual gaps in the sphere Now I don't know if there's supposed to be multiple layers like there is, but the main problem is the gaps. Here's my sphere generation function // This code generates points on a sphere using Fibonacci spiral sampling // The number of samples and the array to store the points are passed as arguments #include <math.h> void fibonacci_sphere(int samples, float points[][3]) { float phi = M_PI * (sqrtf(5.0f) - 1.0f); // golden angle in radians for (int i = 0; i < samples; i++) { float y = 1.0f - ((float)i / (float)(samples - 1)) * 2.0f; // y goes from 1 to -1 float radius = sqrtf(1.0f - y * y); // radius at y float theta = phi * i; // golden angle increment points[i][0] = cosf(theta) * radius; points[i][1] = y; points[i][2] = sinf(theta) * r

Convert Negative to Positive Based on Another Column in Power Query

I have some data that is negative and I need to convert it to a positive but it has to be based on another column. So this is what I have: each if ([Column1]< 0 and [Column2] = "X") then [Column1] *-1 else [Column1] *1) But I can't get it to work. Column1 is the values and Column 2 is the one with the text. Any ideas? Thanks

Why does a Python request from Firebase Cloud Functions result in a CoreFoundation error?

I am attempting to make a request to a third party API via a python script in a Firebase cloud function (2nd generation cloud functions python public preview): def foo(req: https_fn.Request) -> https_fn.Response: url = 'https://catfact.ninja/fact' res = requests.get(url) return json.dumps(res.json()) When I call this function, I get the following error: The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). Break on THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC () to debug. I know this is related to the request because when I remove the request this error no longer occurs. I read online that this issue was a Mac related thing and I am indeed on a Mac. I also tried simply executing the above request in a separate python file, which worked fine. This leads me to believe this issue is related to something in Firebase Functions. Does anyone know what's going on here?

Why is my useRef not working on my overflowing absolute div with Styled Components?

Trying to create a dropdown with Styled Components that if the dropdown is going past the viewport a right will be applied, example: Component (stripped): export default function SoTest() { const [dropActive, setDropActive] = useState(false) const ref = useRef() return ( <> <Foo onMouseEnter={() => setDropActive(true)} onMouseLeave={() => setDropActive(false)} > // Removed code </Foo> <DropContainer ref={ref} isOverflow={useIsOverflow(ref)} dropdownActive={dropdownActive} onMouseEnter={() => setDropActive(true)} onMouseLeave={() => setDropActive(false)} > // Removed code </DropContainer> </> ) } then in the style, I'm attempting: const DropContainer = styled.div` display: ${({ dropdownActive }) => (dropdownActive ? 'flex' : 'none')}; right: ${({ isOve

Angular Polyfill for Angular 14 app giving an error

I recently upgraded my angular app from v14 to v15. Due to a business need, we need to support Chrome 69 for the app. So, I added the following lines of code in my polyfills.ts file: import '@angular/localize/init'; import 'core-js/stable'; import 'regenerator-runtime/runtime'; import 'zone.js/dist/zone'; The compilerOptions in my tsconfig.json are as follows: "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "module": "es2020", "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2020", "dom" ], "useDef

What's the order of destruction of function parameters and return values?

In the following code: struct Foo { void Func(); ~Foo(); }; Foo GetFoo(Foo foo); The function GetFoo accepts a parameter foo by value and returns a Foo object. If we call GetFoo by this way: Foo f; GetFoo(f).Func(); Will the parameter foo or the return value object destruct first according to the C++ standard? C++17 says in expr.call#4 that the implementation can choose whether to destruct the parameter object when the function returns or at the end of the enclosing full-expression: It is implementation-defined whether the lifetime of a parameter ends when the function in which it is defined returns or at the end of the enclosing full-expression. And in class.temporary#4 it also says a temporary object (the return value object) is destroyed as the last step in evaluating the full-expression: Temporary objects are destroyed as the last step in evaluating the full-expression that (lexically) contains the point where they were created. Then if the implementat

Convert GEOSwift.JSON to struct in Swift

I have a GEOSwift feature like this: { "type" : "Feature", "geometry" : { "type" : "Point", "coordinates" : [ -xx.xxxxxxxxxxxxxxx, xx.xxxxxxxxxxxxxxx ] }, "properties" : { "mapLayer" : "MyMapLayer", "data" : { "id" : 42, "sizeClass" : "Large", // and so on... }, "featureType" : "MyFeatureType" } } I want to retrieve the data member and put it into a struct that matches: struct MyStruct: Decodable { var id: Int var sizeClass: String? // and so on... } This code will get me the data alone, but the datatype is GEOSwift.JSON, and I don't know how to stringify it to decode using the usual JSONDecoder class. if case let .object(data) = feature.properties?["data"] { // do stuff with data: GEOSwift.JSON to get it into MyStruct } Here is the GEOSw

Squarespace unique identifier solution no longer works due to change in form. Need help to determine why it wont work/solution

SS=Square Space Previously there was a script posted by Ian_A on the SS forums to add in a unique identifier on forms submitted to prevent collation of emails in gmail. This enabled us to reply to each received form by hitting reply without needing to alter our default gmail box to conversation view etc. We cannot change our gmail settings. (cannot turn on conversation view without alienating some users) SS have since changed how the forms work and I believe that the $ parameter of the script no longer targets the correct part of the field. I don't have a coding background, my limited understanding is that the $ is the way jquery selects the field. I am not sure how to structure the jquery selector to pick the field I want by perhaps the class ID which is unique to each field on the form. There is only one form to make this work on. I only have access to header code injection and custom CSS. I need each email sent by the form to have a randomised subject (or time/date stamped)

How do I print microphone input to the serial port of arduino nano 33 ble sense?

Good day, I have an arduino nano 33 ble sense with a microphone on it. Using the PDM.h library I extract the audio into a sample buffer 512 bytes at a time. I use a type of ping pong buffer to save data while I print to the serial port but it keeps crashing, what did I do wrong? #include <PDM.h> #include <stdlib.h> // buffer to read samples into, each sample is 16-bits char sampleBuffer[512]; //ping pong buffer //total bytes is how many bytes the microphone recorded //write offset switches between first or second half of the ping pong buffer //read offset switches between first or second half of the ping pong buffer //ready to print indicates that the data is ready to print char audio[66000]; long int totalBytes = 0; int writeOffset = 0; int readOffset = 0; int half = 32768; bool readyToPrint = false; void setup() { //the sample rate is 16Khz with a 16-bit depth that means 32KBytes/s are needed to fully transfer this signal //the baud rate represents the bit rate

How can I get Ansible client IP from target host?

On an isolated network (without internet access to do public IP address lookups), I want to run a playbook from a controller against a number of target hosts where one of the tasks is to download a file via HTTP/HTTPS from the controller without hard-coding the controller IP as part of the task. E.g. Controller: 192.168.0.5 Target 1: 192.168.0.10 Target 2: 192.168.0.11 Target 3: 192.168.0.12 The controller can have different IPs configured via DHCP, and there could be multiple network interfaces listed in ansible_all_ipv4_addresses (some of which may not be available to the target hosts) so it may not be straight forward to determine which network interface the target hosts should use from ansible_facts on localhost without exploring the idea of looping through them with a timeout until the file has been downloaded. It seems as though the most robust way to determine the public IP of the controller (assuming the web server is listening on 0.0.0.0) would be to determine the originat

Missing 1 required positional argument 'element'

Type error: __init__() missing 1 required positional argument: 'element' I got the code from github. I wanted to run but it doesn't work. Can you help from equation import Equation from time import sleep def run_balance(): """ Runs the chemical equation balance algorithm """ print('=================================================') print('Insert chemical equation with elements in\nparentheses followed by the number of atoms:') print('Example: (H)2 + (O)2 = (H)2(O)1') user_input = input('>>> ') try: equation = Equation(user_input) print('Balanced equation: ' + equation.balance()) sleep(3) run_balance() except IndexError: print('Invalid input...') sle