Id
int64
1.68k
75.6M
PostTypeId
int64
1
2
AcceptedAnswerId
int64
1.7k
75.6M
ParentId
int64
1.68k
75.6M
Score
int64
-60
3.16k
ViewCount
int64
8
2.68M
Body
stringlengths
1
41.1k
Title
stringlengths
14
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
1
CreationDate
stringlengths
23
23
LastActivityDate
stringlengths
23
23
LastEditDate
stringlengths
23
23
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
1
21.3M
Tags
list
73,951,039
2
null
73,950,565
1
null
I think there are a few ways to go about this, but here is a way to explain the useState in a way that fits the question. [CodeSandbox](https://codesandbox.io/s/usestate-array-qgdx3o) For simplicity I made a Card component that knowns if it has been clicked or not and determines wither or not it should show the checkmark. Then if that component is clicked again a clickhandler from the parent is fired. This clickhandle moves the Card into a different state array to be handled. The main Component: ``` export default function App() { const [unselectedCards, setUnselectedCards] = useState([ "Car", "Truck", "Van", "Scooter" ]); const [selectedCards, setSelectedCards] = useState([]); const addCard = (title) => { const temp = unselectedCards; const index = temp.indexOf(title); temp.splice(index, 1); setUnselectedCards(temp); setSelectedCards([...selectedCards, title]); }; const removeCard = (title) => { console.log("title", title); const temp = selectedCards; const index = temp.indexOf(title); temp.splice(index, 1); setSelectedCards(temp); setUnselectedCards([...unselectedCards, title]); }; return ( <div className="App"> <h1>Current Cards</h1> <div style={{ display: "flex", columnGap: "12px" }}> {unselectedCards.map((title) => ( <Card title={title} onClickHandler={addCard} key={title} /> ))} </div> <h1>Selected Cards</h1> <div style={{ display: "flex", columnGap: "12px" }}> {selectedCards.map((title) => ( <Card title={title} onClickHandler={removeCard} key={title} /> ))} </div> </div> ); } ``` The Card Component ``` export const Card = ({ onClickHandler, title }) => { const [checked, setChecked] = useState(false); const handleClickEvent = (onClickHandler, title, checked) => { if (checked) { onClickHandler(title); } else { setChecked(true); } }; return ( <div style={{ width: "200px", height: "250px", background: "blue", position: "relative" }} onClick={() => handleClickEvent(onClickHandler, title, checked)} > {checked ? ( <div id="checkmark" style={{ position: "absolute", left: "5px", top: "5px" }} ></div> ) : null} <h3>{title}</h3> </div> ); }; ``` I tried to make the useState actions as simple as possible with just a string array to help you see how it is used and then you can apply it to your own system.
null
CC BY-SA 4.0
null
2022-10-04T16:39:46.620
2022-10-04T16:39:46.620
null
null
15,085,578
null
73,951,202
2
null
73,945,984
0
null
You have extra and wrong imports in your `urls.py` module: ``` from rest_framework import routers from rest_framework.router import DefaultRouter ``` But you just only need this import: ``` from rest_framework.routers import DefaultRouter ``` After this change this error will go away and you can run your project successfully.
null
CC BY-SA 4.0
null
2022-10-04T16:55:00.540
2022-10-04T16:55:00.540
null
null
11,833,435
null
73,951,359
2
null
73,912,563
1
null
OK, just reread and finally get @Hans Passant's comment. It doesn't fire in the second instance, only the first/existing instance. Doh!
null
CC BY-SA 4.0
null
2022-10-04T17:09:10.960
2022-10-04T17:09:10.960
null
null
20,132,838
null
73,951,375
2
null
70,160,545
0
null
Obviously a hard one On Odoo studio, it xpath on the mother view and write the sub tree and the form directly in the field so the ref view is the ignore. Sure it work, but what about upgrade, but Studio is a Enterprise feature with garantee to upgrade so, if some one got a better solution, I suggest doint the same, xpath mother view to define the tree and the form of the children datas
null
CC BY-SA 4.0
null
2022-10-04T17:10:48.183
2022-10-04T17:10:48.183
null
null
20,160,465
null
73,951,703
2
null
73,951,351
1
null
Here is one simple way in Python/OpenCV. Just use cv2.inRange() to do the threshold on the crack's gray value. Input: [](https://i.stack.imgur.com/uoYmO.png) ``` import cv2 # load image img = cv2.imread("cracks.png") # threshold using on dark gray lower = (1,1,1) upper = (120,120,120) thresh = cv2.inRange(img, lower, upper) # write result to disk cv2.imwrite("cracks_threshold.png", thresh) # display it cv2.imshow("thresh", thresh) cv2.waitKey(0) cv2.destroyAllWindows() ``` Threshold result: [](https://i.stack.imgur.com/EQDEn.png)
null
CC BY-SA 4.0
null
2022-10-04T17:43:23.743
2022-10-04T17:43:23.743
null
null
7,355,741
null
73,951,752
2
null
73,951,705
1
null
try: ``` =COUNTIF(FILTER(FILTER(C2:E4, C1:E1=A7), B2:B4=A6), "hol") ``` [](https://i.stack.imgur.com/GsfVx.png)
null
CC BY-SA 4.0
null
2022-10-04T17:47:58.977
2022-10-04T17:47:58.977
null
null
5,632,629
null
73,951,908
2
null
73,948,057
0
null
While doing my jogging, your question was bugging me, because of that `;` you showed at the end of both your good and your bad lines. Lines in a CSV file don't usually end in a semi colon! My theory that your file was created by a process that wrote a semi-colon-separated-value file containing in column 0 the contents of each comma-separated-value line. That process had to escape double quotes in saw in the standard way, which is the put double quotes around the field and replace each double quote within the field with a doubled double quote. If that theory is correct, what you can do is read the file twice, once as a semi-colon-separated-value file, and then the contents of column 0 as a CSV file. Here's code that does exactly that: ``` import pandas as pd import csv import io buffer = io.StringIO() with open("file.mixed-sv", newline="") as mixed_sv_file: reader = csv.reader(mixed_sv_file, delimiter=";") for row in reader: print(row[0], file=buffer) buffer.seek(0) df = pd.read_csv(buffer) print("df:\n", df) ``` Given this input file, which I'm calling `file.mixed-sv` to highlight it's not pure CSV: ``` Fruit1,Fruit2,N,Notes,M; Apples,Oranges,5,"These are apples, red, and oranges, orange",2; "Apples,Oranges,5,""These are apples, red, and oranges, orange"",2"; ``` my script outputs: ``` df: Fruit1 Fruit2 N Notes M 0 Apples Oranges 5 These are apples, red, and oranges, orange 2 1 Apples Oranges 5 These are apples, red, and oranges, orange 2 ``` Notes: - `csv`- - `buffer.seek(0)`
null
CC BY-SA 4.0
null
2022-10-04T18:03:42.517
2022-10-04T18:53:53.613
2022-10-04T18:53:53.613
3,216,427
3,216,427
null
73,951,935
2
null
73,951,705
1
null
Use `XMATCH` to get the `Col` number for `QUERY` and `count` inside query instead of `COUNTIF`: ``` =QUERY( {B1:E4}, "Select count(Col1) where Col"&XMATCH(A7,B1:E1)&"='hol' and Col1='"&A6&"' label count(Col1) ''", 1 ) ```
null
CC BY-SA 4.0
null
2022-10-04T18:05:58.557
2022-10-04T20:25:37.350
2022-10-04T20:25:37.350
8,404,453
8,404,453
null
73,952,066
2
null
70,550,108
0
null
If you receive this warning, you need to activate your environment. To do so on Windows, run: c:\Anaconda3\Scripts\activate base in Anaconda Prompt. Windows is extremely sensitive to proper activation. This is because the Windows library loader does not support the concept of libraries and executables that know where to search for their dependencies (RPATH). Instead, Windows relies on a dynamic-link library search order.
null
CC BY-SA 4.0
null
2022-10-04T18:19:15.833
2022-10-04T18:19:15.833
null
null
20,160,994
null
73,952,108
2
null
59,825,650
1
null
I experienced MySQL's failing to start from the System Preferences on Mac. It would turn green and red again. I also wiped and reinstalled a few times and it still wouldn't start. In my case, I realized it was because I had `AMPPS` stack installed and its MySQL running at the same time. After turning off the MySQL in the `AMPPS` stack, I was able to start MySQL from the System Preferences successfully. Not sure if you had another software stack running that would cause the problem.
null
CC BY-SA 4.0
null
2022-10-04T18:24:35.913
2022-10-04T18:24:35.913
null
null
20,105,350
null
73,952,169
2
null
73,951,514
1
null
Here maybe one option by creating a separate helper dataframe for the labels. A bit of tinkering around with the `geom_label` arguments will allow fine tuning of the labels. Editing `scale_x_continuous` `expand` argument allows adjustment of the margin to the plot to give the labels a bit more space. The reason you are not getting a label for 2022 seems to be related to `NA` values. ``` library(ggplot2) library(dplyr) labs <- temp_df_long_credit_hours |> na.omit() |> group_by(school_year) |> filter(week == max(week))|> mutate(vjust = case_when(school_year == "fall_2022" ~ 0.9, TRUE ~0.5)) ggplot(temp_df_long_credit_hours, aes(week, value, group = school_year, alpha = school_year)) + geom_line(lwd = 1.5, show.legend = FALSE) + geom_label(data = labs, aes(label = school_year, x = week, y = value), hjust = -0.1, vjust = labs$vjust, show.legend = FALSE)+ scale_x_continuous(expand = expansion(mult = c(0.05, 0.2)))+ geom_vline(xintercept = 0) ``` ![](https://i.imgur.com/I1YHl6I.png) [reprex v2.0.2](https://reprex.tidyverse.org)
null
CC BY-SA 4.0
null
2022-10-04T18:30:51.987
2022-10-04T18:45:55.360
2022-10-04T18:45:55.360
6,936,545
6,936,545
null
73,952,172
2
null
43,877,697
0
null
Can also toggle the position of the using vanilla `when` clause. [VS Code docs - when clause](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts) ``` { "key": "ctrl+k ctrl+/", "command": "workbench.action.positionPanelRight", "when": "panelPosition == 'bottom'" }, { "key": "ctrl+k ctrl+/", "command": "workbench.action.positionPanelBottom", "when": "panelPosition == 'right'" }, ``` Helps to 'minimize' terminal to the bottom when needed.
null
CC BY-SA 4.0
null
2022-10-04T18:31:17.593
2022-10-04T18:31:17.593
null
null
1,583,314
null
73,952,783
2
null
73,952,700
0
null
select cells by holding and mouseclicking: [](https://i.stack.imgur.com/zN96h.png) and then insert them like: [](https://i.stack.imgur.com/iBMaA.png) [](https://i.stack.imgur.com/EWXD2.png)
null
CC BY-SA 4.0
null
2022-10-04T19:28:35.810
2022-10-04T19:28:35.810
null
null
5,632,629
null
73,953,315
2
null
73,953,120
0
null
``` from bs4 import BeautifulSoup soup = BeautifulSoup(html_doc, 'html.parser') soup.find_all('span', attrs={"class":"wt-text-caption"}) ```
null
CC BY-SA 4.0
null
2022-10-04T20:26:56.063
2022-10-05T13:52:51.417
2022-10-05T13:52:51.417
7,327,114
7,327,114
null
73,953,406
2
null
73,948,435
0
null
This regular expression matches all the entries you listed: ``` ^(?<start>(?<starthour>[0-9]+)(?:[:\.](?<startminute>[0-9]+))?)(?:[\s]*(?:[-—]|bis|Uhr)[\s]*)*(?<end>(?<endhour>[0-9]+)(?:[:\.](?<endminute>[0-9]+))?)(?:[\s]*(?:Uhr)[\s]*)?$ ``` [https://regex101.com/r/48i2aZ/2](https://regex101.com/r/48i2aZ/2) I left out capturing "Uhr" and "bis" - I don't speak German but I assume they mean something like hour or between the hours of.
null
CC BY-SA 4.0
null
2022-10-04T20:38:19.607
2022-10-04T20:38:19.607
null
null
1,456,201
null
73,953,641
2
null
73,953,520
0
null
You need to just replace this ``` document.getElementById("theSum").innerHTML = "The sum of all the numbers from 1 to " + theNumber + " is " + theSum; ``` with this ``` alert("The sum of all the numbers from 1 to " + theNumber + " is " + theSum); ``` You may do the same for the `else` part. Here's a live demo: ``` function sumOfNumbers() { var theNumber = parseInt(document.getElementById("txtNumber").value); if (theNumber > 0) { var theSum = 0; for (var num = 1; num <= theNumber; num++) { theSum += num; } /** call "laert" to show the result. You may customize the message the way you want */ alert("The sum of all the numbers from 1 to " + theNumber + " is " + theSum); } else { alert("Enter positive number please!"); } } ``` ``` div { font-size: 16px; } ``` ``` <input type="text" id="txtNumber"> <input type="button" value="Calculate Sum" onclick="sumOfNumbers()" /> <br> <div id="theSum"></div> ```
null
CC BY-SA 4.0
null
2022-10-04T21:06:00.417
2022-10-04T21:06:00.417
null
null
6,388,552
null
73,953,718
2
null
73,953,389
0
null
Your question sounds more about geometry than about coding. What exactly do you need? Geometrically, if you want to check whether the point (a, b, c) lies inside of a (canonical) cylindrical surface (x, y, z) such that {x^2 + y^2 = r^2, z in [zi, zf] }, simply check whether `a^2 + b^2 < r^2 and c in [zi, zf]` is `True`. If the axis of your cylinder is not aligned to the z-axis, just bring the point (a, b, c) to a new system where the cylinder is in canonical form. In general, if the cylinder axis lies along the (unit) vector `v`. the angle with respect to the z-axis is simply `beta = arccos(v[2])` (`v` is already normalized!). Then you want to use [Rodrigues' rotation formula](https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula) with k = v and theta = -beta (note the sign) to transform (a, b, c). You should also check whether the rotated `p0` and `p1` already lie on the (rotated) z-axis, otherwise you should apply an additional translation to (a, b, c) before making the comparison. If what you need is help coding this up, well, post your attempt and ask away :)
null
CC BY-SA 4.0
null
2022-10-04T21:16:24.053
2022-10-04T21:16:24.053
null
null
19,962,393
null
73,954,194
2
null
28,022,915
-1
null
I had the same problem and managed to solve it like this... I am loading the `xml` files into an iframe from an anchor tag with a `target` attribute. e.g.: ``` <a href="${file.path}" target="displayFrame">... ``` What seemed to force the iframe to render the `xml` as plain text was to append an arbitrary (or even empty) query string parameter to the file URL, as follows: ``` <a href="${file.path}?" target="displayFrame">... ``` Note the '?'. - `xml``'text/plain'`- `type="text/plain"` Disclaimer: I am not sure exactly how or why this works; i.e., how it tricks Chrome into rendering the file differently, nor have I tested this extensively across other browsers.
null
CC BY-SA 4.0
null
2022-10-04T22:27:46.573
2022-10-04T22:27:46.573
null
null
688,787
null
73,954,236
2
null
73,954,027
2
null
There already maximum and minimum values of GDP in your plot. Or are you just trying to recreate this plot? If so, the following code gets you very close: ``` library(gapminder) library(tidyverse) gapminder %>% filter(country %in% c("Canada", "Japan", "Jordan", "United States")) %>% filter(year %in% c(1962, 1982, 2002)) %>% ggplot(aes(factor(year), gdpPercap, color = country, group = country)) + geom_line(size = 2, alpha = 0.8) + geom_point(size = 5, alpha = 0.8) + geom_text(data = . %>% filter(year == 2002), hjust = 0, nudge_x = 0.1, size = 5, key_glyph = draw_key_blank, aes(label = scales::dollar(round(gdpPercap)))) + geom_text(data = . %>% filter(year == 1962), hjust = 1, nudge_x = -0.1, size = 5, key_glyph = draw_key_blank, aes(label = scales::dollar(round(gdpPercap)))) + scale_color_brewer(palette = "Set2") + labs(title = "A comparison of GDP", subtitle = "GDP per capita change 1962 - 2002", caption = "Source: Gapminder dataset") + theme_void(base_size = 16) + theme(panel.grid.major.y = element_line(size = 0.05), axis.text.x = element_text(), plot.margin = margin(20, 20, 20, 20), plot.title = element_text(face = 2), plot.subtitle = element_text(face = 2, margin = margin(10, 0, 50, 0)), plot.caption = element_text(face = 2, margin = margin(30, 30, 30, 30))) ``` [](https://i.stack.imgur.com/ct0Et.png)
null
CC BY-SA 4.0
null
2022-10-04T22:34:23.377
2022-10-07T21:05:22.613
2022-10-07T21:05:22.613
12,500,315
12,500,315
null
73,954,245
2
null
73,954,152
2
null
I've slightly altered your code to use an `eventListener` rather than an inline click handler. Your code had a few syntax errors (missing closing braces, misplaced `else`) that were causing the issues. I always find it helpful to use `consoleLog` when trying to debug, which is how I found those bugs. ``` let btn = document.querySelector('.btn'); btn.addEventListener('click', sumOfNumbers); function sumOfNumbers() { var theNumber = (document.getElementById("txtNumber").value); if (theNumber > 0) { var theSum = 0; for (var i = 1; i <= theNumber; i++) { theSum += i; } alert('The sum of all the numbers from 1 to ' + theNumber + ' is ' + theSum + ''); } else { alert(`invalid input. ${theNumber} is a negative number`); } } ``` ``` <input type='text' id='txtNumber'> <button type="button" class="btn">Calculate</button> ```
null
CC BY-SA 4.0
null
2022-10-04T22:35:58.560
2022-10-04T22:53:54.967
2022-10-04T22:53:54.967
11,161,751
11,161,751
null
73,954,291
2
null
13,305,457
1
null
Contributing based on Jarek's answer. If you want tabs widths to change dynamically as you resize the TabControl as well, you can achieve this by implementing this on the TabControl Resize Event: ``` private bool doNotExecuteResizeEventAgain = true; private void Tab_Control_Resize(object sender, EventArgs e) { if(doNotExecuteResizeEventAgain) { int tabWidth = ((int)(tab_Control.Width/tab_Control.TabPages.Count)) - 1; doNotExecuteResizeEventAgain = false; tab_Control.ItemSize = new Size(tabWidth, tab_Details.ItemSize.Height); doNotExecuteResizeEventAgain = true; } } ``` The use of the variable `doNotExecuteResizeEventAgain` is because the ItemSize calls again the event Resize, so in order to stop it from cycling, I added that flag.
null
CC BY-SA 4.0
null
2022-10-04T22:42:53.507
2022-10-04T22:42:53.507
null
null
10,368,473
null
73,954,310
2
null
73,954,152
0
null
You can create an N array using `[ ...Array(theNumber).keys() ]` and then loop through and add like so ``` const sumOfNumbers = () => { const theNumber = document.querySelector("#txtNumber").value; if(isNaN(theNumber) || (+theNumber < 0)) { return alert(`Not valid or negative number ${theNumber}`); } var numArray = [ ...Array(+theNumber).keys() ]; let sum = 0; for(let i = 0; i < numArray.length; i++) { let num = i + 1; sum += num; } alert(`The sum of all numbers from 1 to ${theNumber} is ${sum}`); } ``` ``` <input type='text' id='txtNumber'> <input type="button" value='Calculate Sum' onclick="sumOfNumbers()"/> ```
null
CC BY-SA 4.0
null
2022-10-04T22:47:31.210
2022-10-04T22:58:18.830
2022-10-04T22:58:18.830
11,307,127
11,307,127
null
73,954,545
2
null
73,951,381
0
null
try this approach, works well for me, no need for every `salesman` to have its own display `areasHidden` (it does not belong in there), as per my original comment link: ``` @State var areasHidden: Bool = true @State private var selectedItem = "same type as salesman" // <--- here var body: some View { // ... List(viewModel.searchResults, id: \.self) { salesman in HStack { ZStack { Circle().stroke(.gray, lineWidth: 4) Text(String(salesman.name.first!)) } .frame(width: 40, height: 40) VStack(alignment: .leading, spacing: 10.0) { Text(salesman.name) if !areasHidden && selectedItem == salesman { // <--- here Text(salesman.areas.map { $0 }.joined(separator: ", ")) } } }.onTapGesture { selectedItem = salesman // <--- here areasHidden.toggle() } } // ... ```
null
CC BY-SA 4.0
null
2022-10-04T23:28:58.897
2022-10-04T23:28:58.897
null
null
11,969,817
null
73,954,975
2
null
11,353,287
1
null
My preferred solution is to use `gridExtra`. You can put in text or you can use calls to `grid.text` to get some formatting options. ``` library(ggplot2) # Basic faceted plot p <- ggplot(mtcars, aes(cyl, mpg)) + geom_point() + facet_grid(vs ~ am) grid.arrange(p,top='Top Label', right='Right Label') ``` [](https://i.stack.imgur.com/vc44t.png)
null
CC BY-SA 4.0
null
2022-10-05T00:56:15.387
2022-10-05T01:17:01.957
2022-10-05T01:17:01.957
4,241,491
4,241,491
null
73,955,310
2
null
73,955,283
0
null
I am pretty sure your footer is inside a div that contains a css style with a left margin or left padding. Also I suggest that you should also include a snippet of your html code because the problem might also be there like in this case.
null
CC BY-SA 4.0
null
2022-10-05T02:02:04.080
2022-10-05T02:02:04.080
null
null
15,440,045
null
73,955,536
2
null
73,809,158
0
null
If I use a smaller width image, it is displayed in a custom picture style notification in the Android 13 device without any change. If I image with higher width then this problem occurs. I fixed it by overriding the width and height of an image using a glide when loading. For Android 12 & below version devices, the image will load without this fix. ``` Glide.with(context).asBitmap() .override(500, 500) .load(imgUrl) .submit().get() ```
null
CC BY-SA 4.0
null
2022-10-05T02:56:24.123
2022-10-05T02:56:24.123
null
null
6,487,851
null
73,955,730
2
null
64,069,758
0
null
[Updated for Cypress Ver- 10.9.0 in year 2022] Use link below to install: plugin ``` https://www.npmjs.com/package/cypress-xpath ``` Install XPath Plugin using below command ``` npm install cypress-xpath ``` Add this line to e2e.js in folder ``` require('cypress-xpath'); ``` Add your xpath in cy.xpath method like below: ``` cy.xpath("//input[@name='userName']").should("be.visible"); ``` Please make sure to check that you're getting code intellisense like this (refer image attached), once successful installation of the plugin. [](https://i.stack.imgur.com/vtUPX.png)
null
CC BY-SA 4.0
null
2022-10-05T03:44:59.217
2022-10-05T03:44:59.217
null
null
10,837,620
null
73,955,734
2
null
73,955,719
1
null
You can convert it to datetime and use `Series.dt.month` ``` df['release date'] = pd.to_datetime(df['release date']).dt.month ``` ``` print(df) release date 0 12 ```
null
CC BY-SA 4.0
null
2022-10-05T03:45:42.147
2022-10-05T03:45:42.147
null
null
10,315,163
null
73,955,837
2
null
73,944,741
0
null
Consider below solution (for BigQuery) ``` select Fruits, regexp_extract(Store, r'Qty_(.*?)_Value') Store, Qty, Value from your_table unpivot ( (Qty, Value) for Store in ( (Qty_Store_A, Value_Store_A), (Qty_Store_B_C, Value_Store_B_C), (Qty_Store_D_C, Value_Store_D_C) ) ) ``` If applied to sample data in your question - output is [](https://i.stack.imgur.com/zkBOY.png) And also, slightly modified version of above where you can define Store Names explicitly if for some reason RegEx way does not work for you ``` select Fruits, Store, Qty, Value from your_table unpivot ( (Qty, Value) for Store in ( (Qty_Store_A, Value_Store_A) as 'Store_A', (Qty_Store_B_C, Value_Store_B_C) as 'Store_B_C', (Qty_Store_D_C, Value_Store_D_C) as 'Store_D_C' ) ) ``` Obviously, with same output
null
CC BY-SA 4.0
null
2022-10-05T04:07:18.537
2022-10-05T04:29:42.393
2022-10-05T04:29:42.393
5,221,944
5,221,944
null
73,956,189
2
null
62,765,986
2
null
: Using this workaround is useful for debugging, but has minor negative performance implications, and could cause various libraries to misbehave; it should not be used in production code. --- You can replace the Promise constructor with your own implementation that includes a stack trace for where it was created. ``` window.Promise = class FAKEPROMISE extends Promise { constructor() { super(...arguments); this.__creationPoint = new Error().stack; } }; ``` This will give you a stack trace of the point where any given promise was created. Note that `.then`, `.catch`, and `.finally` all create new promises. This will not function with Promises created by `async` functions, as those do not use the window's `Promise` constructor. This can be used by reading the `promise` member of the `PromiseRejectionEvent`: ``` window.addEventListener('unhandledrejection', (promiseRejectionEvent) => { console.log('unhandled: ', promiseRejectionEvent.promise.__creationPoint) }) ``` Which will print something like: ``` unhandled: Error at new FAKEPROMISE (script.js:4:32) at main (script.js:6:3) at script.js:9:1 ```
null
CC BY-SA 4.0
null
2022-10-05T05:22:33.433
2022-10-05T05:22:33.433
null
null
10,002,734
null
73,956,436
2
null
52,926,535
0
null
I know it is an old thread but I am posting a working solution for any future visitor. I am using SQL Developer Version [19.2.1.247] and connected to SQL Server Express 2017 on localhost. Using jtds-1.3.1.jar downloaded from [sourceforge.net](https://sourceforge.net/projects/jtds/files/) Follow these steps: 1.Download and unzip the file into the main SQL Developer directory (or the directory of your choice). 2.In SQL Developer go to Tools -> Preferences -> Database -> Third party JDBC Drivers. Click the “add entry” button 3.Navigate to the jtds-1.3.1.jar file. 4.Save and exit preferences. 5.Close and restart SQL Developer Open “Add Connection” – there should now be a SQL Server tab. Above steps are common and if you search on google you will get most of the sites having above mentioned steps. THE PROBLEM WHICH I FOUND WAS THE DB PORT 1433 which is default port showing in connection dialoge need to be correct as your DB PORT. I use below command to know my DB PORT. ``` sqlcmd -S myServer\instanceName -d master -h -1 -W -Q "xp_readerrorlog 0, 1, N'Server is listening on'" ``` based on result I found the port is 55993, see below image [](https://i.stack.imgur.com/GCCs5.png) By changing port to the current one I am able to connect successfully. see below image [](https://i.stack.imgur.com/D7OFp.png) Hope it will help!
null
CC BY-SA 4.0
null
2022-10-05T06:05:26.067
2022-10-05T06:05:26.067
null
null
7,171,565
null
73,956,552
2
null
26,382,107
0
null
I had the same issue and ended up , which solved the problem. ➔ . Find and open ➔ and delete all Breakpoints.
null
CC BY-SA 4.0
null
2022-10-05T06:25:49.863
2022-10-05T06:25:49.863
null
null
2,627,644
null
73,956,615
2
null
73,956,458
0
null
There is some syntax problem in your original JS script to process the select drop-down selected value. Please change ``` <script> document.getElementById('doctor').onchange = function updateFees(e) { var selection = document.querySelector(`[value=${this.value}]`).getAttribute('data-value'); document.getElementById('docFees').value = selection; }; </script> ``` to ``` <script> document.getElementById('doctor').onchange = function updateFees(e) { var selection=this.selectedOptions[0].getAttribute('data-value'); document.getElementById('docFees').value = selection; }; </script> ``` Sandbox link (working): [http://www.createchhk.com/SOanswers/SOtest5Oct2022.html](http://www.createchhk.com/SOanswers/SOtest5Oct2022.html)
null
CC BY-SA 4.0
null
2022-10-05T06:34:26.527
2022-10-05T06:59:45.497
2022-10-05T06:59:45.497
11,854,986
11,854,986
null
73,956,592
2
null
73,955,430
0
null
> DataTable show Ajax error while return Json in .NET MVC First of all, you should check if in your browser log if you got the respose as expected. I think, your backend code looks alright. However, your `jQuery` snippet for getting `json` for `datatable` doesn't seems correct. You could follow below steps: ``` @{ ViewData["Title"] = "BindDataTableFromJson"; } <table id="bindDataTable" class="table table-striped table-bordered dt-responsive nowrap" width="100%" cellspacing="0"> <thead> <tr> <td>Id</td> <td>Name</td> <td>Module</td> <td>Product</td> </tr> </thead> <tbody> </tbody> </table> @section scripts { <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script> <script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script> <script> $(document).ready(function () { $.ajax({ type: "GET", url: "/StackOverFlow/GetProg", success: function (response) { console.log(response); $('#bindDataTable').DataTable({ data: response, columns: [ { data: 'bookId' }, { data: 'name' }, { data: 'module' }, { data: 'product' } ] }); }, error: function (response) { alert(response.responseText); } }); }); </script> } ``` Point to remember, while define your `column property` in `datatable` for example `bookId`, `name` must be in `lowercase` otherwise table will not traced the data accordingly. Furthermore, backend data should be same, case doesn't matter for that. ``` public class Prog { [Key] public int BookId { get; set; } public string Name { get; set; } public string Module { get; set; } public string Product { get; set; } public string Segment { get; set; } public DateTime Date{ get; set; } } ``` Entity Model should have `primary-key` for instance `BookId`. ``` [HttpGet] public IActionResult GetProg() { var listProg = _context.Progs.ToArray(); return Json(listProg); } ``` This controller will fetch the data. You can use `ToListAsync` that will work without issue as well. public IActionResult ViewProg() { return View(); } This controller will load the view [](https://i.stack.imgur.com/5ZDS2.gif) [](https://i.stack.imgur.com/M9yDp.gif) If you want to make DateTime as Nullable then you can do that in database like below: [](https://i.stack.imgur.com/3dkhz.png) Besides, In Entity Model, we can deifne a property as nullable by putting `?` in it. Like below: ``` public DateTime? Date{ get; set; } ```
null
CC BY-SA 4.0
null
2022-10-05T06:31:20.867
2022-10-05T18:04:11.847
2022-10-05T18:04:11.847
472,495
9,663,070
null
73,956,645
2
null
73,956,550
0
null
You input date string is invalid to `Date`. ``` var dt = new Date('15-10-2022'); console.log(dt) ``` You can swap `day of month` and `month` and it will work as expected as: ``` var dt = new Date('10-15-2022'); console.log(dt); ``` `FINAL CODE` ``` function taskDate(dt) { console.log(dt); } var dt = new Date('10-15-2022'); var d = dt.getDate(); var m = dt.getMonth() + 1; var y = dt.getFullYear(); var dateString = y + '-' + (m <= 9 ? '0' + m : m) + '-' + (d <= 9 ? '0' + d : d); taskDate(dateString); ``` To convert from `dd-mm-yyyy` to `mm-dd-yyyy` as: ``` const date = '15-10-2022'; const [dd, mm, yy] = date.split('-'); const newDate = [mm, dd, yy].join('-'); console.log(newDate); ```
null
CC BY-SA 4.0
null
2022-10-05T06:39:19.913
2022-10-05T06:59:07.870
2022-10-05T06:59:07.870
9,153,448
9,153,448
null
73,956,693
2
null
73,956,550
1
null
To convert a date to the yyyy-MM-dd format, the Swedish locale can be used. By the way, your date is actually invalid. Refer [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date) ``` var dt = new Date(2022, 9, 15); // the 2nd arg is monthIndex (starts from 0) var str = dt.toLocaleString('sv-SE'); // Swedish locale console.log(str); ```
null
CC BY-SA 4.0
null
2022-10-05T06:44:22.530
2022-10-05T06:44:22.530
null
null
994,006
null
73,956,765
2
null
22,787,209
0
null
You can change the bar order by altering the index order (using sort in this case): ``` pd.concat([df1, df2], keys=['df1', 'df2']).sort_index(level=1).plot.bar(stacked=True) ``` [](https://i.stack.imgur.com/1Uj2A.png)
null
CC BY-SA 4.0
null
2022-10-05T06:53:17.717
2022-10-05T07:07:02.043
2022-10-05T07:07:02.043
8,973,620
8,973,620
null
73,956,814
2
null
73,956,458
0
null
``` function display_medis(){ global $con; $query = "select med_name,med_id,mrp from med_inv"; $result = mysqli_query($con,$query); $option = ''; while( $row = mysqli_fetch_array($result) ) { $med_name = $row['med_name']; $mrp = $row['mrp']; $med_id=$row['med_id']; $option .= '<option value="' .$med_name. '" data-value="'.$mrp.'" >'.$med_name.'</option>'; } echo $option; } ``` And now your script code should look like this ``` <script> $('#doctor').on('change',function(e){ var selection = $('#doctor option:selected').val(); $('#docFees').val(selection); }); </script> ```
null
CC BY-SA 4.0
null
2022-10-05T06:58:39.403
2022-10-05T06:58:39.403
null
null
12,231,983
null
73,956,941
2
null
73,956,658
0
null
Since you do not give a reproducible example it is hard to give a specific answer. But you can try and use `cumsum()`, which gives you the cumulative sum of a column.
null
CC BY-SA 4.0
null
2022-10-05T07:13:49.943
2022-10-05T07:13:49.943
null
null
11,801,269
null
73,957,041
2
null
73,945,376
0
null
You also need to change your react code to access endpoint, Try to change code like: ``` const context = [ "/weatherforecast", "/api/user" ]; ``` and if you have fecth() method, you also need to change the url: ``` const response = await fetch('/api/user'); ```
null
CC BY-SA 4.0
null
2022-10-05T07:25:48.940
2022-10-05T07:25:48.940
null
null
17,438,579
null
73,957,245
2
null
73,945,698
0
null
``` #vormen { display: flex; width: 100%; justify-content: space-between; /* align-items: flex-start;*/ height: 100vh; } #vormen .shape_group { /* display: flex; align-items: flex-start; flex-wrap: wrap; */ width: 50%; border:2px solid red; } #vormen .shape_group svg { /* width: 50%; max-height: 50%; */ } #vormen #image_container { width: 50%; /* height: 100vh; */ border:2px solid red; } #vormen #image_container img { width: 100%; height: 100%; object-fit: cover; } .dflex{ display:flex; } .pic_responsive img{ width: auto; height: auto; } .h-50{ height:50vh; } .align{ justify-content: space-between; } .align_btm{ display: flex; flex-direction: column; justify-content: flex-end; } .align_btm h1{ line-height:0px; } @media( max-width: 780px) { .align_btm h1{ font-size: 20px; } } ``` ``` <div class="fl-html" id="vormen"> <div id="shapes_1" class="shape_group"> <div class="dflex h-50 pic_responsive align"> <img src="https://gtdeply.github.io/pic1.png"> <img src="https://gtdeply.github.io/pic2.png"> </div> <div class="dflex h-50 pic_responsive align"> <div class="align_btm"> <h1> DR RUMITELIJKE</h1> <h1> MERKVERTALERS</h1> </div> <img src="https://gtdeply.github.io/pic3.png"> </div> </div> <div id="image_container"> <img src="https://image.shutterstock.com/image-illustration/modern-interior-server-room-data-600w-1717870396.jpg"> </div> </div> ```
null
CC BY-SA 4.0
null
2022-10-05T07:45:40.273
2022-10-05T08:36:04.710
2022-10-05T08:36:04.710
17,585,934
17,585,934
null
73,957,415
2
null
73,944,866
0
null
For this, you can check document [Binding a .JAR](https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/binding-a-jar). The Android community offers many Java libraries that you may want to use in your app. These Java libraries are often packaged in `.JAR` (Java Archive) format, but you can package a `.JAR` it in a Java Bindings Library so that its functionality is available to Xamarin.Android apps. The purpose of the Java Bindings library is to make the APIs in the `.JAR` file available to C# code through automatically-generated code wrappers. Xamarin tooling can generate a Bindings Library from one or more input .JAR files. The Bindings Library (.DLL assembly) contains the following: - - The generated MCW code uses JNI (Java Native Interface) to forward your API calls to the underlying .JAR file. You can create bindings libraries for any .JAR file that was originally targeted to be used with Android (note that Xamarin tooling does not currently support the binding of non-Android Java libraries). You can also elect to build the Bindings Library without including the contents of the .JAR file so that the DLL has a dependency on the .JAR at runtime. For more information, you can check: [Binding a Java Library](https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/) .
null
CC BY-SA 4.0
null
2022-10-05T08:01:50.413
2022-10-05T08:01:50.413
null
null
10,308,336
null
73,957,575
2
null
48,195,587
0
null
I realize this is a very old question, but as I just had the same problem and found a workaround in [this answer](https://stackoverflow.com/a/73571415/3073719), I thought I'll post it anyway (and this was the first link Google showed for my search). Just print your label twice, once an empty one with blanks and then another one with no fill and border. You might have to find the correct amount of blanks, but in my case it worked without problems and with a proportional font. So with the code from the linked thread the solution would look like this: ``` #Create dataframe countries <- c("Mundo", "Argentina", "Brasil", "Chile", "Colombia", "Mexico", "Perú", "Estados Unidos") countries <- rep(countries, 120) vaccinations <- data.frame(countries) vaccinations$countries <- factor(vaccinations$countries , levels = c("Mundo", "Argentina", "Brasil", "Chile", "Colombia", "Mexico", "Perú", "Estados Unidos")) vaccinations <- vaccinations %>% group_by(countries) %>% mutate(month = 1:120, vaccines = runif(120, min = 0, max = 5)) #Write text to add manually in each country saved_text <- data.frame( label_pais = c("10.10 per 100", "11.76 per 100", "12.58 per 100", "62.94 per 100", "5.98 per 100", "8.84 per 100", "3.18 per 100", "55.96 per 100"), countries = c("Mundo", "Argentina", "Brasil", "Chile", "Colombia", "Mexico", "Perú", "Estados Unidos")) saved_text$countries <- factor(saved_text$countries, levels = c("Mundo", "Argentina", "Brasil", "Chile", "Colombia", "Mexico", "Perú", "Estados Unidos")) ggplot()+ geom_line( data = vaccinations, aes(x = month, y = vaccines, colour = factor(countries)), size = 2, show.legend = FALSE ) + geom_label( data = saved_text, mapping = aes(y = 4, x = 20, label = " "), # you have to adjust the blanks to your biggest label color = "black", # desired color label.size = 0.9 ) + facet_wrap( ~ countries, ncol = 1) + geom_label( data = saved_text, mapping = aes(y = 4, x = 20, label = label_pais, color = factor(countries)), fill = NA, label.size = NA ) ``` The result would look like this: [](https://i.stack.imgur.com/pVYG0.png)
null
CC BY-SA 4.0
null
2022-10-05T08:15:00.750
2022-10-05T08:15:00.750
null
null
3,073,719
null
73,957,915
2
null
67,531,303
0
null
Try using ``` vc = cv2.VideoCapture(cameraID, cv2.CAP_DSHOW) ```
null
CC BY-SA 4.0
null
2022-10-05T08:45:52.007
2022-10-11T19:12:36.473
2022-10-11T19:12:36.473
19,290,081
11,315,807
null
73,958,292
2
null
73,958,246
1
null
As the error mentions, you must provide a valid implementation signature: Info from the [typescript docs](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads) [Stackblitz example](https://www.typescriptlang.org/play?ssl=16&ssc=2&pln=1&pc=1#code/GYVwdgxgLglg9mABAEgM4gLYAoAecBOAXKlPjGAOYDaAugJTGnkUDcAsAFCiSwIrrY8RMJgBGAU3y0GIjBPzsu4aPCRpMuAoQCC%20fAEMAngB4SZSogA%20iWfIB8MsZKuIzzTgG9OiH4gA24lCIQgD6hIj6YIaKvogwwJr4cWAkkRDicMCIAMpMlHReHLGxwARYAUEwiJnBBAXexY2hANQAvDAxjYgAvg0%203eJ%20qOKFXYil%20OWBcdVZQvVFY74t7Z2NvYv9fYj4gSD4SKGK3UA): ``` function $sum(xor:string[]):string; function $sum(xor:number[]):number; function $sum(xor:Array<string | number>):number | string { /** * as per your overloads the function must return * - a string when the input is a string array * - a number when the input is a number array * * To determine if the input is an array of string or an array of number * you could check the type of the first array item * i.e. typeof xor[0] === 'string' * * as T.J.Crowder pointed out in a comment, * this is not possible when you get an empty array: so your * function must not allow empty arrays: i.e. throw an error */ } ``` the first 2 lines are the overloads, the 3rd is the implementation signature.
null
CC BY-SA 4.0
null
2022-10-05T09:20:22.857
2022-10-05T09:47:53.963
2022-10-05T09:47:53.963
1,041,641
1,041,641
null
73,958,498
2
null
59,743,513
1
null
When try to open WSL from VSCode was getting error Similar error when tried to execute C:\WINDOWS\System32\wsl.exe from Windows Console (cmd.exe) Did a WSL shutdown from Windows Console () and got the popup below. Re-started Docker and could open WSL from VS Code. [](https://i.stack.imgur.com/EtreP.png)
null
CC BY-SA 4.0
null
2022-10-05T09:37:39.407
2022-10-05T09:37:39.407
null
null
364,568
null
73,958,529
2
null
73,957,940
0
null
Consider using [Numpy](https://numpy.org/doc/stable/user/absolute_beginners.html). It's a widely used package that allows high performance computing on n-dimensional arrays. Example solution (using [2d convolution](https://stackoverflow.com/a/43087771/17665627)): ``` import numpy as np def conv2d(a, f): s = f.shape + tuple(np.subtract(a.shape, f.shape) + 1) strd = np.lib.stride_tricks.as_strided subM = strd(a, shape = s, strides = a.strides * 2) return np.einsum('ij,ijkl->kl', f, subM) mines = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 0]]) # 1 for bomb, 0 for empty tile mines_padded = np.pad(mines, ((1, 1), (1, 1)), mode="constant", constant_values=0) kernel = np.pad([[0]], ((1, 1), (1, 1)), mode="constant", constant_values=1) solution = conv2d(mines_padded, kernel) print(solution) ```
null
CC BY-SA 4.0
null
2022-10-05T09:40:18.530
2022-10-05T09:41:03.973
2022-10-05T09:41:03.973
17,665,627
17,665,627
null
73,958,632
2
null
23,424,417
0
null
``` // HTML code <form action="" id="uploadImage"> <input type="file" name="user_file" id="user_file" class="form-control" /> </form> // jquery $('input[type="file"][name="user_file"]').on('change', function() { var fd = new FormData($('#uploadImage')[0]); $.ajax({ url: '<?php echo base_url() ?>upload-profile?emp_id=<?php echo $_SESSION['emp_id'] ?>', type: 'POST', data: fd, cache: false, mimeType: "multipart/form-data", dataType: 'json', processData: false, contentType: false, beforeSend: function() { $('.loading-overlay').css('display', 'flex'); $('.avatar-md, .avatar-xxl').css('display', 'none'); }, success: function(resp) { $("#global-loader").fadeOut("slow"); $("#user_file").val(""); if (resp.msg == 'uploaded') { Swal.fire({ title: '<h6 class="text-success"><b>Profile Picture Uploaded...</b></h6>', icon: 'success' }) $('.avatar-md, .avatar-xxl').attr('src', resp.path) $('.loading-overlay').css('display', 'none'); $('.avatar-md, .avatar-xxl').css('display', 'inline'); } } }) }); // Codeigniter Controller function upload_profile() { $emp_id = $_GET['emp_id']; $config['upload_path'] = "./documents/$emp_id"; $config['allowed_types'] = '*'; $config['overwrite'] = TRUE; $ext = explode('.', $_FILES['user_file']['name']); $rand = rand(1111, 9999); $file_name = $emp_id . "_" . date("Y_m_d") . "_" . $rand . "." . $ext[1]; $config['file_name'] = $file_name; $this->upload->initialize($config); if (!is_dir($config['upload_path'])) { mkdir($config['upload_path'], 0777, TRUE); } $this->upload->do_upload('user_file'); $array = array( 'profile' => $file_name ); $get_profile = $this->Employee_Model->upload_profile($array, $emp_id); $this->session->set_userdata('profile', $file_name); $filename = realpath('documents/' . $emp_id . '/' . $get_profile); echo json_encode( array( 'msg' => 'uploaded', 'path' => base_url() . '/documents/' . $emp_id . '/' . $file_name ) ); try { if (!is_writable($filename)) throw new Exception('File not writable'); unlink('./documents/' . $emp_id . '/' . $get_profile); } catch (Exception $e) { } } //Routes $route['upload-profile'] = 'EmployeeController/upload_profile'; ```
null
CC BY-SA 4.0
null
2022-10-05T09:48:24.183
2022-10-05T09:48:24.183
null
null
20,165,746
null
73,958,776
2
null
48,489,285
0
null
I faced a similar issue. it got resolved when i called my placeholder as a tuple.
null
CC BY-SA 4.0
null
2022-10-05T10:02:21.543
2022-10-05T10:02:21.543
null
null
17,916,369
null
73,959,020
2
null
27,244,511
0
null
`yum.conf``exclude` In addition to all above answers, Make sure `nginx`, `httpd` or any other package you want to install is not in the `exclude` list of `yum.conf` file. 1. Open yum.conf file located at /etc/yum.conf 2. Check the exclude key and remove nginx* if it's there 3. Then try to install your package. in this case nginx: sudo yum install nginx
null
CC BY-SA 4.0
null
2022-10-05T10:23:16.403
2022-10-05T10:31:41.313
2022-10-05T10:31:41.313
884,588
884,588
null
73,959,491
2
null
73,959,430
3
null
The reason is simple. `let` is block scoped. It means that when you get out of the scope of your for loop, it does not exist. `var` scope is wider. What happens here is that the for loop increments `i` 5 times, then gets out of the loop with `i = 6` before the first setTimeout triggers (in less than 1 second) with a global scope. The `i` declared with `let` is from the function scope, while the `i` declared with var is from the outer scope Difference between let and var: [What is the difference between "let" and "var"?](https://stackoverflow.com/questions/762011/what-is-the-difference-between-let-and-var)
null
CC BY-SA 4.0
null
2022-10-05T11:06:34.860
2022-10-05T11:06:34.860
null
null
13,527,621
null
73,959,506
2
null
73,959,430
1
null
With `for` loop, each iteration has its own . 1. In the case of let as its block scope each iteration will have its own i variable and its value will be closure in the setTimeout, so each setTimeout will output the correct index 2. In the case of var as it's a functional scope, each iteration will override the previous one, and at the time of execution of the setTimeout the value of i will be 6 at the end of the iteration, will be logged in all setTimeout callbacks.
null
CC BY-SA 4.0
null
2022-10-05T11:08:05.307
2022-10-05T11:08:05.307
null
null
11,887,902
null
73,959,540
2
null
73,959,430
1
null
The scope of `i` is different when using `let` and when using `var` Here: ``` for(let i=0;i<=5;i++){ // i will not be available outside of the block below setTimeout( function clog(){ console.log(i) },i*1000 ); // mentionning the variable i will cause a Reference error starting from here ``` Whereas with `var`, `i` gets hoisted, and defined without a value at the beginning of current the function's block, at the end of the loop `i` still exists, and has been mutated, so by the time the `setTimeout` callback is triggered, the loop will be already finished and `i` will have its final value, which is the first value not matching the looping condition (i.e. `6`).
null
CC BY-SA 4.0
null
2022-10-05T11:10:55.273
2022-10-05T11:10:55.273
null
null
2,389,720
null
73,959,548
2
null
73,959,430
1
null
It is because of globally (var) or block scoped (let) value processing of javascript. In var, variable i is globally changing and the loop finishes before settimeout function runs, so the i becomming 6 globally and console log writes yo it as 6. In let, for every loop iteration there is an i variable belongs only that scope and settimeout function takes it, so the even if the loop finish it's job console log writes local varible i as 0,1,2,3,4,5. I hope i tell myself correctly. ref: [Javascript MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#:%7E:text=let%20allows%20you%20to%20declare,function%20regardless%20of%20block%20scope.)
null
CC BY-SA 4.0
null
2022-10-05T11:11:49.563
2022-10-05T11:11:49.563
null
null
7,809,360
null
73,959,725
2
null
59,257,753
0
null
This solution using typescript, you can convert this one into your programming language. Time Complexity: while loop running `length / 10` times. ``` export async function getUsersByIds(ids: [string]) { let users = [] const limit = 10 while (ids.length) { const res = await db .collection('users') .where('uid', 'in', ids.slice(0, limit)) .get() const _users = res.docs.map((doc) => { const _data = doc.data() as UserModel _data.docId = doc.id return _data }) users.push(..._users) ids.splice(0, limit) } return users } ```
null
CC BY-SA 4.0
null
2022-10-05T11:30:34.177
2022-10-05T11:56:35.960
2022-10-05T11:56:35.960
8,822,337
8,822,337
null
73,959,792
2
null
73,959,587
0
null
Some style issues in the image ``` ol, ul, li, menu { list-style: none; } a { text-decoration: none; } .social__list { display: flex; flex-direction: column; gap: 10px; } .social__icon { display: inline-block; text-align: center; -webkit-transition: all 0.25s linear; -moz-transition: all 0.25s linear; -ms-transition: all 0.25s linear; -o-transition: all 0.25s linear; transition: all 0.25s linear; } .social__icon img { width: 26px; height: 26px; vertical-align: middle; border-radius: 100%; background: rgba(196, 196, 196, 0.5); } .social__icon:active { background: #4b9200; color: #4b9200; } .social__icon:hover { animation: shake 500ms ease-in-out forwards; } @keyframes shake { 0% { transform: rotate(2deg); } 50% { transform: rotate(-3deg); } 70% { transform: rotate(3deg); } 100% { transform: rotate(0deg); } } ``` ``` <div class="social"> <ul class="social__list"> <li> <a class="social__icon" href="https://en-gb.facebook.com" target="_blank" rel="noopener" > <img src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/facebook_circle_color-512.png" alt="" /> <span>Facebook</span> </a> </li> <li> <a class="social__icon" href="https://twitter.com" target="_blank" rel="noopener" > <img src="https://cdn4.iconfinder.com/data/icons/social-media-icons-the-circle-set/48/twitter_circle-512.png" alt="" /> <span>Twitter</span> </a> </li> <li> <a class="social__icon" href="https://www.instagram.com" target="_blank" rel="noopener" > <img src="https://cdn2.iconfinder.com/data/icons/social-media-applications/64/social_media_applications_3-instagram-512.png" alt="" /> <span>Instagram</span> </a> </li> <li> <a class="social__icon" href="https://www.youtube.com" target="_blank" rel="noopener" > <img src="https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/395_Youtube_logo-512.png" alt="" /> <span>Youtube</span> </a> </li> </ul> </div> ```
null
CC BY-SA 4.0
null
2022-10-05T11:36:57.857
2022-10-05T11:36:57.857
null
null
6,099,327
null
73,960,331
2
null
73,959,181
2
null
You should use [Color.FromArgb()](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.color.fromargb?view=net-6.0#system-drawing-color-fromargb(system-int32-system-int32-system-int32)) to create the new color. However, this method expects 3 `int` as input and not `double`, so you need to convert your doubles to integers. ## Simple type cast - (int)someDouble This solution will simply remove any decimals from the double value (`1.9 => 1`): ``` double red1 = 123.45; double green1 = 12.345; double blue1 = 234.56; Color newPixel = Color.FromArgb((int)red1, (int)green1, (int)blue1); // R=123, G=12, B=234 ``` ## Math.Round(someDouble) This solution will round the double value to the nearest integer (`1.5 => 2` and `1.49 => 1`): ``` int red1 = (int)Math.Round(123.45); int green1 = (int)Math.Round(12.345); int blue1 = (int)Math.Round(234.56); Color newPixel = Color.FromArgb(red1, green1, blue1); // R=123, G=12, B=235 ```
null
CC BY-SA 4.0
null
2022-10-05T12:25:06.440
2022-10-05T12:25:06.440
null
null
3,034,273
null
73,960,721
2
null
73,960,558
0
null
I'm not a PHP developer, but if I understand the question right, you want to color the whole table row background if it contains a "0" value to red, "1" value to green, etc.? In this case you could create a function in php which could add a custom attribute to that specific row like this: ``` <table> <tr my-attribute="0"> <td></td> <td></td> <td></td> <td></td> </tr> <tr my-attribute="1"> <td></td> <td></td> <td></td> <td></td> </tr> <tr my-attribute="2"> <td></td> <td></td> <td></td> <td></td> </tr> <tr my-attribute="1"> <td></td> <td></td> <td></td> <td></td> </tr> </table> ``` and for the css you could easily select this row like this: ``` tr[my-attribute="0"]{ background-color: red; } tr[my-attribute="1"]{ background-color: green; } tr[my-attribute="2"]{ background-color: yellow; } ```
null
CC BY-SA 4.0
null
2022-10-05T12:59:21.277
2022-10-05T12:59:21.277
null
null
3,892,197
null
73,960,744
2
null
73,960,558
1
null
Easiest would be to add a class with PHP in your while loop. In your PHP code: ``` $colorclass = [0 => 'red', 1 => 'green', 2 => 'yellow']; while (odbc_fetch_row($result)) // while there are rows { $classtext = ''; $x = odbc_result($result, "has_video"); if( in_array($x, $colorclass) ) { $classtext = " class='".$colorclass[$x]."'"; } print "<tr>\n"; print " <td>" . odbc_result($result, "project_ID") . "\n"; print " <td>" . odbc_result($result, "machine_project_ID") . "\n"; print " <td>" . odbc_result($result, "video_link") . "\n"; print " <td>" . odbc_result($result, "files_link") . "\n"; print " <td>" . odbc_result($result, "draw_link") . "\n"; print " <td>" . odbc_result($result, 'has_draw') . "\n"; print " <td".$classtext.">" . odbc_result($result, "has_video") . "\n"; print " <td>" . odbc_result($result, "has_files") . "\n"; print "</tr>\n"; } ``` In your CSS: ``` .red { background: red; } .green { background: green; } .yellow { background: yellow; } ```
null
CC BY-SA 4.0
null
2022-10-05T13:00:41.400
2022-10-05T13:00:41.400
null
null
1,930,721
null
73,960,937
2
null
73,960,678
0
null
Something like this should do the trick. Maybe is not the most technical solution, but it works. ``` Sub Soggetti() Dim wsPost As Worksheet Set wsPost = Sheets("test") Dim lRow As Integer lRow = wsPost.Cells(Rows.Count, 1).End(xlUp).Row 'last row of dataset Dim nFree As Integer nFree = Range("B2:B" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row 'first empty cell in relevant column Dim Creativity(1 To 2) As String Creativity(1) = "ROOMMATES15" Creativity(2) = "FAMILY15" Dim FinalValue As String Dim counter1G1 As Long, counter2G1 As Long Dim counter1G2 As Long, counter2G2 As Long Dim CurrentGroup As String, Group1 As String, Group2 As String Dim Group1Count As Long, Group2Count As Long Group1 = "Channel A" Group2 = "Channel B" Group1Count = Application.WorksheetFunction.CountIf(wsPost.Range("A2:A" & lRow), Group1) Group2Count = Application.WorksheetFunction.CountIf(wsPost.Range("A2:A" & lRow), Group2) For x = nFree To lRow CurrentGroup = wsPost.Range("A" & x).Value FinalValue = Creativity(Application.RandBetween(LBound(Creativity), UBound(Creativity))) Select Case CurrentGroup Case Group1 If FinalValue = Creativity(1) Then counter1G1 = counter1G1 + 1 Else counter2G1 = counter2G1 + 1 End If If FinalValue = Creativity(1) And counter1G1 > (Group1Count / 2) Then FinalValue = Creativity(2) ElseIf FinalValue = Creativity(2) And counter2G1 > (Group1Count / 2) Then FinalValue = Creativity(1) End If Case Group2 If FinalValue = Creativity(1) Then counter1G2 = counter1G2 + 1 Else counter2G2 = counter2G2 + 1 End If If FinalValue = Creativity(1) And counter1G2 > (Group2Count / 2) Then FinalValue = Creativity(2) ElseIf FinalValue = Creativity(2) And counter2G2 > (Group2Count / 2) Then FinalValue = Creativity(1) End If End Select wsPost.Range("B" & x).Value = FinalValue Next End Sub ```
null
CC BY-SA 4.0
null
2022-10-05T13:15:21.453
2022-10-05T14:01:33.373
2022-10-05T14:01:33.373
19,639,186
19,639,186
null
73,960,875
2
null
73,960,558
0
null
First, place data in the `<tbody>` of the table. Second, dates can be formatted as Strings using [toLocaleDateString](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString). This function uses the [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) formatting options. Now, you can get the value of the seventh column of each row and set a [data attribute](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes) i.e. `data-has-link`. You can declare styles for rows i.e. `<td>` with a particular data attribute. This is much easier to work with than abusing classes. ``` $(function() { var $table = $('table'); $table.find('#current_date').text(getCurrentDate()); colorRows($table); // Color the rows! }); function getCurrentDate () { return new Date().toLocaleDateString('en-GB', { year: 'numeric', month: 'numeric', day: 'numeric' }); } function colorRows($table) { var hasLink; $table.find('tbody > tr').each(function(rowIndex) { const $row = $(this); $row.find('td').each(function(colIndex) { const $cell = $(this).removeAttr('data-has-link'); const cellValue = $cell.text().trim(); if (isFinite(cellValue)) { // Color cell based on individual data const hasLink = cellHasLink(parseInt(cellValue, 10)); if (hasLink !== 'maybe') { $cell.attr('data-has-link', hasLink); } } }); // Color row based on 7th column var i = parseInt($row.find('td:nth-child(7)').text(), 10); $row.attr('data-has-link', cellHasLink(i)); }); } function cellHasLink(value) { switch (value) { case 0 : return 'no'; case 1 : return 'yes'; default : return 'maybe'; } } ``` ``` table { width: 20em; border-collapse: collapse; } th { border-bottom: 2px solid #000; padding: 0.5em 0 0.1em 0; font-size: 1.2em; } td { border-bottom: 2px solid #ccc; padding: 0.5em 0 0.1em 0; } th:nth-child(n + 2), td:nth-child(n + 2) { text-align: center; } [data-has-link="no"] { background-color: #F77; } [data-has-link="yes"] { background-color: #7F7; } [data-has-link="maybe"] { background-color: #FD7; } #score, #name { width: 50%; } ``` ``` <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <table style="width: 100%; height:50%" border="1" cellpadding="3"> <caption>AV.31.U</caption> <thead> <tr> <td><div id="current_date"></div></td> <td colspan="6">Home</td> <td>&nbsp;</td> </tr> <tr> <th>Project</th> <th>Machine</th> <th>te</th> <th>Video Link</th> <th>te</th> <th>File Link</th> <th>te</th> <th>Draw Link</th> </tr> </thead> <tbody> <tr> <td>22005</td> <td>22003652</td> <td><a href="#">Link</a></td> <td><a href="#">Open</a></td> <td><a href="#">Open</a></td> <td>0</td> <td>0</td> <td>1</td> </tr> <tr> <td>22012</td> <td>22003652</td> <td><a href="#">Link</a></td> <td><a href="#">Open</a></td> <td><a href="#">Open</a></td> <td>1</td> <td>1</td> <td>1</td> </tr> <tr> <td>22012</td> <td>22003652</td> <td><a href="#">Link</a></td> <td><a href="#">Open</a></td> <td><a href="#">Open</a></td> <td>1</td> <td>3</td> <td>1</td> </tr> </tbody> </table> ``` --- ## Modifying existing PHP Modify your PHP to wrap the table header and body appropriately. ``` <table style="width: 100%; height:50%" border="1" cellpadding="3"> <caption>AV.31.U</caption> <thead> <tr> <td><div id="current_date"> <script> date = new Date(); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); document.getElementById("current_date").innerHTML = day + "/" + month + "/" + year; </script></td> <td colspan="6">Home</td> <td>&nbsp;</td> </tr> <tr> <th>Проект</th> <th>Машина</th> <th>te</th> <th>video_link</th> <th>te</th> <th>files_link</th> <th>te</th> <th>draw_link</th> </tr> </thead> <tbody> <?php $username = 'censored'; $password = 'censored'; $servername = 'censored'; $database = 'censored'; ini_set('display_errors', '1'); error_reporting(E_ALL); $db = odbc_connect("Driver={SQL Server};Server=$servername;Database=$database;", $username, $password) or die ("could not connect<br />"); $stmt = "Select * from machine"; $result = odbc_exec($db, $stmt); if ($result == FALSE) die ("could not execute statement $stmt<br />"); while (odbc_fetch_row($result)) // while there are rows { print "<tr>\n"; print " <td>" . odbc_result($result, "project_ID") . "\n"; print " <td>" . odbc_result($result, "machine_project_ID") . "\n"; print " <td>" . odbc_result($result, "video_link") . "\n"; print " <td>" . odbc_result($result, "files_link") . "\n"; print " <td>" . odbc_result($result, "draw_link") . "\n"; print " <td>" . odbc_result($result, 'has_draw') . "\n"; print " <td>" . odbc_result($result, "has_video") . "\n"; print " <td>" . odbc_result($result, "has_files") . "\n"; print "</tr>\n"; } odbc_free_result($result); odbc_close($db); ?> </tbody> </table> ```
null
CC BY-SA 4.0
null
2022-10-05T13:09:55.450
2022-10-06T12:06:24.757
2022-10-06T12:06:24.757
1,762,224
1,762,224
null
73,961,716
2
null
73,961,527
0
null
According to what you did, you have set the LocalStorage Item as a "string". You cant Parse a String with JSON.parse. You have to use JSON.stringify() since this method converts a JavaScript value to a JSON string. Here is the Link for JSON.stringify() : [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
null
CC BY-SA 4.0
null
2022-10-05T14:14:06.430
2022-10-05T14:14:06.430
null
null
19,738,746
null
73,962,065
2
null
73,961,527
0
null
According to 's comment, with `JSON.parse()` you can parse only JSON (the string that can be parsed as a JSON). But the value `localStorage.getItem("user")` isn't JSON. Just use `localStorage.getItem("user") || null`.
null
CC BY-SA 4.0
null
2022-10-05T14:37:35.957
2022-10-05T14:37:35.957
null
null
17,652,912
null
73,962,189
2
null
73,764,258
0
null
Image: ![finite-state machine graph made by graphviz](https://i.stack.imgur.com/MoCqa.jpg) Script: ``` digraph { ranksep=1; nodesep=0.5; node [shape=circle] Start [margin=0 width=0 shape=plaintext] q0 [shape = doublecircle label=<<I>q</I><SUB>0</SUB>>] q1 [label=<<I>q</I><SUB>1</SUB>>] q2 [label=<<I>q</I><SUB>2</SUB>>] q3 [label=<<I>q</I><SUB>3</SUB>>] Start -> q0 q1 -> q0 [xlabel="1"] q0 -> q1 [xlabel="0"] q1 -> q3 [label=" 0"] q3:se -> q3:e [label=" 0,1"] q2 -> q0 [xlabel="0 "] q0 -> q2 [xlabel="1 "] q2 -> q3 [label="1"] {rank=same; Start; q0; q1} {rank=same; q2; q3} } ``` Answer's sources: [how group attribute works](https://forum.graphviz.org/t/how-to-align-nodes-using-a-group-attribute/1317/3), [solution](https://forum.graphviz.org/t/how-to-align-nodes-using-a-group-attribute/1317/4) P.S. I think I can get a nice curve `q3->q3` using the `neato` engine with [pos](https://graphviz.org/docs/attrs/pos/) node attribute for positioning nodes and [pos](https://stackoverflow.com/questions/70378702/how-to-draw-a-spline-curve-between-2-points-with-a-control-points-with-graphviz) edge attribute for spline control points. Solution still in work.
null
CC BY-SA 4.0
null
2022-10-05T14:46:27.387
2022-10-11T17:57:57.943
2022-10-11T17:57:57.943
14,928,633
14,928,633
null
73,962,205
2
null
73,961,527
0
null
Simply you can do if you don't want to change your data storing type in `localStorage` ``` .. initialState : { user: JSON.parse(JSON.stringify(localStorage.getItem("user"))) || null, // or user: localStorage.getItem('user') || null, // both of them correct isError: false, isSuccess: false, isLoading: false, message: '' }, .. ``` `user: localStorage.getItem('user') || null` --- `localStorage`: ``` // storing in obj. const user = { token: <access_token> }; .. // stringifying for storage localStorage.setItem('user',JSON.stringify(user)); .. // parsing for access user: JSON.parse(localStorage.getItem("user")) ```
null
CC BY-SA 4.0
null
2022-10-05T14:47:15.233
2022-10-05T14:59:50.850
2022-10-05T14:59:50.850
5,228,912
5,228,912
null
73,962,317
2
null
62,638,730
1
null
``` SELECT d.column1,b.value as Label FROM Data d CROSS APPLY string_split(cast(d.column1 as varchar(max)),',')b SELECT d.column2,c.value as Value FROM Data d CROSS APPLY string_split(cast(d.column2 as varchar(max)),',')c ``` Try this approach
null
CC BY-SA 4.0
null
2022-10-05T14:55:07.933
2022-10-05T14:55:07.933
null
null
20,167,295
null
73,962,585
2
null
51,244,824
0
null
In my case, this file was corrupt. ``` C:\Users\[your_name]\AppData\Roaming\NetBeans\12.0\config\Preferences\org\netbeans\modules\maven\externalOwners.properties ``` I deleted it and recreated it as an empty file. This fixed the problem.
null
CC BY-SA 4.0
null
2022-10-05T15:14:58.743
2022-10-11T05:51:27.257
2022-10-11T05:51:27.257
2,963,422
5,144,924
null
73,962,762
2
null
23,926,617
0
null
For people now, the best way to do something like this in RStudio if it's not already built in is to add a "snippet": [https://appsilon.com/rstudio-shortcuts-and-tips/#custom-snippets](https://appsilon.com/rstudio-shortcuts-and-tips/#custom-snippets) It's in your global options and can be used to save pieces of code you often repeat to quickly insert it. [](https://i.stack.imgur.com/lw1QV.png)
null
CC BY-SA 4.0
null
2022-10-05T15:28:20.063
2022-10-05T15:28:20.063
null
null
5,191,451
null
73,963,188
2
null
73,962,134
1
null
You can use symbolic indices with a matrix but you need to use double indices: ``` In [2]: from sympy import symbols, Matrix, Sum ...: ...: n = symbols('n', integer=True, nonnegative=True) ...: expr = n**3 + 2 * n**2 + 3 * n # f(n) ...: matrix = Matrix([1, 234, 56, 7, 890]) # A_n ...: ...: result = Sum(matrix[n, 0] * expr, (n, 0, 4)) In [3]: result Out[3]: 4 _______ ╲ ╲ ╲ ⎛⎡ 1 ⎤⎞ ╲ ⎜⎢ ⎥⎟ ╲ ⎜⎢234⎥⎟ ╲ ⎛ 3 2 ⎞ ⎜⎢ ⎥⎟ ╱ ⎝n + 2⋅n + 3⋅n⎠⋅⎜⎢56 ⎥⎟[n, 0] ╱ ⎜⎢ ⎥⎟ ╱ ⎜⎢ 7 ⎥⎟ ╱ ⎜⎢ ⎥⎟ ╱ ⎝⎣890⎦⎠ ╱ ‾‾‾‾‾‾‾ n = 0 In [4]: result.doit() Out[4]: 99134 ```
null
CC BY-SA 4.0
null
2022-10-05T16:01:35.337
2022-10-05T16:01:35.337
null
null
9,450,991
null
73,963,374
2
null
12,711,899
0
null
In your root Window xaml, change the Title property of the Window.
null
CC BY-SA 4.0
null
2022-10-05T16:16:33.750
2022-10-05T16:16:33.750
null
null
6,950,881
null
73,963,839
2
null
57,409,646
0
null
See the latest ["Self-Service Password Reset" policy (custom or non-custom)](https://learn.microsoft.com/en-us/azure/active-directory-b2c/add-password-reset-policy?pivots=b2c-custom-policy#self-service-password-reset-recommended) from Microsoft docs. From the doc: "The new password reset experience is now part of the sign-up or sign-in policy. When the user selects the Forgot your password? link, they are immediately sent to the Forgot Password experience. Your application no longer needs to handle the AADB2C90118 error code, and you don't need a separate policy for password reset."
null
CC BY-SA 4.0
null
2022-10-05T16:57:44.230
2022-10-05T16:57:44.230
null
null
3,727,914
null
73,963,867
2
null
73,963,626
1
null
Most test frameworks require the test cases to use compile-time constants as parameters. ``` [DataTestMethod] [DataRow(1, 1, 2)] [DataRow(2, 2, 4)] [DataRow(3, 3, 6)] public void AddTest1(int x, int y, int expected) { Assert.AreEqual(expected, x + y); } ``` ``` [DataTestMethod] [DataRow(new int[] { 1, 2, 3, 4 }, new int[] { 1, 3, 6, 10 })] [DataRow(new int[] { 1, 1, 1, 1, 1 }, new int[] { 1, 2, 3, 4, 5 })] [DataRow(new int[] { 3, 1, 2, 10, 1 }, new int[] { 3, 4, 6, 16, 17 })] public void AddTest2(int[] input, int[] expectedOutput) { Assert.AreEqual(input[0], expectedOutput[0]); } ``` The `new` keyword with an array doesn't allow the test framework to differentiate (looking at the image you linked, it just says ). ``` [DataTestMethod] [DataRow(0, new int[] { 1, 2, 3, 4 }, new int[] { 1, 3, 6, 10 })] [DataRow(1, new int[] { 1, 1, 1, 1, 1 }, new int[] { 1, 2, 3, 4, 5 })] [DataRow(2, new int[] { 3, 1, 2, 10, 1 }, new int[] { 3, 4, 6, 16, 17 })] public void AddTest2(int run, int[] input, int[] expectedOutput) { Assert.AreEqual(input[0], expectedOutput[0]); } ``` That way, the different test cases can be differentiated by a compile-time constant.
null
CC BY-SA 4.0
null
2022-10-05T16:59:50.560
2022-10-05T17:15:33.053
2022-10-05T17:15:33.053
4,308,455
4,308,455
null
73,964,117
2
null
73,959,181
1
null
You misinterpreted the formula. `N` in the formula specifies the total number of the pixels in the image. The overlined letters means the average channel value over the image. These variable should be the type of `double`. I called them `redAverage`, `greenAverage` and `blueAverage`, respectively. And as you already know, `Avg` is the average of these variables. Finally, `R'`, `G'`, `B'` are the new channel values calculated using the old values. ``` using System.Drawing.Imaging; namespace Convert2Gray { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private Bitmap m_inputImage; private Bitmap m_outputImage; private void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); m_inputImage = (Bitmap)Image.FromFile("sample.png"); m_outputImage = new Bitmap(m_inputImage.Width, m_inputImage.Height, m_inputImage.PixelFormat); pictureBox1.Image = m_inputImage; pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; DoConversion(); pictureBox2.Image = m_outputImage; pictureBox2.SizeMode = PictureBoxSizeMode.AutoSize; } private unsafe void DoConversion() { BitmapData inputBitmapData = m_inputImage.LockBits(new Rectangle(0, 0, m_inputImage.Width, m_inputImage.Height), ImageLockMode.ReadWrite, m_inputImage.PixelFormat); BitmapData outputBitmapData = m_outputImage.LockBits(new Rectangle(0, 0, m_outputImage.Width, m_outputImage.Height), ImageLockMode.ReadWrite, m_outputImage.PixelFormat); byte* inputScan0 = (byte*)inputBitmapData.Scan0; byte* outputScan0 = (byte*)outputBitmapData.Scan0; int inputStride = inputBitmapData.Stride; int outputStride = outputBitmapData.Stride; int bytesPerPixel = Image.GetPixelFormatSize(m_inputImage.PixelFormat) / 8; double redAverage = 0.0; double greenAverage = 0.0; double blueAverage = 0.0; double average = 0.0; int pixelCount = m_inputImage.Width * m_inputImage.Height; for (int y = 0; y < m_inputImage.Height; y++) { byte* inputCurrentRow = inputScan0 + y * inputStride; byte* outputCurrentRow = outputScan0 + y * outputStride; for (int x = 0; x < m_inputImage.Width; x++) { ColorBgr* inputColor = (ColorBgr*)(inputCurrentRow + x * bytesPerPixel); redAverage += inputColor->R; greenAverage += inputColor->G; blueAverage += inputColor->B; } } redAverage /= pixelCount; greenAverage /= pixelCount; blueAverage /= pixelCount; average = (redAverage + greenAverage + blueAverage) / 3; for (int y = 0; y < m_inputImage.Height; y++) { byte* inputCurrentRow = inputScan0 + y * inputStride; byte* outputCurrentRow = outputScan0 + y * outputStride; for (int x = 0; x < m_inputImage.Width; x++) { ColorBgr* inputColor = (ColorBgr*)(inputCurrentRow + x * bytesPerPixel); ColorBgr* outputColor = (ColorBgr*)(outputCurrentRow + x * bytesPerPixel); outputColor->R = (byte)(inputColor->R * average / redAverage); outputColor->G = (byte)(inputColor->G * average / greenAverage); outputColor->B = (byte)(inputColor->B * average / blueAverage); } } m_inputImage.UnlockBits(inputBitmapData); m_outputImage.UnlockBits(outputBitmapData); } private struct ColorBgr : IEquatable<ColorBgr> { public byte B; public byte G; public byte R; public ColorBgr(byte b, byte g, byte r) { B = b; G = g; R = r; } public static bool operator ==(ColorBgr left, ColorBgr right) { return left.Equals(right); } public static bool operator !=(ColorBgr left, ColorBgr right) { return !(left == right); } public bool Equals(ColorBgr other) { return this.B == other.B && this.G == other.G && this.R == other.R; } public override bool Equals(object? obj) { if (obj is ColorBgr) return Equals((ColorBgr)obj); return false; } public override int GetHashCode() { return new byte[] { B, G, R }.GetHashCode(); } } } } ``` [](https://i.stack.imgur.com/EX3Gq.jpg)
null
CC BY-SA 4.0
null
2022-10-05T17:23:20.157
2022-10-05T17:23:20.157
null
null
7,141,410
null
73,964,288
2
null
73,963,745
1
null
You'd have to use the `marker` keyword argument, which is poorly documented. Here is how: ``` plot( ekpr.rewrite(Add), (x, -5, 7), markers=[{ "args": [sol, [0]], # coordinates of the point "marker": "o" # the type of marker to use }] ) ``` [](https://i.stack.imgur.com/6HlTq.png)
null
CC BY-SA 4.0
null
2022-10-05T17:39:29.150
2022-10-05T17:39:29.150
null
null
2,329,968
null
73,964,785
2
null
20,862,695
0
null
Load a set of images into a list, set the [set_colorkey](https://www.pygame.org/docs/ref/surface.html#pygame.Surface.set_colorkey) with the background color of the images and set an alpha channel with [set_alpha](https://www.pygame.org/docs/ref/surface.html#pygame.Surface.set_alpha): ``` images = [image1, image2, image3] for image in images: image.set_colorkey("white") image.set_alpha(10) ``` Blend ([blit](https://www.pygame.org/docs/ref/surface.html#pygame.Surface.blit)) an image multiple times in the window in successive frames. This creates a fade-in effect. Repeat this with one image after the other: ``` window.fill("white") count = 0 run = True while run: clock.tick(20) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False index = count // 26 count += 1 if index < len(images): if count % 26 == 25: images[index].set_alpha(255) window.blit(images[index], (0, 0)) pygame.display.flip() ``` --- Minimal example [](https://i.stack.imgur.com/odiIG.gif) ``` import pygame, math pygame.init() window = pygame.display.set_mode((400, 400)) clock = pygame.time.Clock() image1 = pygame.Surface((400, 400)) image1.fill("white") pygame.draw.circle(image1, "black", (200, 100), 50, 5) image2 = pygame.Surface((400, 400)) image2.fill("white") pygame.draw.line(image2, "black", (200, 150), (200, 230), 5) pygame.draw.line(image2, "black", (200, 180), (120, 140), 5) pygame.draw.line(image2, "black", (200, 180), (280, 140), 5) pygame.draw.line(image2, "black", (200, 230), (170, 300), 5) pygame.draw.line(image2, "black", (200, 230), (230, 300), 5) image3 = pygame.Surface((400, 400)) image3.fill("white") pygame.draw.circle(image3, "black", (180, 85), 10, 5) pygame.draw.circle(image3, "black", (220, 85), 10, 5) pygame.draw.line(image3, "black", (200, 95), (200, 115), 5) pygame.draw.arc(image3, "black", (180, 100, 40, 30), math.pi, 0, 5) images = [image1, image2, image3] for image in images: image.set_colorkey("white") image.set_alpha(10) window.fill("white") count = 0 run = True while run: clock.tick(20) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False index = count // 26 count += 1 if index < len(images): if count % 26 == 25: images[index].set_alpha(255) window.blit(images[index], (0, 0)) pygame.display.flip() pygame.quit() exit() ```
null
CC BY-SA 4.0
null
2022-10-05T18:28:15.487
2022-10-05T18:28:15.487
null
null
5,577,765
null
73,964,888
2
null
73,956,027
0
null
You need to set de `Advanced Options` params to the `MailApp.send();` For example ``` MailApp.send({ to: currentEmail, subject: subjectLine, htmlBody: `<p>Clic <a href="${urlLink}" target="_blank">here</a> for details</p>` // This htmlBody param makes an HTML link in Mail Body. }); ``` To see the full list of Advanced Options visit [https://developers.google.com/apps-script/reference/mail/mail-app#advanced-parameters_1](https://developers.google.com/apps-script/reference/mail/mail-app#advanced-parameters_1)
null
CC BY-SA 4.0
null
2022-10-05T18:36:30.590
2022-10-05T18:36:30.590
null
null
14,202,889
null
73,964,902
2
null
73,963,377
2
null
You can find convex hull with `cv2.convexHull` and draw it with `cv2.fillConvexPoly`. Before: [](https://i.stack.imgur.com/04E9f.png) After: [](https://i.stack.imgur.com/Bt8S4.png) Code: ``` import cv2 import numpy as np image = np.ones((500, 500, 3), np.uint8) * 255 coordinates = np.array([[60, 150], [80, 90], [140, 175], [160, 80], [200, 140]], int) * 2 # cv2.drawContours(image, [coordinates], -1, color=(255, 0, 255), thickness=cv2.FILLED) for pt in coordinates: cv2.circle(image, pt, 5, color=(255, 0, 0)) hull = cv2.convexHull(coordinates) cv2.fillConvexPoly(image, hull, (255, 0, 255)) ```
null
CC BY-SA 4.0
null
2022-10-05T18:37:26.217
2022-10-05T18:37:26.217
null
null
19,918,310
null
73,964,970
2
null
33,851,416
1
null
Please make sure you have given permission to directory "/opt/solr" with solr user, if not use command ``` sudo chown -R solr:solr <directory_name> ``` and then logged in through solr user: ``` sudo su - solr ``` go into bin folder and start the solr again if already started stop the solr or kill solr process ``` ./solr start ``` now finally create new core using below command: ``` ./solr create -c <core_name> ```
null
CC BY-SA 4.0
null
2022-10-05T18:42:43.413
2023-01-17T05:44:54.923
2023-01-17T05:44:54.923
3,526,168
3,526,168
null
73,965,078
2
null
21,906,325
0
null
Clicking on 'ignore updates' and rerunning `Check for updates` for a couple of times did the trick for me.
null
CC BY-SA 4.0
null
2022-10-05T18:55:00.140
2022-10-05T18:55:00.140
null
null
10,058,539
null
73,965,161
2
null
73,964,225
0
null
Here is an example. `theme_void()` makes the gridlines disappear (along with the majority of plot items). However, we can manually edit the `theme()` if we place the function after `theme_void()`. ``` library(tidyverse) ggplot(mtcars,aes(mpg,hp)) + geom_point() + theme_void() + theme(panel.grid.major.y = element_line(), panel.grid.minor.y = element_line()) ``` ![](https://i.imgur.com/4CLlNcy.png) [reprex package](https://reprex.tidyverse.org)
null
CC BY-SA 4.0
null
2022-10-05T19:01:48.560
2022-10-05T19:01:48.560
null
null
10,556,787
null
73,965,231
2
null
14,816,607
0
null
The standard ODBC selection dialog is a bit different than the one from the OP screenshot. The screenshot is the ODBC configuration dialog. I think that the one the OP is after is the one that for example MS Access shows when linking/importing data which lacks many of the tabs from the screenshot. However it seems the standard for Windows ODBC selection as it is provided by the MS ODBC API. In order to show it one has to call [SQLDriverConnect](https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqldriverconnect-function?view=sql-server-ver16) providing a windows handle, an empty InConnectionString and the SQL_DRIVER_COMPLETE for the DriverCompletion parameter. Upon successful call the OutConnectionString parameter will be filled accordingly. If the dialog is cancelled by the user, then the result from the call will be SQL_NO_DATA. PS. MS Access calls the function with a BufferLength parameter of 513 characters.
null
CC BY-SA 4.0
null
2022-10-05T19:07:22.990
2022-10-05T19:07:22.990
null
null
3,998,190
null
73,965,412
2
null
73,078,858
0
null
You can't enter multiple files in the UI. You point it to one text file in cloud storage, and that file should contain the paths of all the images you want to run predictions on. Here is [the file format](https://cloud.google.com/vertex-ai/docs/image-data/classification/get-predictions#input_data_requirements).
null
CC BY-SA 4.0
null
2022-10-05T19:26:28.547
2022-10-05T19:26:28.547
null
null
8,042,691
null
73,965,453
2
null
73,965,356
0
null
This is a GitHub internal error ([500 Error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500)) and is not fixable by any action of your own. Either wait and try again later, or reach out to GitHub Support as the error says.
null
CC BY-SA 4.0
null
2022-10-05T19:30:15.040
2022-10-05T19:30:15.040
null
null
628,859
null
73,965,845
2
null
28,699,342
0
null
For anyone who stumbles on this, use something like this - which gives you a rounded column of which standard deviation based on some other column's values: ``` # get percentile and which standard deviation for daily decline pct change def which_std_dev(row,df,col): std_1 = round(df[col].mean() + 1 * df[col].std(),0) std_2 = round(df[col].mean() + 2 * df[col].std(),0) std_3 = round(df[col].mean() + 3 * df[col].std(),0) std_4 = round(df[col].mean() + 4 * df[col].std(),0) std_5 = round(df[col].mean() + 5 * df[col].std(),0) std_6 = round(df[col].mean() + 6 * df[col].std(),0) std_7 = round(df[col].mean() + 7 * df[col].std(),0) std_8 = round(df[col].mean() + 8 * df[col].std(),0) std_9 = round(df[col].mean() + 9 * df[col].std(),0) std_10 = round(df[col].mean() + 10 * df[col].std(),0) if row[col] <= std_1: return 1 elif row[col] > std_1 and row[col] < std_2: return 2 elif row[col] >= std_2 and row[col] < std_3: return 3 elif row[col] >= std_3 and row[col] < std_4: return 4 elif row[col] >= std_4 and row[col] < std_5: return 5 elif row[col] >= std_6 and row[col] < std_6: return 6 elif row[col] >= std_7 and row[col] < std_7: return 7 elif row[col] >= std_8 and row[col] < std_8: return 8 elif row[col] >= std_9 and row[col] < std_9: return 9 else: return 10 df_day['percentile'] = round(df_day['daily_decline_pct_change'].rank(pct=True),3) df_day['which_std_dev'] = df_day.apply(lambda row: which_std_dev(row,df_day,'daily_decline_pct_change'), axis = 1) ```
null
CC BY-SA 4.0
null
2022-10-05T20:12:35.803
2022-10-05T20:12:35.803
null
null
9,392,446
null
73,966,237
2
null
73,966,133
0
null
you can add `NeverScrollableScrollPhysics` to achieve this. ``` ... CustomScrollView( controller: _scrollController, physics: NeverScrollableScrollPhysics(), .. ``` more information at [flutter docs](https://api.flutter.dev/flutter/widgets/NeverScrollableScrollPhysics-class.html)
null
CC BY-SA 4.0
null
2022-10-05T20:53:48.863
2022-10-05T20:53:48.863
null
null
12,186,851
null
73,966,551
2
null
60,160,453
0
null
# The git command git add -A ./** saved my life. Until using this command nothing was working. I also renamed my current directory, went through and removed every single already present `.git` directory throughout, including the project root and all sub-directories. Added a very new and thorough .gitignore to the project root, and deleted the old remote repository that was previously started but wouldn't finish properly, all of which finally allowed me to start completely over with a brand new clean slate. The only trade-off I made (which was more of a personal choice than a trade-off really, anywho...) was for each sub-directory that already contained a `.git` folder, I could have included those directories as git sub-modules instead of completely deleting those `.git` directories, which is really the more ideal or proper way of doing it. This was a personal decision, but most likely you will want to make sure to include them as sub-modules rather than deleting them, this way it will allow you to keep not only those repositories commit histories, but also continue to fetch future upstream changes and merge them back into your working directory, so just quick fyi and word of caution here. If you delete them as I did, you will lose all of that, which is probably not what most would want to do I think, so just fyi here!! - Hope that helps somebody!! # Per the git man pages for git add > `-A` short for `--all` "Updates the index not only where the working tree has a file matching `<pathspec>` but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree.If no `<pathspec>` is given when -A option is used, all files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories)." # Furthermore if you look in their glossary under "glob" you will find usage for a double asterisks like so: > "A trailing `/**` matches everything inside. For example, `abc/**` matches all files inside directory `abc`, relative to the location of the `.gitignore` file, with ."
null
CC BY-SA 4.0
null
2022-10-05T21:33:22.833
2022-10-05T21:35:22.150
2022-10-05T21:35:22.150
18,957,259
18,957,259
null
73,966,806
2
null
26,902,867
0
null
If anyone ever does what I did maybe this will help: Android Studio does not like it when module names begin with a number. I was learning from some tutorials and named the first module "1-name" and the next one "2-name". Setup was fine and it ran, but only the "Gradle" Scripts entry would show in the navigation window in "Android" mode.
null
CC BY-SA 4.0
null
2022-10-05T22:12:22.543
2022-10-05T22:12:22.543
null
null
1,866,373
null
73,966,883
2
null
73,918,948
0
null
No M1 issue. In line ``` pg.background(155); ``` You set a background at `z=0`, your torus kind of goes 'behind' it. use: ``` pg.clear() ``` instead.
null
CC BY-SA 4.0
null
2022-10-05T22:23:24.967
2022-10-10T21:16:19.270
2022-10-10T21:16:19.270
1,690,199
1,690,199
null
73,966,859
2
null
73,952,555
0
null
: this problem requires a lot of computation (an unsimplified solution implies analyzing 2^wallet.length combinations of wallet coins). Using large wallets for tests might result in large run times or even . That is not the case for the default example included in the snippet below, which runs typically in just a few hundredth of a second. There are several optimizations still to be performed, the most obvious one being simplifying the data structures used in code. I decided to stick for this first version to the original format, that results in the need to deep-clone objects that could be avoided. ``` // utility functions const cloneSelection = wallet => wallet?.map(o => ({...o})); const cloneSolution = solution => ({selection: cloneSelection(solution.selection), diff: solution.diff}); const generateUniqueId = function(selection, payAmount){ const a = selection.map(o=>o.denomination); let nr = 0, nv = -1, uniqueId = ''; a.forEach( function(ai, i){ if(ai === nv){ nr++; } else{ if(nv > 0){ uniqueId += (uniqueId ? '+' : '') + nr + 'x' + nv; } nv = ai; nr = 1; } } ); return uniqueId + (uniqueId ? '+' : '') + nr + 'x' + nv + '=' + payAmount; } const memoizationData = {}; const selectAmount = function(payAmount, wallet){ const uniqueId = generateUniqueId(wallet, payAmount); let solution = memoizationData[uniqueId]; if(solution){ return cloneSolution(solution); } if(wallet.length === 1){ const diff = wallet[0].denomination - payAmount; return diff >= 0 ? {selection: cloneSelection(wallet), diff} : {selection: null, diff: 1/0}; } const diff = wallet.reduce((s, o) => s + o.denomination, 0) - payAmount; if(diff < 0){ solution = {selection: null, diff: 1/0}; // "non-solution" } else{ solution = {selection: wallet, diff}; for(let iOut = 0; iOut < wallet.length; iOut++){ if(solution.diff < 1e-3){ break; } const wallet1 = cloneSelection(wallet); wallet1.splice(iOut, 1); // extract i-th "coin" from the wallet const solution1 = selectAmount(payAmount, wallet1); if(solution1.diff < solution.diff){ solution = solution1; } } } memoizationData[uniqueId] = cloneSolution(solution); return solution; } const aed = 'aed'; const walletArray = [ { code: aed, denomination: 0.5, image: "/assets/images/coin50", type: "coin" }, { code: aed, denomination: 0.5, image: "/assets/images/coin50", type: "coin" }, { code: aed, denomination: 0.5, image: "/assets/images/coin50", type: "coin" }, { code: aed, denomination: 1, image: "/assets/images/coin1", type: "coin" }, { code: aed, denomination: 1, image: "/assets/images/coin1", type: "coin" }, { code: aed, denomination: 1, image: "/assets/images/coin1", type: "coin" }, { code: aed, denomination: 2, image: "/assets/images/coin2", type: "coin" }, { code: aed, denomination: 5, image: "/assets/images/bill5", type: "bill" }, { code: aed, denomination: 5, image: "/assets/images/bill5", type: "bill" }, { code: aed, denomination: 5, image: "/assets/images/bill5", type: "bill" }, { code: aed, denomination: 10, image: "/assets/images/bill10", type: "bill" }, { code: aed, denomination: 50, image: "/assets/images/bill50", type: "bill" }, ]; // if not sorted walletArray.sort((o1, o2)=>o1.denomination - o2.denomination); const t0 = Date.now(); const ret = selectAmount(16.5, walletArray); const dt = (Date.now() - t0)/1000; console.log('solution = ', ret); console.log(`dt = ${dt.toFixed(2)}s`); ``` ### Description of the algorithm We start with a wallet , which is a set of coins , , ..., , and a pay amount : problem P(, ). The solution to the problem is a selection of the coins in the wallet, a subset of . A non-solution (that is there are not enough funds to cover the amount) is denoted by a void selection. The solution is recursive. #### Start solution The default solution for P(, ) is (the selection is the whole wallet) if the sum of coin values in the wallet is >=, or ∅ (non-solution) otherwise. #### Recursion For each coin , we build a new wallet = ∖ {}, that is we extract that coin from the and solve the problem P(, ) i.e., we try to find if there's a better selection of coins from the smaller wallet. The solution of P(, ) is the best one from the start solution and the partial wallet solutions. Obviously, a selection is better if the sum of its coin values minus is smaller (but positive). #### Bottom of recursion We can directly solve a problem (that is without dividing it) in three cases: - - - #### Memoization [Memoization](https://en.wikipedia.org/wiki/Memoization) is essential to reduce the run-time for this type of algorithms. It stores the results of previous evaluations of the main function, in order to avoid recomputing the same cases, very advantageous since the amount of overlaps close to the bottom of recursion is huge. I used memoization is a brute-force alternative to a [dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming) solution, that would make memoization unnecessary (or implicit).
null
CC BY-SA 4.0
null
2022-10-05T22:20:05.863
2022-10-07T07:32:37.180
2022-10-07T07:32:37.180
16,466,946
16,466,946
null
73,967,117
2
null
73,316,114
0
null
What I've been doing is keeping a separate "Date Time" sheet with =now() functions. So like this: ``` Date/Time Value Date =now() (Format the date to display however you like.) Time =now() (Format the time to display however you like.) ``` Then follow with two different Select a Spreadsheet Row steps for the date and time, selecting the row name to get the values. Then when you go to send out a message, you can select the two Value item variables to put out the date and time, which will correspond with your spreadsheet time. If you need to alter the time at all, you can subtract or add the amount of hours you need to the =now() function. Of course, you can just do one or the other or both. They'll go in as separate variables.
null
CC BY-SA 4.0
null
2022-10-05T23:00:49.367
2022-10-05T23:02:24.330
2022-10-05T23:02:24.330
20,170,995
20,170,995
null
73,967,535
2
null
56,238,534
1
null
Google's HTML templating language does not conform to proper HTML syntax, so VSCode will flag these scriptlets as errors when working in HTML mode. Fortunately, this template syntax is very similar to PHP, so changing your editor's language mode to PHP should remove most, if not all, errors.
null
CC BY-SA 4.0
null
2022-10-06T00:26:34.843
2022-10-06T00:52:16.307
2022-10-06T00:52:16.307
8,245,557
8,245,557
null
73,967,602
2
null
27,276,561
1
null
Swift 5.1 To Add: ``` let controller = storyboard?.instantiateViewController(withIdentifier: "MyViewControllerId") addChild(controller!) controller!.view.frame = self.containerView.bounds self.containerView.addSubview((controller?.view)!) controller?.didMove(toParent: self) ``` To remove: ``` self.containerView.subviews.forEach({$0.removeFromSuperview()}) ```
null
CC BY-SA 4.0
null
2022-10-06T00:41:21.907
2022-10-06T06:46:09.083
2022-10-06T06:46:09.083
7,855,724
7,855,724
null
73,967,831
2
null
73,967,371
0
null
Authentication of most API requests is straightforward - you attach an `Authorization` header with Oauth or JWT. This kind of auth is a simple fit for postman which has easy ways to pass Authorization headers. One obvious flaw is that the authentication token is a secret that is sent along with the request. That means anyone that can access the request, knows the secret as well as you do. AWS uses a different mechanism in which the secret is not attached to the payload. Instead, the secret is used to sign the request with HMAC. The secret isn't sent along with the payload, but anyone who already has the secret (AWS generated it in the first place) can verify that the payload was signed with the appropriate secret. In this scheme, intercepting a request payload does not divulge the secret necessary to authenticate novel requests. [This blog post](https://blog.knoldus.com/how-to-generate-aws-signature-with-postman/) describes how postman can be made to authenticate API requests with [amazon's Signature v4 method](https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html). It looks possible. My advice would be to stick to the AWS provided SDKs for one of your preferred languages. They offer high quality SDKs for python ("boto3" is a very common AWS go-to for crafting API requests), Ruby, Go, Java, JavaScript ... pretty much every language has one. The SDKs do a great job of representing the underlying AWS APIs, along with helping you manage error conditions, authentication, resolving endpoints for regions, pagination, etc.
null
CC BY-SA 4.0
null
2022-10-06T01:29:14.760
2022-10-22T12:33:24.550
2022-10-22T12:33:24.550
472,495
1,726,083
null
73,968,336
2
null
73,840,560
0
null
There is a known issue with React 18.x `strict mode` and older InstantSearch libraries. The resolution is to set `reactStrictMode: false` in `next.config.js` (not recommended), downgrade to React 17, or move to the newer `react-instantsearch-hooks` library as documented here: [https://github.com/algolia/react-instantsearch/issues/3634](https://github.com/algolia/react-instantsearch/issues/3634)
null
CC BY-SA 4.0
null
2022-10-06T03:13:30.797
2022-10-06T03:13:30.797
null
null
2,329,480
null
73,968,367
2
null
73,968,275
-1
null
I don't know if your language have this, but Java have something call . That might work for your language!
null
CC BY-SA 4.0
null
2022-10-06T03:21:52.107
2022-10-06T03:21:52.107
null
null
20,146,935
null
73,968,519
2
null
73,968,275
0
null
Postgres has `cast`, 2 versions. In this case you can: ``` (cast(total_deaths as numeric)/population.population)*100 OR (total_deaths::numeric/population.population)*100 ``` The first using the SQL standard and the second a Postgres extension.
null
CC BY-SA 4.0
null
2022-10-06T03:54:26.310
2022-10-06T03:54:26.310
null
null
7,623,856
null
73,968,577
2
null
7,491,603
0
null
I suggest using a stylesheet. From the code you can make it to a function: ``` void setFlatStyle(QPushButton *btn) { btn->setStyleSheet(QString("QPushButton {border: 0px;}")); } ``` Just pass the button in there and get your result.
null
CC BY-SA 4.0
null
2022-10-06T04:08:43.203
2022-10-06T04:08:43.203
null
null
16,446,105
null
73,968,762
2
null
72,329,965
1
null
React google login is using the old version of google which will be deprecated in March 31, 2023. Detail [here](https://developers.google.com/identity/sign-in/web/sign-in). Check the implementation [here](https://github.com/anthonyjgrove/react-google-login/blob/7db5b9686a70ded6b090a9c01906ca978b00a54d/src/use-google-login.js#L5) You can move to use the new library which support the newer version as comment above like [https://www.npmjs.com/package/@react-oauth/google](https://www.npmjs.com/package/@react-oauth/google). You can also implement by yourself: First you need to load script from google. Detail link: [https://developers.google.com/identity/gsi/web/guides/client-library](https://developers.google.com/identity/gsi/web/guides/client-library) Then you need to do some setup and render the google button: ``` export function GoogleLoginButton({ onSuccess, onError, type = 'standard', theme = 'outline', size = 'large', text, shape, logoAlignment, width, locale, ...props }: GoogleLoginProps): React.ReactElement { const [isOAuthClientLoaded, setIsOAuthClientLoaded] = React.useState(false); const btnContainerRef = useRef<HTMLDivElement>(null); const onSuccessRef = useRef(onSuccess); onSuccessRef.current = onSuccess; const onErrorRef = useRef(onError); onErrorRef.current = onError; useEffect(() => { const scriptTag = document.createElement('script'); scriptTag.src = 'https://accounts.google.com/gsi/client'; scriptTag.async = true; scriptTag.defer = true; scriptTag.onload = () => { setIsOAuthClientLoaded(true); }; scriptTag.onerror = () => { setIsOAuthClientLoaded(false); }; document.body.appendChild(scriptTag); return () => { document.body.removeChild(scriptTag); }; }, []); useEffect(() => { if (!isOAuthClientLoaded) { return; } window.google?.accounts.id.initialize({ client_id: clientId, callback: (credentialResponse: OAuthCredentialResponse): void => { if (!credentialResponse.clientId || !credentialResponse.credential) { onErrorRef.current?.( new Error('Client id is invalid when initializing') ); return; } onSuccessRef.current(credentialResponse); }, ...props }); window.google?.accounts.id.renderButton(btnContainerRef.current!, { type, theme, size, text, shape, logo_alignment: logoAlignment, width, locale }); }, [ onSuccess, onError, clientId, type, theme, size, text, shape, logoAlignment, width, locale, props, isOAuthClientLoaded ]); return <div ref={btnContainerRef} />; } ```
null
CC BY-SA 4.0
null
2022-10-06T04:46:05.740
2022-10-06T04:46:05.740
null
null
12,077,117
null
73,969,251
2
null
51,185,073
0
null
1. Just Go to Your build.gradle (android/app). 2. And remove the ` apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' 3. And re-run project and error will be resolved.`
null
CC BY-SA 4.0
null
2022-10-06T06:03:35.030
2022-10-06T06:03:35.030
null
null
18,640,432
null
73,969,424
2
null
73,968,275
0
null
``` cast((total_deaths/population.population)*100) as numeric ```
null
CC BY-SA 4.0
null
2022-10-06T06:26:22.847
2022-10-11T14:52:35.203
2022-10-11T14:52:35.203
14,015,737
16,460,538
null