QuestionId
stringlengths
8
8
AnswerId
stringlengths
8
8
QuestionBody
stringlengths
91
22.3k
QuestionTitle
stringlengths
17
149
AnswerBody
stringlengths
48
20.9k
76381436
76381929
I am using ST_Intersects to check if two polygons intersect. Relevant part of my query is: SELECT entity_number FROM coordinates WHERE ST_INTERSECTS($1, location) It works well to determine if one polygon crosses the other's surface: I expected ST_Intersects to return false when two polygons share sides, but it does...
Is there ST_Intersects alternative that allows two(or more) polygons to share sides
You want ST_Overlaps: Returns TRUE if geometry A and B "spatially overlap". Two geometries overlap if they have the same dimension, each has at least one point not shared by the other (or equivalently neither covers the other), and the intersection of their interiors has the same dimension. The overlaps relationship i...
76385016
76385223
I'm using React Router v6 and following are my routes: const router = createBrowserRouter([ { path: '/', element: <App />, errorElement: <ErrorPage />, children: [ { index: true, element: <HomePage />, }, { path: '/sign-up', element: <SignUpPage />, ...
React Router - How can I reuse my layout for the errorElement in the root route?
When there's an error it is kind of an either or kind of scenario. Either conditions are fine and the App component is rendered or there's an error condition and the ErrorPage component is rendered. What you could do is to abstract the layout portion of the App component into a layout component on its own that can rend...
76381457
76381967
I'm learning flutter and I have made an app that looks like this: I'm facing a problem as to how to fix the container fixed on a particular spot on the screen like it has to be aligned to the top center. Here's the problem I'm facing: Here's the code: class Program7 extends StatefulWidget { const Program7({super.ke...
How to fix a container at a particular spot on the screen
The issue is using MainAxisAlignment.spaceAround,. It will use the free space and put half before and another half at end of the child. You can use fixed gap for top(Container). return SafeArea( child: Column( children: [ SizedBox(height: 50), Container( height: cHeightAndWidth, width:...
76383196
76383405
Any particular reason about this isn't matching the element with that class? I have checked a million times and can't see what is that I'm doing wrong. $('.lnk-folder').click(function(e) { e.preventDefault(); var header = $(this).parent('thead').find('.folder-header'); console.log($(header)); }); <script src="h...
Find element by class under the same parent
parent() is your problem. It looks up the DOM exactly one level, to the parent element, but you need to go higher than that. To do so, use closest() $('.lnk-folder').click(function(e) { e.preventDefault(); var header = $(this).closest('thead').find('.folder-header'); console.log($(header)); }); <script src="htt...
76384931
76385224
I have 2 data frames df1 +--------------------+---+--------------------+--------------------+ | ID |B |C | D | +--------------------+---+--------------------+--------------------+ | 1|1.0| 1.0| 1.0| | ...
How to replace a spark dataframe row with another spark dataframe's row using java
To stay computationally efficient, it's always a good idea to avoid joins/shuffles where possible. This looks like a case where it is possible to avoid joining, have a look at the following code (it is in Scala, but the principles remain the same): // Constructing the 2 dfs val df = Seq( (1, 1.0, 1.0, 1.0), (2, 2.0...
76381864
76382001
I have made this code to find the distance between stations but in the output, there is only one value. Can you find the error? df <- data.frame( station = rep(c("A", "B", "C", "D"), each = 20), temperature = rnorm(80), latitude = c(40.7128, 34.0522, 41.8781, 39.9526), longitude = c(-74.0060, -118.2437, -87.629...
Make a loop to find the distance between stations in R
There are two issues here: Your input data frame might not look the way you expect it to - the latitude and longitude columns are recycled so you have multiple different coordinates for the same station. Try adding rep() in the lat and long columns as well as station. In your code lat1 <- df$latitude[df$station == st...
76381890
76382014
Im developing a shiny app with several features. I added a button to download a single pdf file that contains many plots. I want to save those plots in individual pages but I want to choose the size of each pdf page. Is that possible? This is he code that have so far: output$exportall<-downloadHandler( filename="Allpl...
save multiple pdf pages with different sizes in Shiny R
Perhaps the simplest is to create separate PDFs (sized appropriately) and combine them with qpdf::pdf_combine. file <- "file.pdf" pdf(paste0(file, ".8x11"), width=8, height=11) plot(disp ~ mpg, data = mtcars) gg <- ggplot(mtcars, aes(disp, mpg)) + geom_point() print(gg) dev.off() pdf(paste0(file, ".7x7"), width=7, heig...
76385216
76385238
I have written a little class which reads a text file and which have a method for printing the text (file.output()). For the first call it worked, but the second call of the method nothing is happening. I do not understand why, since I assume that the FOR-Loop does not change anything. class Datei(): def __init__(s...
Why can I only print the text of a text file once?
When you read a file, you move a pointer through it, and it's now at the end - you can .seek(0) to get back to the start (or other positions, 0 is where you started from, which is the beginning if you're not in append mode) with open(path) as fh: print(fh.tell()) # start of file print(fh.read()) # get everyth...
76381693
76382030
How do I correct my code to be able to order its elements according to which has the canonical vector with a value equal to 1.0 in the element closest to the beginning of its sublists (ignoring the first sublist, which is the one with the titles, although this will also change position according to the position of elem...
How to sort array elements based on the closest occurrence of a sublist with a numeric value of 1.0? And then combine this sorted matrix with another
You need to sort the titles together with the other lists. You can do it with zip matrix = [['B', 'X1', 'X2', 'X3', 'X4', 'X5', 'U1', 'U2'], [8, 2.0, 1.0, -1.0, 0, 0, 1.0, 0], [2, 1.0, 1.0, 0, 1.0, 0, 0, 0], [8, 1.0, 2.0, 0, 0, -1.0, 0, 1.0]] matrix_aux = [['X4', 'U1', 'U2'], [0, 1.0, 0], [1.0, 0, 0], [0, 0, 1.0]] mat...
76383130
76383421
I am building a chat window. We are currently in the migration phase from Objective-C to SwiftUI and we do support a minimum of iOS 13+. To get behaviors of scroll view where I want to point to the bottom always as default and should be able to scroll up and down seamlessly. Here only problem is here scroll only works ...
Custom Reverse Scroll view in SwiftUI
One option is to just flip the built-in ScrollView upside down. import SwiftUI struct ReverseScroll: View { var body: some View { ScrollView{ ForEach(ChatMessage.samples) { message in HStack { if message.isCurrent { Spacer() ...
76384846
76385239
I have a React website where I have 2 toggles for different kinds of cards - one of them is Live markets (this type has a timer component). Here is the problem- When I switch to classifieds and I switch back to live markets - Auction timer for the first card becomes NaN. Note: this only happens to the first card, the ...
The first timer in a react component list is getting value NaN
Since it works after you add id and endTime as dependencies to the useEffect (as mentioned in the comments of the OP), it seems that the issue is that the first render you do of the first Time is done without/or with a wrong endTime so it end up displaying NaN. Subsequent renders, I assume after fetching the data from ...
76381953
76382049
Assuming the following data: df <- data.frame(a = 1:3, b = c(1, 2, 6), c = c(4, 6, NA), d = c(6, NA, NA)) a b c d 1 1 1 4 6 2 2 2 6 NA 3 3 6 NA NA And what I want is: a b c d 1 1 6 4 1 2 2 6 2 NA 3 3 6 NA NA I thought about some combination of across and rev, but my current attempts don't work.
Reverse the content order of several columns (ideally in tidyverse)
You can do the following: pivot_longer(df, -a) %>% filter(!is.na(value)) %>% mutate(value=rev(value), .by=a) %>% pivot_wider(names_from = name, values_from = value) Output: a b c d <int> <dbl> <dbl> <dbl> 1 1 6 4 1 2 2 6 2 NA 3 3 6 NA NA
76380645
76382058
I'm looking to create using Bicep, diagnostic settings on a firewall in one location and save to an Event Hub in another location. The two vnets are peered, but I am wondering if it is possibe based on this error message: Resource '/subscriptions/123/resourceGroups/ukw-rg/providers/Microsoft.Network/azureFirewalls/ukw-...
Azure Diagnostic Logs saved to another location
You are correct. It isn't possible. https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings?tabs=portal#destination-limitations "The event hub namespace needs to be in the same region as the resource being monitored if the resource is regional." kind regards Alistair
76381970
76382106
My embed tag keeps downloading the video instead of displaying it. I have tried changing the file type of the tag, but it just downloads it in a different format. I want the tag to display the video. Here's my code below. <embed type="video/mp4" src="videos/ymcaHome.mp4" width="400" height="300">
How do I get my embed tag to display videos instead of downloading them?
You can do so by specifying the video url or the path as the src attribute value. Like this: <embed src="your_video_file_url.mp4" type="video/mp4" with="640" height="360">
76382470
76383422
Can someone explain me why the following code fails for GCC 8.5 with NaNs? bool isfinite_sse42(float num) { return _mm_ucomilt_ss(_mm_set_ss(std::abs(num)), _mm_set_ss(std::numeric_limits<float>::infinity())) == 1; } My expectation for GCC 8.5 would be to return false. The Intel Intri...
What causes the different NaN behavior when compiling `_mm_ucomilt_ss` intrinsic?
GCC is buggy before GCC13, not implementing the documented semantics of the intrinsic for the NaN case which require either checking PF separately, or doing it as ucomiss Inf, abs so the unordered case sets CF the same way as abs < Inf. See https://www.felixcloutier.com/x86/ucomiss#operation or the nicer table in https...
76385202
76385273
Why won't Binary Search find an element? I have one array with elements: BBBB, BBBB, CCCC. I want to find elements BBBB and BBBB. I want binary search to find two elements and it finds one. The output is "1" and it should be "2". import java.util.*; public class Test{ public static void main(String[] args) { ...
Why won't Binary search find an element in Java?
You have statement break - loop will be stopped after first removing. So, nFound will be incremented only once
76381948
76382120
I'm trying to make a selection of elements when I click on empty point and move pointer. In this example I'm expecting to get selection of two elements: I've tried range and selection, but not with the proper result. const mainDiv = document.createElement("div"); mainDiv.style.width = "500px"; mainDiv.style.height =...
How to select multiple DIVs by mousedown>mousemove>mouseup (pure JS)
You can solve this by keeping an array of selected items and pushing items to it when the mouse moves over the items if the mouse is depressed. const mainDiv = document.createElement("div"); mainDiv.style.width = "500px"; mainDiv.style.height = "500px"; document.body.appendChild(mainDiv); const div1 = document.creat...
76381936
76382142
I tried to implement the possibility to use the flash of the phone as a torch in my flutter app. The on/ off button is located in the appbar. This runs fine except the light on and light off Button appear both at the same time. How can I make it, that either one or the other is shown. depending on whether the lamp is ...
create on off toggle Icon for flutter torch
First of all, change the widget from stateless to stateful widget. Then define a variable to show the status of the torch isTorchOn = false; on _enableTorch() update the value to true (no need to pass context as it is now a stateful widget) Future<void> _enableTorch(BuildContext context) async { try { ...
76383358
76383463
Basically what the title says, I have some large tsv file (approx. 20k lines) and I want to delete the rest of the files after a specific column matches a string a second time (including said line)
Delete all the lines including and after nth occurance of pattern
awk '{print $0} $1=="yourstring"{if(++found==2)exit}' test.tsv Where $1 is the "specific column" and yourstring is the string you are searching for. This prints each line and then checks for the occurrence of yourstring in the first column. If it finds it, it tests a variable found which we increment, to see if it hit...
76384747
76385292
This is the flag that I have to get at the end: ******************* ** * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *** * ******************* * *** * * * * * * * * * * * * * * ...
how can I do an empty triangle with stars in c++ to after do the british flag?
Lines 1, 10 and 19 are easy, as they each consist only of 19 *. The problem is the lines 2 to 9 and 11 to 19. However, do you notice a pattern in lines 2 to 9? Line 2 consists of one * followed by 0 spaces followed by one * followed by 7 spaces followed by one * followed by 7 spaces followed by one * followed by 0 spa...
76384972
76385313
Merge two tables in power query editor (Power BI) based on string similarity with Python Consider the tables bellow: Table1 Table1 Name ... Apple Fruit A11 ... Banana Fruit B12 ... ... ... Table2 Table2 Name Value Apple A11R/T 40 B4n4n4 Fruit B12_T 50 Berry A11 60 ... ... I want to get...
Is it possible to merge two tables in Power Query Editor (Power BI) with Python fuzzy matching?
Fuzzy matching in Power Query works fine for me. Set your options to the following:
76382116
76382155
/** * C program to find and replace all occurrences of a word in file. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define BUFFER_SIZE 1000 /* Function declaration */ void replaceAll(char *str, const char *oldWord, const char *newWord); int main() { /* File pointer to hold reference of input fi...
How can I modify my C code to replace words in a file without user input?
If you don't want to take oldWord and newWord from user input, you can define them as constants in the code: const char* oldWord = "Hello"; const char* newWord = "Bye";
76383388
76383465
function addNote() { const givenTitle = document.getElementById('titleInput'); const givenNote = document.getElementById('noteInput'); let notesObj = [] let myObj = { title: givenTitle.value, note: givenNote.value, } notesObj.push(myObj) localStorage.setItem('userNote...
I want to set new object in local storage
Probably you want to add note into your existing localStorage data so here you can check if there is userNote is already set before then take it or set an empty array, let notesObj = JSON.parse(localStorage.getItem("userNote")) || [] Your whole function would be like this, function addNote() { const givenTitle = d...
76385055
76385319
Im building an AuthContext in react to handle login, i connect it to a django backend where i validate the user and then i get an authorization token import React, { createContext, useState, useEffect} from 'react'; import axios from 'axios'; export const AuthContext = createContext(); export const AuthProvider = ...
Trying to assign a response.data value to a variable in react and the value doesnt pass well
Your console log shows that response data has two properties refresh & access. But you are trying to get a property called token, which does not exist (or at least it's not visible in your screenshot). const { access: responseToken } = response.data; This should help. (if access is the one you actually need)
76383411
76383481
i have this simple nav component, but it drives me crazy because it makes every console log i make in the app two times. Im new to React btw. export const NavBar = () => { const [showNav, setShowNav] = useState(false); const handleNavClick = () => { setShowNav(!showNav); }; console.log("hi"); return ( ...
ReactJs why do i get two console logs in a simple component?
Is your app using React.StrictMode (https://react.dev/reference/react/StrictMode#fixing-bugs-found-by-double-rendering-in-development) ?
76381116
76382168
Problem: running get_pi_ij() gives the error: Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any' Called from: as.vector(data) The first thing this function does is to make the resulting alphas and beta_prelims into matrixes that match c so that they can be calculated together. This is wh...
Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any' -- when running a nested function
get_pi_ij <- function() { alphas <- matrix(get_alpha(), nrow = length(get_alpha()), ncol = length(get_alpha()), byrow = FALSE) betas <- matrix(get_beta_prelim(), # your were missing "()" nrow = length(get_beta_prelim()), ncol = length(get_beta_prelim())...
76385032
76385330
I have a Fedora 38 (6.1.29-1) server with Ruby and the Compass gem installed. When I try to execute compass -h or perform any compass compiling, I get a NoMethodError (on different lines of different .rb files, but errors nonetheless). I've looked all around for similar errors and can't seem to find anyone else that ex...
How to Fix NoMethodError Issue with Ruby Compass (1.0.0 and 1.0.3)
File.exists? was deprecated for several minor versions and existed until Ruby 2.7. And was finally removed in Ruby 3.0. Whereas the last version of the compass gem is more than 8 years old. That means it doesn't work with current version of Ruby anymore. You have basically three options: Downgrade your Ruby version to...
76384401
76385345
How to obtain path to folder in which user made right click in its background to invoke context menu? For example, user opened "D:\projects" folder and made right click in empty background area of that folder and it sees a menu item in context menu named 'Display Path'. Upon clicking it, it should invoke a simple cons...
How can I obtain the folder path when right-clicking the background of a folder and invoking a context menu using a shell extension?
You are trying to make SHGetPathFromIDList() write the string data to the memory address where a std::wstring object resides, which will not work. Use a fixed WCHAR[] array instead, eg: HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFilder, IDataObject* pdtobj, HKEY hkeyProgID) { WCHAR szPath[MAX_PATH] = {}; ...
76383425
76383491
The example below echoes 1, as expected: test -f /usr/bin echo "$?" #1 Why does the following example echo 0? if [[ -f /usr/bin ]]; then echo "Inside if statement" # This line is never executed fi echo "$?" #0 I know that the $?evaluates to the returned value of the last executed command. In my understanding,...
Bash if statement expression evaluates to FALSE but $? is 0, why?
According to man bash: if list; then list; [ elif list; then list; ] ... [ else list; ] fi The if list is executed. If its exit status is zero, the then list is executed. Otherwise, each elif list is executed in turn, and if its exit status is zero, the corresponding then list is executed and the command compl...
76381858
76382169
How do I convert table left to summary table right? I tried using get dummies function to convert values to 0 and 1. I don't know how to proceed after that.
How can I convert a left table into a summary table?
Try this: import pandas as pd import numpy as np col1 = ['']+['Hampshire']*8+['']+['Hampshire']+['']+['Hampshire']+['','']+['Hampshire']*4 col2 = ['Southhampton'] + ['']*12 + ['Southhampton']*2 + ['']*4 col3 = ['']*11 + ['Isle of wight'] + ['']*7 col4 = ['Met']*5 + [''] + ['Met']*13 col5 = ['']*5 + ['Partially met'] + ...
76385289
76385350
I have had to revert back to using Firebase functions V1 in order to schedule the running of my functions and also specify the runtime options including timeoutSeconds and memory in my code (written in TypeScript): const runtimeOpts = { timeoutSeconds: 540, memory: "1GB" as const, }; exports.cleanupEvents = fun...
Is there a way to use onSchedule and also set a custom 'timeoutSeconds' and 'memory' using Firebase functions V2?
The API documentation for onSchedule suggests that you can pass an object as the first parameter, which is a ScheduleOptions object, an extension of GlobalOptions: onSchedule({ schedule: "your-schedule-here", timeoutSeconds: your-timeout, memory: your-memory, // include other options here from Scheduler...
76382755
76383517
I want to use the ASP.NET [Range] Annotation but for the elements IEnumerables. I used the existing RangeAttribute like this: public class RangeEnumerable : RangeAttribute { /// <inheritdoc/> public RangeEnumerable(double minimum, double maximum) : base(minimum, maximum) { } /// <inheritdoc/> p...
How can I use the ASP.NET [Range] annotation for IEnumerable elements?
Ok, I've found the error, which was in the unit test. IEnumerable.Append doesn't add the element to the original object like List.Add does (see Difference between a List's Add and Append method?). Changing the unit test to the following does the trick. [Test] public void TestInvalidPhaseAngleVoltageTooL...
76383286
76383533
Let's assume we have the following XML response: <People> <Person> <Age>29</Age> </Person> <Person> <Age>25</Age> </Person> <Person> <Age>18</Age> </Person> <Person> <Age>45</Age> </Person> </People> I want an xpath 2.0 expression that will return true if...
XPath that returns true when at least one element matches
In XPath 2.0 this is exists(//Person[Age = (18 to 22)])
76385245
76385381
I have a user-settable text, where the default one is [Log in] or [register] to view the content. What I need, is to wrap the two words in square brackets in their respective links. But first, I need to check that the user didn't change this default text, in other words that they kept the square brackets. I won't go in...
Strange behavior of str_replace
Try using preg_replace with your same pattern (with additional capture): $text = preg_replace('/\[(.*?)\](.*)\[(.*?)\]/', '%1$s$1%2$s$2%3$s$3%4$s', $text); which produces %1$sLog in%2$s or %3$sregister%4$s to view the content The str_replace does not work the way you intended - the first array is an array of needles...
76383155
76383536
I use ListView to dynamically display items in my JavaFX app. Items are loaded through REST call to my backend app. Each item can be clicked and then product view is displayed instead of product list. That works (looks) fine until app window is resized. After resize, items look ugly and they use too much space. The que...
Fluid nodes list layout with JavaFX
The primary purpose of a ListView is to provide virtualization; i.e. it provides an efficient mechanism to display a large number of items, letting the user scroll through them, without the overhead of UI components for the items that are not currently displayed. It also provides some additional functionality, such as ...
76382044
76382185
I made something like this dummy class: class CreateCaseFactory: @classmethod def create(cls, user_id: uuid.UUID, type_: str) -> str: creator = cls.CASE_TO_METHOD_MAP.get(type_) if creator: return creator(user_id) else: raise Exception("Invalid type") @classm...
Factory class in Python with a mapping dictionary returns TypeError
As the error message says, instances of classmethod are not callable. When you call a class method with something like CreateCaseFactory.create(...), the descriptor protocol "extracts" the underlying function from the class method and calls it with CreateCaseFactory as the first argument. create_case_1 and _create_case...
76384865
76385382
Why Isn't Pathfinding working I'm new to scripting and This just doesn't make sense to me I Understan my other code, and I've read the documentation but when it comes to integrating the pathfinding so he will only find/create a path when he had located the nearest player and follow that path has me stumped. To be hones...
PathFinding closest Player
Here is the solved version comments should do a good job of explaining but essentially I was just being dumb I was harping to much on the direction as long as you ommit that you can essentially guide the NPC as long as he is in range instead of updating every player playerNearest path, the heartbeat function is alread...
76383514
76383541
I am looking for a way to pass a list to the Table.RemoveColumns() step in Power Query. Overview of the set up, two tables as data sources, one is a config table with all the column names of the second data source with simple 'yes' 'no' selectors identifying which columns should be kept/removed. This table is used as a...
Pass list to Table.RemoveColumns
= Table.RemoveColumns(Source,cols) where cols is a list of column names sample code let Source = #table({"Column1", "Column2","Column3","Column4"},{{"A","B","C","D"}}), removetable = #table({"Column1"},{{"Column1"},{"Column2"}}), removelist = removetable[Column1], #"Removed Columns" = Table.RemoveColumns(Source,removel...
76382000
76382205
I've been provided with the json files generated by swashbuckle for a rest api I should be consuming and I was wondering if there are tools that can take those files as input and allow an easier navigation of exposes methods, request payloads, response payloads, headers, etc. Also when working in .NET is there a way or...
Swagger: how to use the generated json files?
You can use the swagger editor https://editor.swagger.io/ This will allow you to view and browse the methods. Simply paste the contents of your received JSON. Then also, at the top of the page you have "generate client" options for different languages. Which will generate C# (or other) langauge files for you.
76378414
76383565
Im very new to working with GIS data (using Dash Leaflet and GeoPandas) and am currently stumped. My goal is to create a simple app which does the following: App starts with an empty dash_leaflet.Map() figure and a numeric input box titled "Buffer Distance" (with a default of 100) User draws a polygon on the map which...
Add New Polygon to Dash Leaflet Map via a Callback
It looks like the callback approach above is valid, I was just providing the wrong data type back to the dl.GeoJSON's data attribute . Changing this line: # convert back to GeoJSON to be rendered in the dash leaflet map return_geojson_data = combine_gdf.to_json() to # convert back to GeoJSON to be rendered in the dash...
76385364
76385392
When upgrading AWS RDS aurora postgresql cluster from 11.17 -> 15.2, I was met with this fatal error in the pg_upgrade logs: fatal Your installation contains user-defined objects that refer to internal polymorphic functions with arguments of type "anyarray" or "anyelement". These user-defined objects must be dropped be...
Updating "anyarray" or "anyelement" polymorphic functions when upgrading to 14.x or higher on AWS RDS aurora postgresql
Solution: --drop aggregate from sub 14.x db mygreatdatabase=> DROP AGGREGATE array_accum(anyelement); DROP AGGREGATE --upgrade to 14.x or higher, and then re-create using updated type: mygreatdatabase=> CREATE AGGREGATE array_accum(anycompatible) (SFUNC = array_append,STYPE = anycompatiblearray,INITCOND = '{}'); My h...
76382135
76382208
I am trying to delete rows based on one columns value! But the column length of the range in the worksheet is dynamic and large. For example, If Col C has value less than or equal to 0 that row gets deleted A B C 1 SAM 100 1 SAM 0 1 BRI -100 1 HAWK 100 It should only give me : A B C 1 SAM 100 ...
How to delete rows based on columns' value?
as said in my comment,try this: Sub test() Dim LR As Long Dim i As Long LR = Range("A" & Rows.Count).End(xlUp).Row 'get last non blank row number For i = LR To 1 Step -1 'go backwards starting at LR until row 1 If Range("C" & i).Value <= 0 Then Range("C" & i).EntireRow.Delete Next i End Sub Before code: After...
76383277
76383567
My buttons inside bootstrap columns not appearing when the screen size is small. I wanted the buttons to appear one below the other when screen size is small. What changes should I make to get my buttons one below each other on a small screen. full screen small screen adding the html code below: <body> <div class="to...
My bootstrap column not working on small screen
Instead of trying to position each button individually in the middle of the page, position the entire row of buttons. This will allow you to use Bootstrap columns better. You were also missing the the extra-small (col-12) and small (col-sm-12) column breakpoints. Replace your HTML with this (Bootstrap 5): <div class="r...
76383962
76385414
I have a list of activities that is generated dynamically with javascript in the following manner: const renderList = (activities) => { const display = document.getElementById('task-list-display'); activities.forEach((activity) => { console.log(activity); display.insertAdjacentHTML('beforeend', ` <li c...
Drag and drop not functioning on dynamically created list
That is not a problem. Here I add the eventlisteners to the unordered list (<ul>). So, the adding, cloning and removing of list items (<li>) is not an issue. There is no problem in using methods like insertAdjacentHTML(). In this example I just use cloneNode() for cloning the node that is moved and then insertBefore() ...
76383234
76383601
I'm trying to write a generic env field getter function and currently have this: export interface Config { readonly PORT: number; readonly DATABASE_URL: string; // ... other fields } const config: Config = Object.freeze({ ENVIRONMENT, PROJECT_NAME, PORT: parseInt(getEnvVariable('PORT', '9000'), 10), DATAB...
Typescript returns unknown for generic only on undefined input
If you don't pass in a defaultValue argument to getEnvVariable, then the compiler has no inference site for the generic type parameter T. So inference fails, and T falls back to its constraint, which is implicitly the unknown type. If you'd like T to fall back to something else, you can use a default type argument as ...
76382016
76382233
Task: to create a tournament bracket according to the double elimination system. For the upper bracket, there were no problems, since the teams that won in the first round meet in the second, and so on. But for the lower bracket, in addition to the games among the losers in the first round, you need to add games among ...
Recursive object construction
You could use a plain object to collect subtrees keyed by the winning team's name, starting out with an empty object. Then iterate the games in order of round and look up the two team's subtrees from that object (with a default {name} object). Then construct the children property from that and wrap it into a new root n...
76385383
76385418
I have this dataset ID Name 101 DR. ADAM SMITH 102 BEN DAVIS 103 MRS. ASHELY JOHNSON 104 DR. CATHY JONES 105 JOHN DOE SMITH Desired Output ID Name 101 ADAM SMITH 102 BEN DAVIS 103 ASHELY JOHNSON 104 CATHY JONES 105 JOHN DOE SMITH I need to get rid of the prefix I...
Removing Prefix from column of names in python
Use a regular expression to match the first word if it ends with .. df['Name'] = df['Name'].str.replace(r'^[A-Z]+\.\s+', '', regex=True)
76383593
76383613
fn main() { let foo = 5; std::thread::spawn(|| { // closure may outlive the current function, but it borrows `foo`, which is owned by the current function println!("{}", foo); }) .join() .unwrap(); } Moving the value is not an option since it have to make multiple threads The situation in ...
Closure might outlive current function even though it is joined
The compiler does not know it is joined. It does not apply any special analysis to see if threads are joined. However, if you join your threads, you can use scoped threads to access variables: fn main() { let foo = 5; std::thread::scope(|s| { s.spawn(|| { println!("{}", foo); }); ...
76383571
76383624
I wanted to perform a mathematical function on each unique item in a data frame dynamically. Normally to perform a mathematical function, we use mutate statement and create a column and perform the mathematical function manually by writing mutate statement after mutate statement. Which is feasible on a few columns. But...
Perform a specific Mathematical Function on each column dynamically in R
We could use across() update: shorter: library(dplyr) df %>% mutate(across(2:7, list("20" = ~. * 1.20, "By_2" = ~. / 2), .names = "{col}_{fn}")) first answer: library(dplyr) df %>% mutate(across(2:7, ~. * 1.20, .names = "{.col}_20%"), across(2:7, ~. /2, .names = "{.col}_By 2...
76382036
76382266
I have a random seed set at the start of my run for reproducibility. But there are a few sub-functions (e.g. rando) that also use random numbers. If I used a different random number seed just for those, it affects the random seed outside of the function. Is it possible to set the random seed and use it only locally ins...
Python Local random seed
That's why there are numpy random generators and that is why they recommend using that. Just define one generator for each instance, e.g.: def rando(rng): print('function') print(rng.integers(1, 100)) print(rng.integers(1, 100)) print('end of function') return None rng1 = np.random.default_rng(69...
76385267
76385442
I'm making a site using Remix where I'd like to persist session values across pages. I think the issue lies in the getSession request, as the values do not persist across requests to the same page. I have implemented a session cookie in sessions.ts: const { getSession, commitSession, destroySession } = createCookie...
Remix session values don't persist across pages
the issue was to do with the sameSite option and Secure options. as I am working locally, Secure must be set to false which means sameSite must be either lax or strict
76381732
76382299
I have a problem, where I have to find the optimal cost of 3 given motor. Motor 1 has a range of 100 - 300 Motor 2 has a range of 400 - 1000 Motor 3 has a range of 50 - 250 They have a target value of 600 Motor 1 price is 5000 Motor 2 price is 5500 Motor 3 price is 5250 The equation looks like this: Cost = Motor1 * 500...
How to put 'or' into contraints in Pulp in python
I make some assumptions: Continuous power of motors, not integral Observe the minima in your variable bounds, not the redundant and inconsistent constraints added later Use 500 as a target, not 600 You need binary selection variables, like this: from pulp import LpProblem, LpVariable, LpMinimize, LpContinuous, lpDot,...
76383521
76383631
I am trying to calculate future dates by adding a column with number of days df['num_days'] to another column df["sampling_date"] but getting Overflow in int64 addition. Source code- df['sampling_date']=pd.to_datetime(df['sampling_date'], errors='coerce') df['future_date'] = df['sampling_date'] + pd.to_timedelta(df['nu...
How to fix - Overflow in int64 addition
The issue is this value: 48357555 You can create a simple function as shown below to return NaT if error is thrown: import numpy as np import pandas as pd # Here is an example df df = pd.DataFrame({ 'sampling_date': ['2022-01-01', '2022-02-01', '2022-03-01', '2022-04-01', '2022-05-01', '2022-06-01'], 'num_days...
76383630
76383660
Which option is better to remove log files on aws s3 for rails7? s3 automation vs cron job I wrote some rake tasks. task :delete_stale_logs do s3 = Aws::S3::Resource.new( region: ENV['AWS_REGION'], access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] ) ...
Remove log files on aws s3 (rails7)
Cron job is better in case you have some conditional logics for the number of logs, otherwise s3 automation. If you go for cron jobs, you have to handle monitoring to check if jobs fail or not. Check here for more info.
76385395
76385443
I am creating a simple search bar element in React JSX. I'm trying to render a list of elements that include whatever is in a search query. I basically take an array of all the elements and then I use .filter() function to find everything that includes the query. After that I use .map() function to loop through the res...
What could be causing my second React JSX function to fail to return elements, despite properly filtered data?
The second version never does anything with the result of .map(). It's invoked inside a forEach() callback, but its result is discarded. Contrast that to the first version where the result of .map() is part of the JSX and rendered. Don't use forEach() for this. If the intent is that the .forEach() iteration should p...
76383595
76383682
I wanted to print out a key at a specific position (like 1) in a dictionary, but the code didn't seem to work at all. Hobbies={ football(american):1 baseball:2 basketball:3 playing_cards:4 swimming:5 soccer:7 } I used this line : print (Hobbies[1]) But it got an error H...
Is there a way to get the key at a specified position?
First off, you probably shouldn't do this, because this is not how dictionaries were intended to be accessed. But if you really need to do this, probably the most straightforward way is to get the list of keys from the dictionary, and then access the dictionary using the first key. Something like: list_of_keys = [key f...
76382170
76382315
I Got Element implicitly has an 'any' type because index expression is not of type 'number'.ts(7015) error I have Improted this file import { useAmazon } from "@context/amazon"; I have Used hear const { data, current_product } = useAmazon(); and Got error const main_image = data[current_product].main_image; // error in...
How can I resolve TS7015 in my TypeScript/Next.js/React project when using an index expression that is not of type number?
You can't access the item by a property of the object using the square bracket syntax. Assuming that current_product is the name of the product (might be id, but I can't see the Product type), you need to do the following: const main_image = data !== null ? data.find(product => product === current_product).main_image :...
76384888
76385463
I'm trying to create a button whose change background color (to green) when it is cliked. But when it is cliked againg the button returns to the original background color (from orange). var btn1 = document.getElementById("btn-1") if (btn1.style.backgroundColor = "orange") { btn1.addEventListener("click", funct...
Change Button's color twice when it's clicked
let button = document.getElementById("button"); button.style.backgroundColor = "orange"; button.addEventListener("click", function () { if(button.style.backgroundColor == "orange"){ button.style.backgroundColor = "green"; } else button.style.backgroundColor = "orange"; }) <button id="b...
76383370
76383691
I've been learning Vue 3 for the past month or so and have gotten quite far but I can't fix this no matter what I've tried. I know I'm losing reactivity but I can't figure out how and it's driving me nuts. I am using the Composition API and script setup with a simple Pinia store. I created a github repo for it here: ht...
Vue 3 Component losing reactivity
project in ProjectDetails.vue is not aware of changes being made to it in the store. It will if you wrap it with computed() import { computed } from 'vue' const project = computed(() => projectStore.getProjectById(id))
76381667
76382386
I have go the problem in making elastic search regex work. I have a document that looks like this: {"content": "keySyAtUXpd8JxrpUH2Sd"} I have trying the following regex key[0-9A-Za-z_]{18} which perfectly matches with the string in regexer.com but when I query the request from elastic search it doesn't show any hits....
Elastic Search Regex are not working as expected
You need to run the regexp query against the content.keyword field curl -XGET 'https://localhost:9200/_search?pretty' -H 'Content-Type: application/json' -H 'Authorization: Basic redacted' -k -d '{ "query": { "regexp": { "content.keyword": "key[0-9A-Za-z_]{18}" } } }' PS: easier to test and provide feedback with rea...
76380607
76382427
I have this situation: I'm building a .net Maui smartphone sports app that grabs a list of latitude and longitude (new Location class) of a running activity and draws a line (polyline) in the map to display the route. I can grab the list of exercises from the database and I can draw a polyline in the map, the problem i...
.Net Maui Google Maps Polyline drawning route feature
unfortunately, MapElements is not a bindable property. However, you can work around that in a couple of ways for example, create a public method in your VM that returns the route data public Polyline GetRouteData() { var polylines = new Polyline { StrokeColor = Colors.Red, StrokeWid...
76385151
76385493
In column X are those variables that will have values in each column j, in this case only U1, X4 and U2 have values, the rest of the variables belonging to the list ['B', 'X1', 'X2', 'X3', 'X4', 'X5', 'U1', 'U2'] will all have their values 0 #example matrix new_matrix = [[ 'C', 'X', 'B', 'X1', 'X2', 'X3', 'X4', 'X5', ...
Replacing values in a string expression based on a matrix and iterating over columns
Albeit an ugly solution, this should give you the transformation you need: new_matrix = [[ 'C', 'X', 'B', 'X1', 'X2', 'X3', 'X4', 'X5', 'U1', 'U2'], [ 0.0, 'U1', 8, 2.0, 1.0, -1.0, 0, 0, 1.0, 0], ['+M', 'X4', 2, 1.0, 1.0, 0, 1.0, 0, 0, 0], ['+...
76382456
76383719
I wanted to write a query that would allow me to calculate deviations by the number of created orders. Task: the query should look back 7 days and based on this data build a minimum allowable threshold (MAT). If the number of orders for a minimum period of time (5 minutes) is less than MAT, then an alert will be genera...
How can i create a deviations query?
I'm not sure what statistics is this, and how adequate this is as a threshold, but here is query you described. sum(increase(my_search_counter{service_name="car.book.v1"}[5m])) < sum(increase(my_search_counter{service_name="car.book.v1"}[5m] offset 1w)) - stddev_over_time(sum(increase(my_search_counter{service_name="...
76383416
76383740
In a Java 17 project, I have a collection of objects with a String field propGroupName representing the group this object belongs to and a Boolean field propValActive representing whether this object is flagged as active internally. I want to aggregate these objects by the string field into a Map<String, Boolean> with ...
Group list of objects into Map with value being true if any object in group has field set as true using Java stream API
groupingBy is such a powerful collector : public Map<String, Boolean> determineActiveGroups(Map<String, PropertyValueDefinitionGroupView> standardPvdgMap) { return standardPvdgMap.values() .stream() .filter(pvdgView -> pvdgView.getPropGroupOid() != null) .collect(Collectors.group...
76381701
76382431
I need to have a MS Word Macro check upon file exit or file close, that certain specified text fields (legacy form fields, not content control) are empty. I have used some code that is a pretty intrusive warning box. But its also contingent on the user selecting that field then the macro pops up a warning box either up...
MS Word VBA to check for empty text form fields upon file close/exit
Yes, just write the check code in the event handler procedure Document_Close in ThisDocument object, like this Sub Document_Close() Dim ff As FormField, sInFld As String, msgShown As Boolean, d As Document, i As Byte 'Dim ffNameDict As New Scripting.Dictionary, ffNameSpecCln As New VBA.Collection Dim ffName...
76383035
76383754
I am facing an issue with Typescript generics. I have a function which must be called with a type and some attributes depending on this type. Typescript does not manage to infer the type of attributes when inside an if guarding the type to TYPES.ME: enum TYPES { ME = 'me', YOU = 'you' } type Attributes<T exten...
Type inference on function parameters with nested generics?
Currently, TypeScript is unable to re-constrain generic type parameters as a result of control flow analysis. Inside the body of func(type, attr), you check that type === Types.ME. This can narrow the type of type from T to something like T & Types.ME. But it cannot do anything to T itself. The type parameter T stu...
76383892
76385502
I'm developing a car rental automation system in SQL, and I'm seeing unwanted data in my table that I've received and constantly updated. The query I need to write is as follows: 'Write a query that retrieves information about the last rented car for customers who have rented cars with the feature of a sunroof at least...
SQL query for last rented car with sunroof feature in car rental system
The solution has two steps: Identify all customers who have ever rented a car with a sunroof, and For each such customer, look up the latest rental for each such customer. The first step is pretty straight forward - Filter the rentals for sunroof and select distinct customer IDs. The second step can be done a couple ...
76382019
76382608
I am trying to read a value from a sensor, BMP280 over SPI on a Raspberry Pi Pico. But I am getting an unexpected value. I created a new repo based on the rp2040-project-template and modified it to add SPI functionality. I added these imports: use embedded_hal::prelude::_embedded_hal_spi_FullDuplex; use rp_pico::hal::s...
Read value from SPI on Raspberry Pi Pico using Rust
read() is probably not the function you want to use here; it doesn't acutally perform any bus action but only gives you the byte that was read during the last send(). The function you actually want to use is transfer(). On a full-duplex SPI bus, a "read" action is always also a "write" action, and transfer performs bot...
76383668
76383803
I have a simple HTML snippet like this: <p align= "left"> <FONT size=3><STRONG> Asset: &nbsp; </STRONG></FONT><STRONG><FONT color="blue" size=2> something something here </FONT></STRONG><br> </p> The font color does not seem to work but the font size does change. Also, I do understand that explicit font de...
Font Color does not update
Using HTML elements and classes is the better option although I do admit some might seem overly complicated. For my answer, first I give the paragraph a class. Inside of it, I'm aligning the text left and bolding EVERYTHING in it. Next, spans are by default inline (meaning they show inline with the text, but you don't ...
76384530
76385508
Uncaught TypeError: Cannot read properties of undefined (reading 'params') Unabel to navigate to id can anyone help? i am woriking on django as backend and react as frontend class ArticleDetail extends React.Component{ state={ article:{} } componentDidMount(){ const id = this.props.match.p...
TypeError: Cannot read properties of undefined (reading 'params') Django + React
This should be a frontend problem. 1-) Add the following line of code at the beginning of your class: import { useParams } from 'react-router-dom'; 2-) Then add this function above your class (copy it exactly): export function withRouter(Children){ return(props)=>{ const match = {params: useParams()}; retu...
76381276
76382625
When i join two tables in search handler there is a same column in both tables, i cannot access the value of left table for example if there are two tables user and volunteers they both have id column when I write a search handler like this $builder->join('users', 'volunteers.user_id', "=", "users.id") ->join('polici...
Getting user ID instead of volunteer ID while joining tables in Laravel GraphQL search handler
I implemented your problem and the problem happened to me but I solved it by using $builder->select('your columns').
76383738
76383823
Novice trying to simplify my jQuery, to avoid repetition I am a novice with Javascript and jQuery, but have written some code to display a tooltip on a form depending on the answer selected to a dropdown. Right now I am repeating the steps twice: Once to check the dropdown on page load, in case it has reloaded due to ...
How can I simplify my jQuery code to avoid repeating instructions?
The syntax is definitely wrong, but in the function definition. It should look like this. No guarantees on whether the functionality is correct.: $(document).ready(function(){ let service = ''; let otherservice = ''; const checkTooltip = () => { service = '.v' + $('select#989022_58716pi_989022_58716...
76383689
76383855
I have a git repository created in Azure Devops. I need to restrict access to it in such a way that the repo is accessible only for TeamA. When I set Deny for all other groups and Allow only for TeamA, the permission Deny takes preference when the user belongs to both Contributors and TeamA. Would you please help me to...
Azure Devops git repository permissions: how to prioritize 'Allow' over 'Deny'?
Use the Not Set permission as an implicit Deny. As you've discovered, explicit Deny takes precedence over explicit Allow.
76382065
76382676
mysql recently reported me the following error: [HY000][1366] Incorrect string value: '\xF0\x9D\x98\xBD\xF0\x9D...' for column 'name' after investigation, I found that the value with weird characters comes from a filename, which apparently contains bold characters: 4 𝘽𝘼𝙉𝘿𝙀 𝘼𝙉𝙉𝙊𝙉𝘾𝙀 - TV.mp4 Instead of changi...
getting rid of bold characters in a filename
You can use the PHP iconv function to convert the string from one character encoding to another. In this case, you can try converting the string from UTF-8 to ASCII//TRANSLIT, which will attempt to transliterate any non-ASCII characters into their closest ASCII equivalents. Here's an example: function sanitize_string($...
76385320
76385519
even by searching on the internet I did not find, or in all that I did not understand. My problem: I would like the "inputVal" variable found in the "InputField.js" component to be found where there is "!!HERE!!" in the "App.js" component(on the fetch) please help me thank you for reading my message! export default fun...
How to get variable from component for put on the App.js
You want to extend your InputField component to accept a callback function, that can be passed by your app: export default function InputField({onSubmit}) { function handleSubmit(e) { // Prevent the browser from reloading the page e.preventDefault(); // Read the form data const form = e.target; ...
76381829
76382696
Issue Summary Hi, I have a TypeScript project where I am trying to instantiate a class which was the default export of a different package. I am writing my project in ESM syntax, whereas the package it's dependent upon has CJS output. The issue I am running into is that at runtime, when the flow reaches the point of cl...
Default class instantiation results in TypeError (ESM/CJS interop)
There are known compatibility issues between CommonJS (CJS) and ECMAScript modules (ESM). In ESM, default exports of CJS modules are wrapped in default properties instead of being exposed directly. On the other hand, named exports are unaffected and can be imported directly. If you specify "type": Specifying "module" i...
76381891
76382769
I am getting one string like this in innerHtml <div class="wrapper" [innerHTML]="data.testString"> data.testString contains data like below, data.testString="<p>some info, email <a href="mailto:test@test.com">test@test.com</a> info </p>"; I want to add aria-label for the anchor tag. <a aria-label="test@test.com" hre...
Extract href from string and again bind the updated data to the element in Angular
I'm not sure to understand all but below might help you : String character escaping var testString="<p>some info, email <a href="mailto:test@test.com">test@test.com</a> info </p>"; There is a quote issue : a double-quoted string cannot contain double-quotes unless escaped by the \ character (cf. https://www.w3scho...
76383765
76383881
I am implementing another instance of the Checkout Session in my app. In my donations controller, the following create action works fine: def create @donation = Donation.create(create_params) if @donation.save if Rails.env.development? success_url = "http://localhost:3000/d...
One instance of Stripe Checkout works, the other gives a Preflight response code of 403
The code you shared is a simple HTTP redirect server-side in Ruby and shouldn't cause a CORS error in the browser unless your client-side code is making an ajax request instead of a page/form submit. Alternatively, it's possible your form submission is mis-configured and Rails turns this in a turbo request. Adding data...
76385399
76385527
Intersection of date ranges across rows in oracle. I have a table which contains following records Item_no item_type active_from active_to rule_id 10001 SAR 2020-01-01 2023-01-01 rule1 10001 SAR. 2024-01-01 9999-12-31 rule1 10001 SAR 2020-05-01 2021-06-01 rule2 10001 SAR 2021-01-01 2021-02-01 rule2 We...
intersection across date ranges from multiple rows in oracle
From Oracle 12, you can UNPIVOT the dates and then use analytic functions and MATCH_RECOGNIZE to process the result set row-by-row to find the consecutive rows where both rules are active: SELECT * FROM ( SELECT item_no, item_type, rule_id, dt, SUM(CASE rule_id WHEN 'rule1' THEN ...
76384723
76385530
My problem is to make array of image by input field and display array images as slider in JavaScript anyone can solve it please answer me Please give code of JavaScript document.querySelector("#a").addEventListener("change", function(){ const reader = new FileReader(); reader.addEventListen...
How to make an Array of images getting by input field and display the Array image as slider
The problem that I see is to define your localstorage and make sure that the images are stored in it to later go through each one of them, I leave an example of how to solve it var images = localStorage.getItem('images') || []; function saveImages() { localStorage.setItem('images', JSON.stringify(images)); } func...
76380801
76382830
[Edit: Updated provided code and compiler error to be easely reproduced] I'm trying to pass an async function item as parameter to an other function in Rust but it won't compile, providing a cryptic error. Here is the code I'm trying to compile. Structure definition (implemented in one crate) pub struct FirstTestCompon...
Problem passing an async function item as parameter in Rust
I found the answer here: How to bind lifetimes of Futures to fn arguments in Rust The problem as I understand it is this: From https://rust-lang.github.io/async-book/03_async_await/01_chapter.html: Unlike traditional functions, async fns which take references or other non-'static arguments return a Future which is bou...
76383199
76383930
My routes are working and accessing components and loader functions. I'm trying now to pass variable filmsPerPage (which is defined once) to both Home component and the loader function in App.js: const App = () => { const filmsPerPage = 12 const router = createBrowserRouter([ { path: '/', chil...
Passing a prop/variable to react router 6 loader function
The loader function isn't returning anything. Perhaps reformatted to a more readable format will make this more apparent: { index: true, element: <Home {...{filmsPerPage}} />, loader: () => { loaderHome(filmsPerPage); // <-- not returned!! }, } The loader should still return the result of calling loaderHom...
76385338
76385536
I have a small Spring Integration application, I'm storing messages and messaging groups in the database. Currently, I have a case when some messages/groups are waiting to be sent after group timeout, but the application restarted. And when the application started I still have messages in DB and they won't be sent. I n...
How to send Messages after Spring Integration application restarted?
The MessageGroupStoreReaper doesn't work by itself, it has to be called from a @Scheduled method: https://docs.spring.io/spring-integration/docs/current/reference/html/message-routing.html#reaper However there is a nice option for you from an aggregator perspective: /** * Perform a {@link MessageGroupStore#expireMessa...
76381843
76382973
I'm importing a .csv file which I'm then modifying using calculated properties in a PSCustomObject. I'm stuck on one calculation where I'm attempting to lookup a value from a datarow object using one of the .csv values. We receive data with the supplier Part No and I need to lookup our corresponding Part No. Would you ...
Powershell - PSCustomObject with Calculated Property
Per comments, inside the where-object scriptblock on the line: $SKUs | Where-Object {$($_.VALUE) -eq $_.'PART_NO'} the automatic variable $_ relates to the individual items piped in from $SKUs, which hides the outer $_ from the $Content = (Import-Csv ...) | Select-Object ... If you want to be able to access the outer ...
76383838
76383944
The hover effect is not working in my code. Can someone help?When I run this code there is navbar present but is not clickable whereas the empty space on it's left side is clickable nor are my css hover effect working on it. * { padding: 0; margin: 0; box-sizing: border-box; scroll-behavior: smooth; ...
Hover is not working on navbar items and the cursor is changing to hand when we hover beside text and not when we hover on text
According to your code : .navbar li a:hover { color: var(--main-color); transition: .4s; } you tried to give hover effect on anchor tag as class navbar > li > a. Look at this your html code now: <ul class="navbar"> <li><a href="#Home"></a>Home</li> <li><a href="#About"></a>About</li> ...
76383381
76383955
I have a dataframe with different combination of factors. each factor is presented in its column (see below) F1 F2 F3 F4 1 1 1 1 1 1 I want to add a new column at the end like below F1 F2 F3 F4 trt 1 1 F1_F2 1 1 F1_F3 1 1 F1_F4 Ho...
Adding new column for different rows based on the values present in the same row for a different column
aggregate(ind~row, na.omit(cbind(row = c(row(df)), stack(df))), paste, collapse = "_") row ind 1 1 F1_F2 2 2 F1_F3 3 3 F1_F4 df <- structure(list(F1 = c(1L, 1L, 1L), F2 = c(1L, NA, NA), F3 = c(NA, 1L, NA), F4 = c(NA, NA, 1L)), class = "data.frame", row.names = c(NA, -3L))
76385226
76385541
I have this very basic terraform file: main.tf terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.16" } } required_version = ">= 1.2.0" } provider "aws" { profile = "default" } resource "aws_s3_bucket" "test-bucket-terraform-regergjegreg" { bucket = "te...
why my basic terraform fails to run terraform plan?
Ok, I resolved the issue. My problem was not in credentials file but in config. For some reason I had this: [default] output = json region = eu-west-1 source_profile = default removing source_profile makes it work.
76381780
76383057
I want to visualize a pre-formatted text (with YAML format and indent). It seems that the <|{text}|> markdown pattern and the state representation removes intents from the text, i.e. all becomes a long mashed text. Here is an example output. version: '3.1' stories: - story: 06a6e2c5e8bd4058b304b4f23d57aa80 steps: - int...
How to visualize formatted text without removing empty space?
The most straightforward way is to use an input visual element with multiline property turned on. main.py: from taipy.gui import Gui #with open("file.yaml", "r") as f: # yaml_text = f.read() yaml_text = """ version: '3.1' stories: - story: loferum ipsi steps: - intent: bot_capabilities user: W...
76383189
76383961
I am trying to search a given directory for a specific file, and if that file does not exist I would want the code to say "File does not exist". Currently with os.walk I can get this to work, however this will hit on every single file that isn't the specified file and print "File dos not exist". I know that this is how...
How can I limit os.walk results for a single file?
The glob module is very convenient for this kind of wildcard-based recursive search. Particularly, the ** wildcard matches a directory tree of arbitrary depth, so you can find a file anywhere in the descendants of your root directory. For example: import glob def check_file(x): # where x is the root directory for the...
76385139
76385542
How can I implement a custom method to check if the user is exists by the given parameter in the url? So I want to make a GET request.
ABAP ODATA Service implement custom GET or POST request
Assumption: you are talking about ABAP implmentation of OData v2 with SEGW approach. You are looking for a so called Function Import. This allows you to define custom functions next to the predefined CRUDQ (Create, Read, Update, Delete, Query) functions. This custom function can have custom input parameters and return ...
76380562
76383104
Consider i have a file called developers.txt What i want to do is (and i could do it in git neatly) have 3-4 commits, each adding 1 line per commit commit 2ad54bfe954006bafcb209f06ac0c12091d297c8 (HEAD -> main) Author: Anuraag <anuraag@something.com> Date: Thu Jun 1 15:04:57 2023 +0530 author #3 added developer...
Have incremental local perforce scls similar to git for a single file
Yes, this is just basic versioning and should behave similarly across any version control system. Every version builds on the one before it. C:\Perforce\test>echo Authors:>developers.txt C:\Perforce\test>p4 add developers.txt //stream/main/developers.txt#1 - opened for add C:\Perforce\test>p4 submit -d "adds heading...
76383470
76383965
My project is located here: D:/WorkSpace/PuzzleApp but when I am calling new File(".").getAbsolutePath(); I get: D:\!Documents\Desktop\. Why? And how to fix this? I'm using Eclipse.
Why by calling new File(".").getAbsolutePath() I get completely different path from my project's location?
When you open File with relative path "." this path is relative to the current process' working directory. Usually, the process working directory is inherited from the parent process (e.g. if you run your app with Terminal - the current terminal's working directory will be your process' working dir). Using a relative p...
76381260
76383270
In our project, after upgrade the SpringBoot from 3.0.4 to 3.0.9, several of our tests started to fail on Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception at app//org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:222) at app//org.springframewo...
ClassCastException for configuration CGLIB proxy and org.springframework.cglib.proxy.Factory after upgrade Spring to 6.0.9 and Spring Boot to 3.0.6
Finally. after almost of week of investigations, I managed to isolate the sinner. Solr 8.2.1 causes this issue. With Solr 8.2.0 it works with Solr 8.2.1 there is class cast exception for spring proxies. Hard to believe that this is related.
76380844
76383334
My problem is the following: I can make a figure in which the data is weighed relative to the entire population, but not relative to their own subpopulation. To illustrate with an example: Suppose I have a dataset DS, with two columns: X and type. X is a continues value ranging from -5 to 5, and type is either A, B or ...
How can I create a frequency plot/histogram in R using ggplot2 while normalizing to the total of a factor?
One option would be to use e.g. ave() to compute the count per group or Timepoint: library(ggplot2) ggplot(data = DS, aes(x = X)) + geom_freqpoly( aes( colour = TimePoint, y = after_stat(count / ave(count, group, FUN = sum)) ) ) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidt...
76385118
76385549
So I was trying to write a quick Batch file but it only did half the code, so I switched it to PowerShell because I remembered a while back I was able to get it to work and turns out this did work. My issue is essentially I have a handful of users I want to have access to this "it just closes a program and reopens". Th...
Powershell/CMD issue
You cannot use PowerShell's Start-Process directly in a batch file - you'd have to call via powershell.exe, the Windows PowerShell CLI or pwsh, the PowerShell (Core) CLI). However, as Stephan points out, cmd.exe's internal start command provides similar functionality, so its use should be sufficient in your case (as ...
76380912
76383339
As newbie I prefer use Abs XPath to get find WebElemnts where text is positioned. I tried: List<WebElement> elements = web.findElements(By.xpath("/html[1]/body[1]/div[2]/div[2]/dl[1]/dd[2]/div[2]/div/div[1]/ol[5]/li[1]/div[2]/div/p")); But i failed to catch text under tags with minor changes Target xpaths: /html[1]/bo...
What is the best way to find text content under relatively indistinguishable tags by Selenium-webdriver?
Not very clear what you want: If you want all elements that contain direct text you could use: /html/body[1]//*[text()[normalize-space()]] this will return all elements with direct text()-nodes that after filtering unnecessary whitespace, have character-data. meaning XPath-parts: // = any descendant; see this info on ...
76384278
76385594
I'm moving from a SQL Server database to a DB2 database. I'm trying to compare the primary key of the SQL Server database with the DB2 database and if its the same primary key values then do an update if they are not the same do an insert. My problem is when I use a lookup for the primary key (first four columns) it on...
How to do a lookup for the four primary keys columns yet output 6 columns to OLE DB Command
I think the issue you're not asking for the columns from the lookup component. In the UI, you drag lines between the left (Source) and right (Lookup) side. This defines the equality match for the lookup. What you want to do is check the 2 additional columns in that menu, something like the following image. This will ad...
76383537
76383985
I want to validate document before it is inserted into the database. I know that I can set static validator, but I would prefer to have a file with the validation schemas that I could modify at any time. //example schema const userCreateValidationSchema = { bsonType: 'object', required: ['username', 'pa...
How can I validate a MongoDB document using a validation schema from a file?
To perform login validation using the npm package Joi :- npm install joi Import Joi and Define Validation Schema :- const Joi = require('joi'); const loginSchema = Joi.object({ email: Joi.string().email().required(), password: Joi.string().min(6).required(), }); In the above example, the validation schema requir...
76385098
76385628
I am trying to use an actionbutton in a leaflet popup into a shiny module When trying to use an action button into a leaflet popup in a Shiny module, button do not work. See the exemple below : library(shiny) library(leaflet) library(DT) map_ui <- function(id) { ns <- NS(id) tagList( leafletOutput(ns("mym...
R-Shiny, Use action button into a leaflet popup inside a Shiny module
Yes, you have to add the ns: function(input, output, session) { ns <- session$ns ...... output$mymap <- renderLeaflet({ leaflet(options = leafletOptions(maxZoom = 18)) %>% addTiles() %>% addMarkers( lat = ~ latitude, lng = ~ longitude, data = mapdata, layerId = mapdat...
76384287
76385632
I am using ggplot2 to visualise map-related data. I have coloured regions according to a continuous value, and I would like to add a legend with colors and region names. My own data is a bit cumbersome to share, but I have recreated the scenario with public data (Mapping in ggplot2). The following code creates the incl...
Adding a legend to a ggplot map
Perhaps an inset bar chart instead: library(ggplot2) library(sf) library(dplyr) library(patchwork) # Import a geojson or shapefile map_ <- read_sf("https://raw.githubusercontent.com/R-CoderDotCom/data/main/shapefile_spain/spain.geojson") %>% mutate(name = forcats::fct_reorder(name, desc(unemp_rate))) g1 <- map_ %>%...