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.

In browser, in SMS section, incoming message senders are unlabeled

11 February 2025 @ 4:37 pm

In the SMS section of my Web browser, incoming texts are not labeled according to their sender. That is, all I see is the generic white silhouette of a person with a grey circular background. No name or image. I can live with that in a 1-on-1 SMS conversation. But in a group text with 17 people, that is not okay. I need to know who sent which message, and I cannot see that in the PB SMS interface: All messages just appear with the same generic icon and no name (text) added: SMS Section with message owners undifferentiated.

how can I add a <div class="hi"> that contains the filters inside of shop page in woocommerce?

11 February 2025 @ 4:37 pm

In woocommerce I'm not able to add a custom div that contains the filters in shop page. I saw the visual hook guide however I'm not seeing a way to do so. Any suggestion? visual hook guide I tried going here: wp-content/plugins/woocommerce/includes/wc-template-functions.php there is the function woocommerce_content() with the following code and adding a before the h2 for the filters

This error keeps popping up in my code {TypeError: 'DataFrame' object is not callable}, How to solve this?

11 February 2025 @ 4:37 pm

data_features = df.iloc[:, 2:10] labels = df['specific_class'].astype('category').cat.codes dataset = CustomDataset(data_features, labels) dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=True) No maater how much I try this thing keeps poping. What to do?

React - How to overwrite a current character inside input box (OTP inputs) when it is already full?

11 February 2025 @ 4:37 pm

I am trying to create an input box for a timer/OTP styled input. How to overwrite a current character inside input box w length 1 (OTP inputs) when it is already full? My problem is that the input is length 1, and we move the cursor/focus to the next only after catching a single character... but once a char is filled, you have to manually backspace and delete the char and then you can refill... currently inside input box(0) but since it is already filled, I can't overwrite it import { useRef, useState } from 'react' function App() { const [time, setTime] = useState(null); const [running, setRunning] = useState(false); const [editState, setEditState] = useState(false); const [hms, setHms] = useState(Array(6).fill(0)); const inputs = useRef([]); const handleChange = (e, idx) => { const {value} = e.target; if (value.match(/^\d$/)) {

Script for Infinite Craft

11 February 2025 @ 4:36 pm

yo gng, this isn't really a question but i just want a script for infinite craft bc im lazy af and if you can please script it for me, the violentmonkey script has to fastly choose two random items you have and combine them and i want it to be fast so i get new items succesfully. It can even be in python but idk what app it has to be for python to run on things in your pc i tried asking deepseek, i asked for the violentmonkey extension because of its updated knowledge and it didnt get it right, i expected it to work but i dont know about all of the web developing stuff to automatically do things

Is there a way to have a gatling check pass if values do not differ by more than 1.00?

11 February 2025 @ 4:36 pm

I need to modify the code below so the check() will pass, even if values are not exact as long as abs(val1 -val2) < 1.00 .check( jsonPath("$.data.attributes.contentValue").is(session -> session.getString("contentValue") ) ) I've tried using the session variable in multiple ways but it seems unavailable inside the validate() method. Also even the replaceAll() method is unavailable there. The code below fails to compile with 'Cannot resolve method 'replaceAll(String, String)' ' and 'Cannot resolve method 'get(String)' ' .check( jsonPath("$.data.attributes.contentValue") .transform(String::valueOf) .validate((actualValue, session) -> { double actualDouble = Double.parseDouble(actualValue.replaceAll("$", "").replace(",", "")); double expectedDouble = (double) session.get("expectedDoubleValue"); return Math.abs(expectedDouble - actualDouble) <= 1.00; }) )

Flip the text in facet rows in gglikert in R

11 February 2025 @ 4:35 pm

I have the same simulated data as described here with the difference of the group 2 has elements of big text. I want to flip horizontally the text in facet rows to but without disappearing the facet col strip at the top. How can I do it in R? library(ggstats) library(dplyr) library(ggplot2) likert_levels <- c( "Strongly disagree", "Disagree", "Neither agree nor disagree", "Agree", "Strongly agree" ) df <- tibble( grouping = sample(c("A", "B", "C", "D"), 150, replace = TRUE), q1 = sample(likert_levels, 150, replace = TRUE), q2 = sample(likert_levels, 150, replace = TRUE, prob = 5:1), q3 = sample(likert_levels, 150, replace = TRUE, prob = 1:5), q4 = sample(likert_levels, 150, replace = TRUE, prob = 1:5), q5 = sample(c(likert_levels, N

creating Zip file on the Download folder of User profile fails

11 February 2025 @ 4:28 pm

I am trying to make a zip file and download on the Download Folder of the User profile public void CreateZipFile(string tempFolderPath, string zipFilePath, string zipFileName) { using (Package zip = Package.Open(zipFilePath, FileMode.Create)) { foreach (string file in Directory.GetFiles(tempFolderPath)) { if (Path.GetExtension(file).ToUpper() != ".ZIP") { string zipPartUri = $"/{Uri.UnescapeDataString(Path.GetFileName(file))}"; Uri partUri = PackUriHelper.CreatePartUri(new Uri(zipPartUri, UriKind.Relative)); PackagePart part = zip.CreatePart(partUri, System.Net.Mime.MediaTypeNames.Application.Octet, CompressionOption.Normal); using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read)) { using (Stream zipPartStream = part.GetStream()) { fileStream.CopyTo(zi

I cannot display a popup from a view model

11 February 2025 @ 4:18 pm

I want to display a community toolkit popup from a view model. The type of popup I want is a message box where I can pass a string variable that is the message I want displayed. I followed this Learn Popup Article from Microsoft, and I was able to build my popup and data bind the popup to a view model without any trouble. My problem comes when I try to display the popup from a different view model. Here is what I have so far: Popup XAML <ctm:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:ctm="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" xmlns:vwmod="clr-namespace:LockAndKeyMaui.ViewModels" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="LockAndKeyMaui.MsgBox" x:DataType="vwmod:MsgViewM

Vue 3 Router not displaying the path in the browser

11 February 2025 @ 4:14 pm

I am migrating from Vue2 to Vue3. The router seems to work properly in the sense that I am being redirected to the correct components, but the url in the browser window does not update i.e. I am in component with path /home but the browser shows /, I am in the component with path /table and my browser still shows /. My router file has: const router = new createRouter({ history: createMemoryHistory(), routes: [ { path: '/home', name: 'home-page', component: HomePage, beforeEnter: jwtMicroservices.validateJwtToken }, { path: '/sensitivePart', name: 'sensitive-part-page', component: SensitivePart, beforeEnter: jwtMicroservices.validateJwtToken }, { path: '/rmer', name: 'rmer-page', component: RMER, beforeEnter: jwtMicroservices.validateJwtToken }, { path: '/rmerClosedOrder', name: 'rmer-closed-order-page', component: RmerClosedOrder, beforeEnter: jwtMicroservices.validateJwtToken }, { path: '/mers', name: 'mers-page', component: MERS, beforeEnter: jwtMicroserv