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
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
74,754,052 | 2 | null | 61,883,819 | 1 | null | Since Material creates the dropdown list dynamically, so you will have to bind a custom click events to your paginator dropdown and add the class to the mat-option every time user opens the paginator dropdown (not anyother dropdown) something like this:
```
ngAfterViewInit(): void {
const dropdown = document.querySelector(
'.mat-paginator-container mat-select'
);
console.log('dropdown', dropdown);
dropdown.addEventListener('click', (evnt) => {
const list = document.querySelectorAll(
'.mat-select-panel-wrap .mat-option'
);
console.log('list', list);
list.forEach((element) => {
element.classList.add('paginator-option');
});
});
}
```
Also, use following component css inside the css file:
```
::ng-deep .mat-option.paginator-option {
color: aqua;
}
```
Demo: [stackbliz](https://stackblitz.com/edit/angular-9-material-mattable-crud-ggdb49?file=src/app/app.component.html)
| null | CC BY-SA 4.0 | null | 2022-12-10T15:04:25.177 | 2022-12-10T15:04:25.177 | null | null | 1,479,735 | null |
74,754,482 | 2 | null | 74,754,324 | 0 | null | According to your logs your `DATA.data` is not an array - it's an object.
That's why your for..of loops will not work that way.
Because object is not iterable.
```
for (const article of DATA.data) {
filteredNews = DATA.data.filter((item) => {
return item.posts.title === inputSearch.value;
});
}
```
That for loop will not work. More info on for..of [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of).
But there is also an option to iterate on object keys with for..in.
More info [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in).
Seems like you would like to get some property of your `DATA.data` object and do some logic with it.
For example, you can get your posts with `DATA.data.posts` and iterate on them.
| null | CC BY-SA 4.0 | null | 2022-12-10T16:02:46.777 | 2022-12-10T16:07:53.027 | 2022-12-10T16:07:53.027 | 9,272,947 | 9,272,947 | null |
74,754,596 | 2 | null | 71,711,390 | 0 | null | You can follow this Razorpay sample easily for Custom UI of razorpay. They updated the SDK recently. Check once.
[https://github.com/razorpay/razorpay-android-custom-sample-app](https://github.com/razorpay/razorpay-android-custom-sample-app)
[https://razorpay.com/docs/payments/payment-gateway/android-integration/custom/](https://razorpay.com/docs/payments/payment-gateway/android-integration/custom/)
| null | CC BY-SA 4.0 | null | 2022-12-10T16:16:41.100 | 2022-12-10T16:16:41.100 | null | null | 14,122,501 | null |
74,754,603 | 2 | null | 74,754,579 | -1 | null | I too have had the same problem. Have you ever tried resetting Windows?
| null | CC BY-SA 4.0 | null | 2022-12-10T16:17:43.340 | 2022-12-10T16:17:43.340 | null | null | 20,741,725 | null |
74,754,635 | 2 | null | 23,441,964 | 0 | null | I was facing the same problem. What worked for me is that after you have selected gdb in settings compiler and debugger menu, JUST CREATE A NEW PROJECT DO NOT CONTINUE WORKING ON THE CURRENT PROJECT debugging menu will be enabled.
| null | CC BY-SA 4.0 | null | 2022-12-10T16:21:41.633 | 2022-12-10T16:21:41.633 | null | null | 20,742,825 | null |
74,754,673 | 2 | null | 74,754,628 | -1 | null | Here's a basic example for you. You add the rowspan to the Tag and then on the subsequent rows, you have 1 less tag
```
table, tr, td { border:1px solid black; border-collapse: collapse }
```
```
<table>
<tr>
<td rowspan="2">Row Span 2</td>
<td>Normal Column</td>
</tr>
<tr>
<td>Normal Column</td>
</tr>
</table>
```
EDIT - Taking into account the fact that column B is 2.5 rows tall, and after review of the other answer, here is complete method, which uses both an extra table and rowspan
```
table, tr, td { border:1px solid black; border-collapse: collapse }
```
```
<html>
<body>
<table border=1 width=100% height=100%>
<tr>
<td rowspan="5">A</td>
<td rowspan="5" height=100%>
<table border=1 width=100% height="100%">
<tr>
<td>B1</td>
</tr>
<tr>
<td>B2</td>
</tr>
</table>
</td>
<td>C1</td>
</tr>
<tr>
<td>C2</td>
</tr>
<tr>
<td>C3</td>
</tr>
<tr>
<td>C4</td>
</tr>
<tr>
<td>C5</td>
</tr>
</table>
</body>
</html>
```
| null | CC BY-SA 4.0 | null | 2022-12-10T16:27:42.160 | 2022-12-10T17:07:45.433 | 2022-12-10T17:07:45.433 | 4,990,925 | 4,990,925 | null |
74,754,899 | 2 | null | 54,428,037 | 0 | null | when I was facing the same issue, I used "password" for root password, which is default for MySql.
| null | CC BY-SA 4.0 | null | 2022-12-10T16:59:26.473 | 2022-12-10T17:05:37.877 | 2022-12-10T17:05:37.877 | 17,182,992 | 17,182,992 | null |
74,755,138 | 2 | null | 74,754,420 | -1 | null | If I understand your question correctly, adding the following CSS should do what you are asking:
```
.radio-button:nth-child(1):not(:checked)~div.cube div.cube-side:nth-child(1) {
visibility: hidden;
}
.radio-button:nth-child(2):not(:checked)~div.cube div.cube-side:nth-child(2) {
visibility: hidden;
}
.radio-button:nth-child(3):not(:checked)~div.cube div.cube-side:nth-child(3) {
visibility: hidden;
}
.radio-button:nth-child(4):not(:checked)~div.cube div.cube-side:nth-child(4) {
visibility: hidden;
}
```
Please, let me know if this worked and if not.
| null | CC BY-SA 4.0 | null | 2022-12-10T17:31:15.203 | 2022-12-10T17:31:15.203 | null | null | 12,709,628 | null |
74,755,602 | 2 | null | 74,755,372 | 0 | null | You may use `geom_boxplot(position=position_dodge())` instead of `facet_wrap()` to place your boxplots by pair within group.
| null | CC BY-SA 4.0 | null | 2022-12-10T18:34:34.393 | 2022-12-10T18:34:34.393 | null | null | 12,109,702 | null |
74,755,661 | 2 | null | 74,747,259 | 0 | null | Unfortunately, it is not currently possible to create buttons in WhatsApp messages that open URLs, other than the pre-approved buttons available through the WhatsApp Business Manager.
Quick Reply buttons in WhatsApp are only able to send a pre-defined message to the recipient, and cannot be used to open URLs.
If you want to create buttons that open URLs in WhatsApp messages, you would need to use a different messaging platform or app that supports this feature. There are many such platforms available, and you can choose one that best fits your needs.
| null | CC BY-SA 4.0 | null | 2022-12-10T18:41:07.080 | 2022-12-10T18:41:07.080 | null | null | 20,743,446 | null |
74,755,761 | 2 | null | 5,420,656 | -1 | null | In my case I resolved this problem setting a correct API's url in my application.
It was an error connection between the application and API.
| null | CC BY-SA 4.0 | null | 2022-12-10T18:55:22.980 | 2022-12-10T18:55:22.980 | null | null | 15,256,506 | null |
74,756,449 | 2 | null | 74,756,355 | 1 | null | Setting an input value to empty string or null should definitely work.
- try setting a value to "" or null in vanila javascript`yourInput.value = null` or `yourInput.value = ""`- also check if you are setting those values to the right input
It would also be useful to know what browser you use.
| null | CC BY-SA 4.0 | null | 2022-12-10T20:51:13.293 | 2022-12-10T20:51:13.293 | null | null | 7,714,805 | null |
74,756,437 | 2 | null | 74,756,148 | 0 | null | on approach:
create example data - you forgot to provide some other than a screenshot ;-)
```
wholeblood_df <- structure(list(gene = c("ENSG0000123456", "ENSG0000123987"),
rsid = c("rs7470815", "rs3853288"), varID = c("foo", "baz"
), ref_allele = c("C", "T"), eff_allele = c("A", "G"), weight = c(0.001,
0.001)), class = "data.frame", row.names = 1:2)
braincortex_df <- structure(list(gene = c("ENSG0000123456", "ENSG0000123987"),
rsid = c("rs7470815", "rs3853288"), varID = c("ping", "pong"
), ref_allele = c("C", "T"), eff_allele = c("A", "G"), weight = c(NA,
0.009)), class = "data.frame", row.names = 1:2)
```
merging and reshaping with {tidyr} and {dplyr}:
```
library(dplyr)
library(tidyr)
## add a column indicating the data provenance for later ...
wholeblood_df$matrix = 'wholeblood'
braincortex_df$matrix = 'braincortex'
bind_rows( ## rowbind the required portions (columns) of both datasets:
braincortex_df |> select(matrix, gene, rsid, weight),
wholeblood_df |> select(matrix, gene, rsid, weight)
) |>
pivot_wider( ## juxtapose 'weight' of blood and brain:
names_from = matrix,
values_from = weight
) |>
## coalesce weight values = keep first non-NA value in a row
## 'brain' comes first, so weight will be taken from this column unless NA
mutate(braincortex = coalesce(braincortex, wholeblood)) |>
## re-pivot to long format:
pivot_longer(cols = c(braincortex, wholeblood),
names_to = 'matrix',
values_to = 'weight'
) |>
select(matrix, gene, rsid, weight) |>
pivot_wider(names_from = rsid,
values_from = weight
) |>
select(-matrix)
```
output:
```
# A tibble: 4 x 3
gene rs7470815 rs3853288
<chr> <dbl> <dbl>
1 ENSG0000123456 0.001 NA
2 ENSG0000123456 0.001 NA
3 ENSG0000123987 NA 0.009
4 ENSG0000123987 NA 0.001
```
| null | CC BY-SA 4.0 | null | 2022-12-10T20:49:07.197 | 2022-12-10T21:18:44.237 | 2022-12-10T21:18:44.237 | 20,513,099 | 20,513,099 | null |
74,756,580 | 2 | null | 74,754,579 | 0 | null | remove the script folder and try to open the project if it does open, then add script by script when it crashes you'll know where is the issue (this applies to files other than scripts)
| null | CC BY-SA 4.0 | null | 2022-12-10T21:17:15.043 | 2022-12-10T21:17:15.043 | null | null | 14,647,953 | null |
74,756,741 | 2 | null | 74,750,731 | 0 | null | The following snippet should work. Replace the `base_path` with your path.
```
import datetime
from dateutil.relativedelta import relativedelta
# Function to generate the last X months
def get_last_months(start_date, months):
for i in range(months):
yield (start_date.year,start_date.month)
start_date += relativedelta(months = -1)
rollback=3
months=[i for i in get_last_months(datetime.datetime.today(), rollback)]
# Create paths required
base_path = "{y}/{m}/filename"
paths=[]
for i in months:
paths.append(base_path.format(y=i[0],m=i[1])
df = spark.read.parquet(*paths)
```
The above snippet will help you in reading from multiple paths. The remaining logic is something you have to implement.
| null | CC BY-SA 4.0 | null | 2022-12-10T21:41:36.310 | 2022-12-10T21:41:36.310 | null | null | 6,686,613 | null |
74,756,958 | 2 | null | 59,663,668 | 0 | null | Based on [Equation of a line from 2 points](https://www.mathsisfun.com/algebra/line-equation-2points.html) the slope can be calcualted using
Slope m
```
m = (change in y) / (change in x)
m = (y2 − y1) / (x2 − x1)
m = (50 - 10) / (10 - 1)
m = 40 / 9 = 40/9
```
The "point-slope" form of the equation of a straight line is
```
y − y1 = m(x − x1) // we will use P1(1/10) with x1 = 1, y1 = 10
y - 10 = m(x - 1)
y = m(x - 1) + 10
```
Test the equation with P2 (10/50)
```
50 = m(10-1) + 10 // y = 50 and x = 10
40 = m(9)
40/9 = m
```
To get a function that represents the equation (y = f(x))
```
y = m(x - 1) + 10 // we know m = 40/9 and use f(x) instead of y
f(x) = 40/9(x - 1) + 10
f(x) = (40/9)x - 40/9 + 90/9
f(x) = (40/9)x + 90/9 - 40/9
f(x) = (40/9)x + 50/9
```
Create a matching function
```
Func<decimal, decimal> lineEquation = (x) =>{
return ((decimal)40/(decimal)9)*x + ((decimal)50/(decimal)9);
};
```
Test it in [linqpad](/questions/tagged/linqpad)
[](https://i.stack.imgur.com/FdoG0.png)
| null | CC BY-SA 4.0 | null | 2022-12-10T22:25:22.200 | 2022-12-10T22:25:22.200 | null | null | 819,887 | null |
74,757,151 | 2 | null | 73,664,780 | 0 | null | I am not 100% sure what the problem is, but I agree I had suddenly similar problem in VS2022, that Test Explorer was not showing any tests, but it found my tests. But not showing or executing the tests.
- - - - - - -
| null | CC BY-SA 4.0 | null | 2022-12-10T22:59:21.607 | 2022-12-15T14:00:00.770 | 2022-12-15T14:00:00.770 | 318,508 | 20,744,686 | null |
74,757,293 | 2 | null | 74,755,960 | 0 | null | No, Swing does not contain a native "tint" feature, but you can create one (with a bit of effort).
So, based on [Tinting Image in Java improvement](https://stackoverflow.com/questions/14225518/tinting-image-in-java-improvement/14225857#14225857), you can do something like this...
[](https://i.stack.imgur.com/qP20X.gif)
This example makes use of a `MouseListener` and will display the tinted image for 1 second, but you get the idea
```
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
JFrame frame = new JFrame();
frame.add(new TestPane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
public class TestPane extends JPanel {
private BufferedImage masterImage;
private BufferedImage paintImage;
private BufferedImage tintedImage;
public TestPane() throws IOException {
masterImage = ImageIO.read(getClass().getResource("/images/DVDLogo.png"));
paintImage = masterImage;
tintedImage = ImageUtils.generateMask(masterImage, Color.YELLOW, 1f);
addMouseListener(new MouseAdapter() {
private Timer timer = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
paintImage = masterImage;
repaint();
}
});
@Override
public void mouseClicked(MouseEvent e) {
if (timer != null) {
timer.stop();
}
paintImage = tintedImage;
repaint();
timer.start();
}
});
}
@Override
public Dimension getPreferredSize() {
return new Dimension(paintImage.getWidth() + 100, paintImage.getHeight() + 100);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g.create();
int x = (getWidth() - paintImage.getWidth()) / 2;
int y = (getHeight() - paintImage.getHeight()) / 2;
g2d.drawImage(paintImage, x, y, this);
g2d.dispose();
}
}
public class ImageUtils {
public static BufferedImage generateMask(BufferedImage imgSource, Color color, float alpha) {
int imgWidth = imgSource.getWidth();
int imgHeight = imgSource.getHeight();
BufferedImage imgMask = createCompatibleImage(imgWidth, imgHeight, Transparency.TRANSLUCENT);
Graphics2D g2 = imgMask.createGraphics();
applyQualityRenderingHints(g2);
g2.drawImage(imgSource, 0, 0, null);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_IN, alpha));
g2.setColor(color);
g2.fillRect(0, 0, imgSource.getWidth(), imgSource.getHeight());
g2.dispose();
return imgMask;
}
public static GraphicsConfiguration getGraphicsConfiguration() {
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
}
public static BufferedImage createCompatibleImage(int width, int height, int transparency) {
BufferedImage image = getGraphicsConfiguration().createCompatibleImage(width, height, transparency);
image.coerceData(true);
return image;
}
public static void applyQualityRenderingHints(Graphics2D g2d) {
g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
}
public BufferedImage tint(BufferedImage master, BufferedImage tint) {
int imgWidth = master.getWidth();
int imgHeight = master.getHeight();
BufferedImage tinted = createCompatibleImage(imgWidth, imgHeight, Transparency.TRANSLUCENT);
Graphics2D g2 = tinted.createGraphics();
applyQualityRenderingHints(g2);
g2.drawImage(master, 0, 0, null);
g2.drawImage(tint, 0, 0, null);
g2.dispose();
return tinted;
}
}
}
```
| null | CC BY-SA 4.0 | null | 2022-12-10T23:27:56.860 | 2022-12-10T23:27:56.860 | null | null | 992,484 | null |
74,757,313 | 2 | null | 74,755,593 | 0 | null | This is happening because `df.State.unique()` doesn't have the states in the same order as the values in `states_by_accident`.
You can fix this by instead passing the argument `locations = states_by_accident.index` to `go.Chloropleth` so that the locations and values are consistent:
```
fig = go.Figure(data = go.Choropleth(
locations = states_by_accident.index,
z = states_by_accident,
locationmode = 'USA-states',
colorscale = 'Blues'
))
```
[](https://i.stack.imgur.com/YwKex.png)
| null | CC BY-SA 4.0 | null | 2022-12-10T23:32:58.393 | 2022-12-10T23:32:58.393 | null | null | 5,327,068 | null |
74,757,487 | 2 | null | 74,753,973 | 0 | null | You needed a little more HTML and CSS, but this should work:
```
* {
font-family: Arial, “Helvetica Neue”, Helvetica, sans-serif;
font-size: 14px;
}
.container {
width: 75%;
margin: 0 auto;
}
.card {
border: 0.1em solid darkgrey;
border-radius: 0.5em;
padding: 1em;
}
.card .card-header {
margin: 0.5em;
color: darkgray;
}
.card .card-body {
display: flex;
}
.card-body .card-col {
margin: 0.5em;
display: flex;
}
.card-body .card-col-push {
margin-left: auto;
}
.card-col .user-img {
width: 2em;
height: 2em;
font-size: 20px;
color: #fff;
background-color: #00adad;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.card-col .user-info {
display: flex;
flex-direction: column;
justify-content: space-evenly;
}
.card-col .user-name {
font-weight: bold;
}
.card-col .user-email {
font-size: 12px;
color: darkgray;
}
.card-col .btn-container {
display: flex;
align-items: center;
}
.btn-container .btn {
margin: 0;
border: 0.1em solid #e7e7e7;
border-radius: 0.5em;
background-color: white;
color: cornflowerblue;
padding: 0.5em 1.5em;
font-weight: bold;
cursor: pointer;
}
.btn-container .btn:hover {
background: #e7e7e7;
}
```
```
<div class="container">
<div class="card">
<div class="card-header">
Você fez login como
</div>
<div class="card-body">
<div class="card-col">
<div class="user-img">
E
</div>
</div>
<div class="card-col">
<div class="user-info">
<div class="user-name">
Epamer
</div>
<div class="user-email">
[email protected]
</div>
</div>
</div>
<div class="card-col card-col-push">
<div class="btn-container">
<button class="btn">Mudar de conta</button>
</div>
</div>
</div>
</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-12-11T00:12:52.000 | 2022-12-11T00:12:52.000 | null | null | 1,437,029 | null |
74,757,640 | 2 | null | 74,756,655 | 3 | null | You can avoid the "no visible binding" CMD nag by defusing a string-as-symbol argument:
```
library(ggplot2)
ggplot(mpg, aes(displ)) +
geom_histogram(aes(y = after_stat(!!str2lang("density"))))
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-12-11T00:54:27.267 | 2022-12-11T00:54:27.267 | null | null | 12,500,315 | null |
74,758,041 | 2 | null | 74,757,745 | 0 | null | You can essentially accomplish this with:
```
df_melted = df.melt(id_vars=["Year"], value_vars=months, var_name="Month", value_name="CPI")
```
That will look like:
```
Year Month CPI
0 1984 Jan 0.48
1 1985 Jan 0.47
2 1986 Jan 0.64
3 1987 Jan 0.52
4 1988 Jan 1.00
```
You can get it to look like what you want pretty easily from there. For example:
```
# helpful
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
month_map = dict(zip(months, [i for i in range(1,13)]))
# get it to look like your ideal outcome
df_melted = df_melted.replace({"Month": month_map})
ym = [f"{y}-{m:02d}" for y, m in df_melted[["Year", "Month"]].values]
df_melted.insert(0, "Year-Month", ym)
df_melted.drop(["Year", "Month"], axis=1, inplace=True)
```
Now it will look like your desired outcome.
| null | CC BY-SA 4.0 | null | 2022-12-11T02:48:43.333 | 2022-12-11T02:48:43.333 | null | null | 868,044 | null |
74,758,285 | 2 | null | 15,940,940 | 0 | null | you may use the build-in function
```
Globals!ExecutionTime
```
| null | CC BY-SA 4.0 | null | 2022-12-11T04:09:24.110 | 2022-12-11T04:09:24.110 | null | null | 12,303,100 | null |
74,758,379 | 2 | null | 74,757,179 | 0 | null | If the path used to construct the QFileInfo instance is not absolute, it can only use relative paths. As the [documentation explains](https://doc.qt.io/qt-6/qfileinfo.html#details):
> A QFileInfo can point to a file with either a relative or an absolute file path. Absolute file paths begin with the directory separator "/" (or with a drive specification on Windows). Relative file names begin with a directory name or a file name and specify a path .
[os.listdir()](https://docs.python.org/3/library/os.html#os.listdir) returns only the :
> Return a list containing the names of the entries in the directory given by path.
This means that QFileInfo will only have a "relative" name of each entry based on the .
This is clearly an issue in your case:
- - `os.listdir()``something.doc``os.listdir()``something.doc`
So, the solution is to use absolute paths the proper icon type.
For simple cases (when the icon type is known), you can use the [icon(IconType)](https://doc.qt.io/qt-6/qabstractfileiconprovider.html#icon) override using the provided enum. For instance, if you know that the path refers to a directory (i.e. `os.path.isdir()`):
```
file_item_icon = iconProvider.icon(iconProvider.IconType.Folder)
```
Otherwise, you should use the full path, so that QFileInfo will use the file reference:
```
baseDir = QDir(path)
for fileName in os.listdir(path):
info = QFileInfo(baseDir.absoluteFilePath(fileName))
icon = iconProvider.icon(info)
root_item.appendRow(QStandardItem(icon, fileName))
```
| null | CC BY-SA 4.0 | null | 2022-12-11T04:35:05.187 | 2022-12-11T04:35:05.187 | null | null | 2,001,654 | null |
74,758,524 | 2 | null | 74,758,153 | 1 | null | Whenever you have to deal with tree/directory structures, you have to consider that you're using a 3-dimensional model, which automatically calls for a behavior.
While, normally, such a structure would require a relative 3D "model" as a reference, a basic string-based dictionary can suffice with a simple directory-based model.
The assumption is based on the fact that `os.walk` will walk through sub directories, even if they are empty.
The trick is to use a dictionary that has keys as full directory paths, and items as their values.
```
root_item = QStandardItem("Root")
parents = {path: root_item}
model.appendRow(root_item)
def getParent(path):
parent = parents.get(path)
if parent:
return parent
grandParentPath, parentName = path.rsplit(os.sep, 1)
parent = QStandardItem(parentName)
parents[path] = parent
getParent(grandParentPath).appendRow(parent)
return parent
for root, folders, files in os.walk(path):
getParent(root)
```
| null | CC BY-SA 4.0 | null | 2022-12-11T05:11:25.800 | 2022-12-11T05:11:25.800 | null | null | 2,001,654 | null |
74,759,249 | 2 | null | 19,308,366 | 0 | null | Bootstrap v5+
[](https://i.stack.imgur.com/9VWT9.png)
[](https://i.stack.imgur.com/2UkFr.png)
```
<!-- mt-md-4 pt-md-3 this apply margin and padding only for desktop -->
<div class="col-md-3 mb-3 md-mt-4 md-pt-3">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Default checkbox
</label>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-12-11T08:12:36.910 | 2022-12-11T11:48:24.660 | 2022-12-11T11:48:24.660 | 1,844,933 | 1,844,933 | null |
74,759,299 | 2 | null | 74,759,201 | 1 | null | The easiest way is possibly to convert directly to Markdown while using the `--extract-media` option:
```
pandoc input.md --extract-media=media -t commonmark -o output.md
```
That option can be used with any input format, it's just not as common. But this is one of the use-cases where it makes sense.
| null | CC BY-SA 4.0 | null | 2022-12-11T08:22:12.873 | 2022-12-11T08:22:12.873 | null | null | 2,425,163 | null |
74,759,307 | 2 | null | 74,759,201 | 1 | null | I just tried to disable the `implicit_figures` [extension](https://pandoc.org/MANUAL.html#extension-implicit_figures):
```
pandoc -f markdown-implicit_figures input.md -o output.docx && pandoc output.docx --extract-media=. -t commonmark-raw_html -o output.md
```
The content of `input.md`:
```
Using Pandoc to convert documents

Pandoc is really *awesome*!
```
The content of `output.md`:
```
Using Pandoc to convert documents

Pandoc is really *awesome*!
```
It worked as expected! But for my use-case, the answer by @tarleb is much better.
| null | CC BY-SA 4.0 | null | 2022-12-11T08:23:23.460 | 2022-12-11T08:29:20.373 | 2022-12-11T08:29:20.373 | 19,418,090 | 19,418,090 | null |
74,759,567 | 2 | null | 74,757,393 | 4 | null | You can use mask to achieve this but only available on chrome right now:
```
.box {
/* this will do the trick */
-webkit-mask:
linear-gradient(#000 0 0),
linear-gradient(#000 0 0);
-webkit-mask-clip: text, padding-box;
-webkit-mask-composite: xor;
mask-composite: exclude;
/**/
backdrop-filter: blur(8px);
text-transform: uppercase;
font-size: 80px;
font-weight: bold;
background: rgb(0 0 0/50%);
padding: 20px;
}
body {
background:url(https://picsum.photos/id/1016/800/300) center/cover;
padding: 50px 0;
}
html {
background: #fff;
}
```
```
<div class="box">Text</div>
```
| null | CC BY-SA 4.0 | null | 2022-12-11T09:16:43.600 | 2022-12-11T09:22:55.440 | 2022-12-11T09:22:55.440 | 8,620,333 | 8,620,333 | null |
74,759,846 | 2 | null | 15,917,973 | 0 | null | It has nothing to do with AppCompatActivity or appcompat library.
just use
```
menuInflater.inflate(R.menu.main_menu, menu)
```
instead of
```
MenuInflater(this).inflate(R.menu.main_menu, menu)
```
| null | CC BY-SA 4.0 | null | 2022-12-11T10:02:52.170 | 2022-12-11T10:02:52.170 | null | null | 9,879,923 | null |
74,759,935 | 2 | null | 41,938,201 | 1 | null | To describe a similar sum as at the top of the page, when I use the asmeurer's recommendation `summation`, I get the error -TypeError: 'Symbol' object is not subscriptable." What could be the possible cause of this error? I imported the libraries below. There is a continuation of the code, but I did not add it to avoid confusion.
```
import sympy as sympy
from sympy import *
from sympy import summation, symbols
class FQ():
def integrate(self):
for k in range(1, self.Nt):
i = symbols('i', integer=True)
self.Sigma = summation(self.u[i+1][j], (i, 0, k - 1))
```
---
#second attempt
```
def integrate(self, alpha, Nt, Nx, L):
for k in range(1, self.Nt):
for j in range(1, self.Nx-1):
#define sum
for i in range(1, self.Nt):
Sigma = summation(u[i+1][j], (i, 0, k-1))
```
| null | CC BY-SA 4.0 | null | 2022-12-11T10:19:07.833 | 2022-12-27T20:00:51.523 | 2022-12-27T20:00:51.523 | 20,747,528 | 20,747,528 | null |
74,760,066 | 2 | null | 15,641,473 | 0 | null | I use `ScaleTransform`. This scales the current font by the desired amount:
```
<ScaleTransform x:Key="FontDoubled" ScaleX="2" ScaleY="2" />
<ScaleTransform x:Key="FontHalved" ScaleX="0.5" ScaleY="0.5" />
```
The larger the `ScaleX` and `ScaleY`, the larger the font is scaled by. No need to change individual font sizes.
It can also be used with just `ScaleX` or `ScaleY` to change the font size in one direction only, or with different values.
To use it:
```
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4"
FontWeight="Bold"
Content="This is normal the size" />
```
...gives:
[](https://i.stack.imgur.com/zWVSd.png)
And:
```
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4"
FontWeight="Bold"
LayoutTransform="{StaticResource FontDoubled}"
Content="This is Double size" />
```
...gives:
[](https://i.stack.imgur.com/m1HEf.png)
| null | CC BY-SA 4.0 | null | 2022-12-11T10:38:24.610 | 2022-12-11T10:38:24.610 | null | null | 7,390,686 | null |
74,760,101 | 2 | null | 74,759,787 | 1 | null | So not that long ago Auth0 has released an official package for authenticating.
It handles all the difficult processes by itself. The only thing you need to provide is your client_id and domain. You will receive an access_token in JWT form.
Here is a link to the package:
[https://pub.dev/packages/auth0_flutter](https://pub.dev/packages/auth0_flutter)
It has been well documented. Also a lot of information is already available on the website of auth0 on access_tokens and refresh tokens.
I hope this makes it a little easier.
| null | CC BY-SA 4.0 | null | 2022-12-11T10:42:11.797 | 2022-12-11T10:42:11.797 | null | null | 9,138,914 | null |
74,760,393 | 2 | null | 74,758,187 | 0 | null | First you have to build your vuejs app
```
npm run build
```
When Vue builds the app, by default it assumes that index.html will be in the root, as in [http://my-server.com/index.html](http://my-server.com/index.html), therefore the base URL is /. so please be sure that index.html is in the public folder which your server points to and update me with your case i am here to help!
| null | CC BY-SA 4.0 | null | 2022-12-11T11:27:15.813 | 2022-12-11T11:27:15.813 | null | null | 10,223,551 | null |
74,760,418 | 2 | null | 74,760,398 | 1 | null | You read the data by using pandas, and try the following code
```
df = pd.read_csv('name_file.csv')
(df.assign(idx=df.groupby('Entry').cumcount()).melt(['Entry', 'idx'])
.pivot(index=['idx', 'variable'], columns='Entry', values='value')
.droplevel('idx').rename_axis(index=None, columns=None)
)
```
| null | CC BY-SA 4.0 | null | 2022-12-11T11:31:30.393 | 2022-12-12T11:56:29.327 | 2022-12-12T11:56:29.327 | 15,852,600 | 15,852,600 | null |
74,760,511 | 2 | null | 74,760,474 | 0 | null | Assuming you are using HTML, you can use fetch:
```
fetch('input.txt')
.then((response) => response.text())
.then(function(data) {
console.log(data);
});
```
You could also use this in an async context:
```
async function getInput() {
let res = await fetch("input.txt");
let text = await res.text();
return text;
}
```
| null | CC BY-SA 4.0 | null | 2022-12-11T11:44:50.570 | 2022-12-11T11:47:34.820 | 2022-12-11T11:47:34.820 | 10,501,887 | 10,501,887 | null |
74,760,539 | 2 | null | 74,760,474 | 0 | null | ```
const { readFileSync } = require('fs')
const contents = readFileSync(filename, 'utf-8')
```
| null | CC BY-SA 4.0 | null | 2022-12-11T11:49:49.873 | 2022-12-11T11:51:23.480 | 2022-12-11T11:51:23.480 | 20,748,087 | 20,748,087 | null |
74,760,770 | 2 | null | 74,759,071 | 2 | null | To reproduce a similar image, as I said in comment, you don't want to fill a polygon. You want to draw a polylines, with fat lines. Like this
```
import cv2
import numpy as np
img=np.full((250,500,3), 255, dtype=np.uint8) # A white 500x250 rgb image
lines=np.array([[50,100], [200,50], [300,70], [450,150], [220,210], [120,200]], dtype=np.int32) # Array of points of the polylines
# Draw the polylines (closed, hence `True`), in black (`(0,0,0)`), with fat lines (`thickness=80`)
# Note that 2nd argument is [lines] not lines. It need to be an array of 1 array of points (themselves being array of 2 components)
cv2.polylines(img, [lines], True, color=(0,0,0), thickness=80)
cv2.imshow('result', img) # Just to display the result
cv2.waitKey(0) # close display when you hit a key
```
Result is
[](https://i.stack.imgur.com/ypRYV.png)
(Drawn with matplotlib, not cv2, just to have the scale)
If you really want to use polyfill ability to draw polygon with holes, that is done by giving more that one polyline in the array in 2nd argument of polyfill (there is a reason why we needed to pass `[lines]` and not `lines` in the previous code: because it could have been not just one polyline, but several ones, so it could have been `[lines1, lines2]`. This is our case this time. We need 2 polygon: one outer one, and the inner one for the hole).
```
import cv2
import numpy as np
img=np.full((250,500,3), 255, dtype=np.uint8)
lines=np.array([[50,100], [200,50], [300,70], [450,150], [220,210], [120,200]], dtype=np.int32)
hole=np.array([[150,100], [260,80], [260,120]], dtype=np.int32)
cv2.fillPoly(img, [lines,hole], (0,0,0))
cv2.imshow('result', img)
cv2.waitKey(0)
```
[](https://i.stack.imgur.com/zYs1m.png)
Note that the polygon is smaller, though the outer polyline is the same. That is because this times, I didn't use line thickness.
At last, if you want, to use polyfill to have a picture looking a bit like the 1st one, that is with the hole being the same as the outer polygon, but smaller, then just compute the 2nd polygon (hole) from the first one.
For example, we can choose a center at (220,130), and reduce the distance from this center by applying a factor (less than 1, to make it smaller), and add the center back.
```
import cv2
import numpy as np
img=np.full((250,500,3), 255, dtype=np.uint8)
lines=np.array([[50,100], [200,50], [300,70], [450,150], [220,210], [120,200]], dtype=np.int32)
# Note the .astype, necessary because after the *0.5 the array became an array of floats
# and cv2 needs coordinates to be array of ints.
hole=((lines-[220,130])*0.5+[220,130]).astype(np.int32)
cv2.fillPoly(img, [lines,hole], (0,0,0))
cv2.imshow('result', img)
cv2.waitKey(0)
```
[](https://i.stack.imgur.com/o80HP.png)
| null | CC BY-SA 4.0 | null | 2022-12-11T12:21:07.000 | 2022-12-11T12:21:07.000 | null | null | 20,037,042 | null |
74,760,927 | 2 | null | 31,135,756 | 0 | null | In project pom do not add in dependencies just copy jtds-1.3.1.jar to the lib folder of the tomcat server
| null | CC BY-SA 4.0 | null | 2022-12-11T12:44:35.777 | 2022-12-11T12:51:23.723 | 2022-12-11T12:51:23.723 | 2,227,743 | 10,675,106 | null |
74,761,667 | 2 | null | 74,761,074 | 2 | null | As it is not possible to extend an inextensible object, you can either wrap the library or use it as the prototype of a new object. For example:
```
import('d3').then((library) => {
const d3 = Object.create(library);
d3.contextMenu = factory(library);
for (const prop in d3) console.log(prop);
})
.catch((err) => {
console.error(err);
});
```
To export:
```
module.exports = (async () => {
const library = await import('d3');
const d3 = Object.create(library);
d3.contextMenu = factory(library);
return d3;
})();
```
To then import into CommonJS module using `require`:
```
(async () => {
const d3 = await require('./filename.js');
for (const prop in d3) console.log(prop);
})();
```
| null | CC BY-SA 4.0 | null | 2022-12-11T14:31:35.553 | 2022-12-11T16:09:23.043 | 2022-12-11T16:09:23.043 | 1,565,512 | 1,565,512 | null |
74,761,916 | 2 | null | 74,761,467 | 0 | null | Try to change Import:
```
import Ionicons from "react-native-vector-icons/MaterialIcons";
```
check default import here: [https://github.com/oblador/react-native-vector-icons/blob/master/MaterialIcons.js](https://github.com/oblador/react-native-vector-icons/blob/master/MaterialIcons.js)
| null | CC BY-SA 4.0 | null | 2022-12-11T15:07:43.280 | 2022-12-11T15:07:43.280 | null | null | 2,791,142 | null |
74,762,394 | 2 | null | 74,760,398 | 1 | null | You can use:
```
#if entry is index, remove "set_index('Entry')" field.
final=pd.concat([df[:4].set_index('Entry').T,df[4:].set_index('Entry').T])
```
:
```
| | 0 | 1 | 2 | 3 |
|:---------|:---------|:---------|:----|----:|
| Blue | 3/20/20 | 3:09 PM | O | 12 |
| Red | 3/20/20 | 9:13 PM | C | 0 |
| Purple | 11/26/22 | 3:09 PM | O | 34 |
| Green | 3/20/20 | 3:09 PM | O | 24 |
| Black | 3/20/20 | 3:09 PM | O | 133 |
| Orange | 3/20/20 | 3:09 PM | O | 72 |
| Yellow | 3/20/20 | 3:09 PM | O | 2 |
| Gold | 3/20/20 | 3:00 PM | O | 13 |
| White | 3/20/20 | 3:00 PM | O | 31 |
| Silver | 3/20/20 | 8:49 PM | O | 43 |
| Bronze | 3/20/20 | 2:22 PM | C | 13 |
| Platinum | 3/20/20 | 3:00 PM | O | 59 |
| Titanium | 3/20/20 | 3:00 PM | O | 63 |
| Blue | 5/1/20 | 9:13 PM | O | 23 |
| Red | 5/1/20 | 9:13 PM | C | 0 |
| Purple | 5/1/20 | 5:24 PM | O | 45 |
| Green | 5/1/20 | 12:09 PM | O | 67 |
| Black | 5/1/20 | 3:09 PM | O | 56 |
| Orange | 5/1/20 | 3:09 PM | O | 754 |
| Yellow | 5/1/20 | 3:09 PM | O | 23 |
| Gold | 5/1/20 | 3:00 PM | O | 56 |
| White | 5/1/20 | 3:00 PM | O | 121 |
| Silver | 5/1/20 | 8:49 PM | O | 92 |
| Bronze | 5/1/20 | 2:22 PM | C | 13 |
| Platinum | 5/1/20 | 3:00 PM | O | 59 |
| Titanium | 5/1/20 | 3:00 PM | O | 63 |
```
| null | CC BY-SA 4.0 | null | 2022-12-11T16:11:42.557 | 2022-12-12T07:23:28.587 | 2022-12-12T07:23:28.587 | 15,415,267 | 15,415,267 | null |
74,762,655 | 2 | null | 73,312,653 | 15 | null | I faced the same issue in Cypress version 12.0.0 and I solved it by adding this configuration to cypress.config.js
```
testIsolation: false,
```
| null | CC BY-SA 4.0 | null | 2022-12-11T16:44:22.413 | 2023-01-01T21:31:17.827 | 2023-01-01T21:31:17.827 | 20,889,797 | 2,848,816 | null |
74,762,732 | 2 | null | 74,762,644 | 0 | null | `findAll()``find_all()``select()``css selectors`[check docs](https://www.crummy.com/software/BeautifulSoup/bs4/doc/#method-names)
> AttributeError: ResultSet object has no attribute 'find'. You're probably treating a list of items like a single item. Did you call find_all() when you meant to call find()?
You have to iterate your `ResultSet` to use `find()` on each element:
```
for e in soup.find_all('div', class_='styles_main__Y8zDm styles_mainWithNotCollapsedBeforeSlot__x4cWo'):
print(e.find('span', class_='desktop-list-main-info_secondaryTitle__ighTt').text)
```
| null | CC BY-SA 4.0 | null | 2022-12-11T16:53:37.643 | 2022-12-11T17:03:48.637 | 2022-12-11T17:03:48.637 | 14,460,824 | 14,460,824 | null |
74,762,791 | 2 | null | 74,749,485 | 1 | null | The error is this:
```
process (rise_sclk, rise_drdy) -- Next State affectation
begin
-- code omitted, but does generally this:
next_state <= SOME_VALUE;
end process;
```
Because the sensitivity list includes only the signals `rise_sclk` and `rise_drdy`, the process is "executed" only if any of these signals changes. You can follow this in the wave diagram.
You don't have a synchronous design running on `clk`. Put `clk` on the sensitivity list and base the decisions on the levels of `rise_sclk` and `rise_drdy`. As an excerpt:
```
process (clk) -- Next State affectation
begin
if rising_edge(clk) then
case actual_state is
when init =>
next_state <= wait_drdy;
-- and so on
end case;
end if;
end process;
```
| null | CC BY-SA 4.0 | null | 2022-12-11T17:02:33.833 | 2022-12-11T17:02:33.833 | null | null | 11,294,831 | null |
74,762,828 | 2 | null | 74,762,696 | 0 | null | Here is a cool tool:
[https://tabletag.net/](https://tabletag.net/)
Here you need to nest a table in the second row
```
table,
td,
th {
border: 1px solid #595959;
border-collapse: collapse;
}
td,
th {
padding: 3px;
width: 30px;
height: 25px;
}
th {
background: #f0e6cc;
}
.even {
background: #fbf8f0;
}
.odd {
background: #fefcf9;
}
```
```
<table>
<tbody>
<tr>
<td colspan="3"></td>
<td colspan="5"></td>
<td colspan="3" rowspan="2"></td>
</tr>
<tr>
<td colspan="3"></td>
<td colspan="5"></td>
</tr>
<tr>
<td colspan="6"></td>
<td colspan="5"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
```
[](https://i.stack.imgur.com/kAkc1.png)
| null | CC BY-SA 4.0 | null | 2022-12-11T17:06:26.097 | 2022-12-11T17:06:26.097 | null | null | 295,783 | null |
74,763,191 | 2 | null | 74,763,175 | 1 | null | use `setCounter(counter + 1);` instead
[Demo](https://stackblitz.com/edit/react-ts-ckhm17?file=App.tsx)
| null | CC BY-SA 4.0 | null | 2022-12-11T17:54:05.867 | 2022-12-11T17:54:05.867 | null | null | 6,428,638 | null |
74,763,399 | 2 | null | 74,763,241 | 0 | null | Deleting an object does not change any property of the remaining objects. You need to do that manually. First thing you need to do is to change the `dish_id` field:
```
# Change this:
# dish_id = models.AutoField
# to this:
dish_id = models.IntegerField(default=0)
```
Then in your views:
```
def delete(request, id):
dishs = dish.objects.get(id=id)
dishs.delete()
all_dishes = dish.objects.all()
for i, dish in enumerate(all_dishes):
dish.dish_id = i + 1
dish.save()
return HttpResponseRedirect(reverse('check'))
```
Separately, you really should write your classes in Pascal case, capitalizing the first letter of the class:
```
class Dish(models.Model):
```
And finally, `Dish` does not need an id field; that is created automatically, but you can leave that as is, it is not causing any problems.
| null | CC BY-SA 4.0 | null | 2022-12-11T18:24:46.280 | 2022-12-11T18:24:46.280 | null | null | 10,951,070 | null |
74,763,703 | 2 | null | 74,763,601 | 1 | null | The issue is most likely that the `merge` breaks the order of the maps dataframe given by the `order` column, i.e. `geom_polygon` will connect the points in the order as they appear in the dataset.
Using some fake random example data I can reproduce your issue:
```
library(stringr)
library(ggplot2)
all_states <- map_data("state")
all_states <- dplyr::rename(all_states,
state = "region"
)
all_states$state <- str_to_title(all_states$state)
library(ggplot2)
library(dplyr, warn = FALSE)
int <- data.frame(
state = state.name,
introduced = sample(c(0, 1), 50, replace = TRUE)
)
stateData <- merge(all_states, int, by = "state")
ggplot() +
geom_polygon(data = stateData, aes(x = long, y = lat, group = group, fill = as.factor(introduced)), color = "grey50") +
coord_map()
```

To fix that we could re-arrange the data by the `order` column (per `state` and `group`)
```
stateData <- stateData |>
arrange(state, group, order)
ggplot() +
geom_polygon(data = stateData, aes(x = long, y = lat, group = group, fill = as.factor(introduced)), color = "grey50") +
coord_map()
```

| null | CC BY-SA 4.0 | null | 2022-12-11T19:10:14.067 | 2022-12-11T19:10:14.067 | null | null | 12,993,861 | null |
74,763,910 | 2 | null | 74,763,567 | 0 | null | As you ask for directions and not for a solution, I'll say that you cannot use the same index algebra as in the standard Pascal's triangle formula when the outer coefficients aren't equal to one.
| null | CC BY-SA 4.0 | null | 2022-12-11T19:38:21.167 | 2022-12-11T19:38:21.167 | null | null | 11,334,020 | null |
74,764,040 | 2 | null | 74,763,792 | 0 | null | Does this give you what you need?
```
# Load the required packages
library(ggplot2)
# Create a sample data frame
Horticulture <- data.frame(
species = rep(letters[1:4], 10),
Time = rep(1:10,each = 4),
growth = rnorm(40, 1.3, 0.4),
SE = rnorm(40,0.1,0.1))
# generate plot
ggplot(Horticulture,aes(x=Time, y=growth, shape=species))+
geom_point() + geom_errorbar(aes(ymin=growth-SE,ymax=growth+SE))+
geom_line() + xlab("Time [days]")+
ylab(expression(paste("Growth [",days,"per measurement"))) +
scale_shape_manual(values = c(0,1,15,16))
```
| null | CC BY-SA 4.0 | null | 2022-12-11T19:58:37.127 | 2022-12-11T20:06:45.770 | 2022-12-11T20:06:45.770 | 1,827,208 | 1,827,208 | null |
74,764,066 | 2 | null | 62,461,708 | 0 | null | :
I had to make sure I was working under the `(venv)` (I wasn't)
I had to the file I was trying to run running it `Ctrl+S`.
:
I was running two terminals opened. In the first one I had an active server, and in the second on I was running the actual file. I was able to make it work:
[](https://i.stack.imgur.com/HcGnb.png)
[](https://i.stack.imgur.com/chVxb.png)
| null | CC BY-SA 4.0 | null | 2022-12-11T20:01:30.243 | 2022-12-11T20:01:30.243 | null | null | 16,946,785 | null |
74,764,205 | 2 | null | 74,763,888 | 1 | null | Elements are spreaded over two elements with same class, so you could select them one after the other or you try to generalise, select all `<strong>` as key and its `next_sibling` as value to create a `dict`:
```
for item in posts:
post = {
'title': item.find('div', {'class': 'job-ti'}).text,
'description': item.find('div', {'class': 'job-body'}).text,
}
post.update(
{(x.text[:-1],x.next_sibling) if x.text[:-1] != 'Date' else (x.text[:-1],x.find_next_sibling().text) for x in item.select('.job-details strong')}
)
postList.append(post)
```
#### Example
```
from bs4 import BeautifulSoup
import requests
import pandas as pd
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36'
'(KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'}
postList = []
def getPosts(page):
url = url = 'https://www.technojobs.co.uk/search.phtml?page={page}&row_offset=10&keywords=data%20analyst&salary=0&jobtype=all&postedwithin=all'
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, 'html.parser')
posts = soup.find_all('div', {'class': 'jobbox'})
for item in posts:
post = {
'title': item.find('div', {'class': 'job-ti'}).text,
'description': item.find('div', {'class': 'job-body'}).text,
}
post.update(
{(x.text[:-1],x.next_sibling) if x.text[:-1] != 'Date' else (x.text[:-1],x.find_next_sibling().text) for x in item.select('.job-details strong')}
)
postList.append(post)
return
for x in range(1, 2):
getPosts(x)
pd.DataFrame(postList)
```
#### Output
| | title | description | Date | Salary/Rate | Location |
| | ----- | ----------- | ---- | ----------- | -------- |
| 0 | Data Analyst with Big Data | Job Description Data Analyst with Big Data - Canary Wharf Our Client is seeking a Data Analyst for the Data Products team is driving innovations in the Financial Services Sector using Big Data. The Client has a high-calibre, focused and a mission-driven team. The models we build and the analysis that we derive from financial data matters to crucial... | 24th November | £300 - £450 | Canary Wharf London |
| 1 | Data Analyst with Big Data | Data Analyst with Big Data - Canary Wharf Our Client is seeking a Data Analyst for the Data Products team is driving innovations in the Financial Services Sector using Big Data. The Client has a high-caliber, focused and a mission-driven team. The models we build and the analysis that we derive from financial data matters to crucial cutting-edge... | 30th November | £250 - £450 | Canary Wharf Docklands London |
| 2 | ESA - Perm - Data analyst BI - DATA | Nous recherchons des personnes avec une dimension hybride : ayant à la fois une connaissance avancée d'une ou plusieurs solutions BI/ Dataviz, capable de travailler en relation directe avec des équipes métier et être capable de piloter des projets data. Vous serez amené à: Travailler en mode agile et en autonomie, avec des sprints très courts... | 25th November | £45,180 - £63,252 | Paris |
...
| null | CC BY-SA 4.0 | null | 2022-12-11T20:20:25.293 | 2022-12-11T20:29:54.723 | 2022-12-11T20:29:54.723 | 14,460,824 | 14,460,824 | null |
74,764,262 | 2 | null | 74,738,797 | 0 | null | I see someone already mentioned that you can use a trigger for this so im going to give another alternative if you dont want to go down that route. You can just update both tables within the scope of your insert into the order table eg :
--Inserts order here
```
BEGIN TRY
BEGIN TRANSACTION
INSERT INTO order_detail
VALUES (@unit_price, @size, @quantity, @discount, GETDATE(),
@productid,
@orderid, @paymentid) --Im assuming you have already inserted into your order table in a different caller or same stored procedure
UPDATE product
SET product_quantity = (product_quantity - @quantity)
COMMIT;
END TRY
BEGIN CATCH
ROLLBACK;
END CATCH
```
In your stored procedure you will wrap it around a transaction so if all inserts and updates were successful it will commit that transaction to the database and if a single operation fails on the stored procedure then we rollback (all previous operations will be rolledback to ensure we dont create orphaned rows)
Hope this helps! :)
| null | CC BY-SA 4.0 | null | 2022-12-11T20:27:36.523 | 2022-12-11T20:27:36.523 | null | null | 18,154,499 | null |
74,764,318 | 2 | null | 28,817,475 | 0 | null | I faced the same problem today and tried a lot of solutions but discovered that the problem was the project's primary folder name was the cause of the problem
here is my project's main folder before: Product Color Picker [Custom Widget]
[ERR! Invalid name: "product-color-picker-[custom-widget]"](https://i.stack.imgur.com/nXBZv.png)
here is after I changed the folder name and removed the brackets and the error is gone: Product Color Picker [Custom Widget]
[Npm working fine with no errors](https://i.stack.imgur.com/bqWf8.png)
BTW, keep in mind that if you were in VSCode you will need to re-open the folder after changing its name from the system as it will appear broken with no files [because the original folder name you opened changes]
| null | CC BY-SA 4.0 | null | 2022-12-11T20:36:17.870 | 2022-12-11T20:37:13.350 | 2022-12-11T20:37:13.350 | 14,718,213 | 14,718,213 | null |
74,764,769 | 2 | null | 74,763,888 | 0 | null | ```
import requests
from bs4 import BeautifulSoup, SoupStrainer
from concurrent.futures import ThreadPoolExecutor, as_completed
import pandas as pd
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0'
}
def get_soup(content):
return BeautifulSoup(content, 'lxml', parse_only=SoupStrainer('div', attrs={'class': 'jobbox'}))
def worker(req, page):
params = {
"jobtype": "all",
"keywords": "data analyst",
"page": page,
"postedwithin": "all",
"row_offset": "10",
"salary": "0"
}
while True:
try:
r = req.get(
'https://www.technojobs.co.uk/search.phtml', params=params)
if r.ok:
break
except requests.exceptions.RequestException:
continue
soup = get_soup(r.content)
print(f'Extracted Page# {page}')
return [
(
x.select_one('.job-ti a').get_text(strip=True, separator=' '),
x.select_one('.job-body').get_text(strip=True, separator=' '),
list(x.select_one(
'strong:-soup-contains("Salary/Rate:")').next_elements)[1].get_text(strip=True),
list(x.select_one(
'strong:-soup-contains("Location:")').next_elements)[1].get_text(strip=True)
)
for x in soup.select('.jobbox')
]
def main():
with requests.Session() as req, ThreadPoolExecutor() as executor:
req.headers.update(headers)
futures = (executor.submit(worker, req, page) for page in range(1, 38))
allin = []
for res in as_completed(futures):
allin.extend(res.result())
df = pd.DataFrame(
allin, columns=['Name', 'Description', 'Salary', 'Location'])
# df.to_sql()
print(df)
main()
```
Output:
```
Name ... Location
0 Junior Data Insights Analyst ... Knutsford
1 Data Insight Analyst ... Knutsford
2 Senior Data Insight Analyst ... Knutsford
3 Business Data Analyst ... Glasgow
4 Data Analyst with VBA and SQL ... Docklands London
.. ... ... ...
331 Power Platform Business Analyst ... Manchester
332 Power Platform Business Analyst ... Glasgow
333 Power Platform Business Analyst ... Birmingham
334 Cyber Security Compliance Analyst ... London
335 |Sr Salesforce Admin/ PM| $120,000|Remote| ... New York
[336 rows x 4 columns]
```
| null | CC BY-SA 4.0 | null | 2022-12-11T21:45:07.173 | 2022-12-11T21:45:07.173 | null | null | 7,658,985 | null |
74,764,865 | 2 | null | 74,764,651 | 0 | null | You probably need to convert the spherical coordinates to cartesian:
```
# I don't have any clue about your differential equations.
# Maybe you need to convert the angles to radians. That's up to you do decide.
θ = np.radians(θ)
ϕ = np.radians(ϕ)
# spherical to cartesian
x_line= r * np.sin(θ) * np.cos(ϕ)
y_line = r * np.sin(θ) * np.sin(ϕ)
z_line = r * np.cos(θ)
```
| null | CC BY-SA 4.0 | null | 2022-12-11T21:58:29.593 | 2022-12-11T21:58:29.593 | null | null | 2,329,968 | null |
74,764,876 | 2 | null | 74,764,819 | 0 | null | You can add the following line to your code:
```
ax.set_ylim(min(min(temps), min(pressures)), max(max(temps), max(pressures)))
```
With [set_ylim()](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_ylim.html) you can define the max and min values of the y-axis. This stretches the y-axis to cover the whole range, so you don't get any jumps in between.
| null | CC BY-SA 4.0 | null | 2022-12-11T21:59:59.347 | 2022-12-11T21:59:59.347 | null | null | 16,977,407 | null |
74,765,123 | 2 | null | 28,847,155 | 0 | null | This can happen when the aspect ratio of the video player doesn't perfectly match the actual video's aspect ratio, which results in padding at the borders. A workaround is to change the background color of the video like so:
```
.video-js .vjs-tech {
background-color: white;
}
```
| null | CC BY-SA 4.0 | null | 2022-12-11T22:41:45.677 | 2022-12-11T22:41:45.677 | null | null | 1,048,456 | null |
74,765,594 | 2 | null | 74,765,517 | 1 | null | Reorder your variable before running the plot. See below how to do it with base R.
```
df2$ends <- factor(df2$ends, levels= c("Sunday", "Monday",
"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"))
```
Similar to [this](https://stackoverflow.com/questions/10309564/reorder-factor-levels-by-day-of-the-week-in-r) question and response
| null | CC BY-SA 4.0 | null | 2022-12-12T00:20:48.590 | 2022-12-12T00:20:48.590 | null | null | 13,015,865 | null |
74,766,034 | 2 | null | 74,763,241 | 0 | null | You can achieve those things using an overriding save() method like this
```
class dish(models.Model):
id =models.AutoField(primary_key=True)
dish_id = models.BigIntegerField(unique = True)
dish_name = models.CharField(max_length=255, blank=True, null=True)
dish_category = models.CharField(max_length=255, blank=True, null=True)
dish_size = models.CharField(max_length=7, blank=True, null=True)
dish_price = models.IntegerField(blank=True, null=True)
dish_description = models.CharField(max_length=255, blank=True, null=True)
dish_image = models.ImageField(upload_to="images/", default=None, blank=True, null=True)
dish_image = models.ImageField(upload_to="media/", default=None, blank=True, null=True) #here added images as a foldername to upload to.
dish_date = models.DateField()
def __str__(self):
return self.dish_name
def save(self, *args, **kwargs):
count_obj = dish.objects.all().count()+1
self.dish_id = count_obj
super(dish, self).save(*args, **kwargs)
```
| null | CC BY-SA 4.0 | null | 2022-12-12T02:09:37.370 | 2022-12-12T04:52:16.117 | 2022-12-12T04:52:16.117 | 19,205,926 | 19,205,926 | null |
74,766,234 | 2 | null | 69,413,943 | 0 | null | In addition to provided answers, you may consider this one.
This is a bit tedious since with this approach, you have to
- `sheetPeekHeight``top`- `sheetBackgroundColor``content{…}`- `sheetElevation``0.dp`
```
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun SampleBottomSheet() {
val contentBackground = Color.White
val sheetPeekHeight = 40.dp
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = BottomSheetState(BottomSheetValue.Collapsed)
)
val coroutineScope = rememberCoroutineScope()
BottomSheetScaffold(
scaffoldState = bottomSheetScaffoldState,
sheetBackgroundColor = contentBackground,
sheetElevation = 0.dp,
sheetPeekHeight = sheetPeekHeight,
sheetContent = {
Column(
modifier = Modifier
.padding(top = sheetPeekHeight)
.wrapContentHeight()
.fillMaxWidth()
.background(Color.DarkGray)
) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(30.dp)
.background(Color.DarkGray)
)
Box(
modifier = Modifier
.fillMaxWidth()
.height(80.dp)
.background(Color(0xFF4fc992))
)
}
},
floatingActionButton = {
FloatingActionButton(
backgroundColor = Color(0xFF4a6ebd),
shape = CircleShape,
onClick = {},
) {
Icon(imageVector = Icons.Filled.Add, contentDescription = "icon")
}
}
) {
Box(
modifier = Modifier
.fillMaxSize()
.background(contentBackground)
) {
Button(
onClick = {
coroutineScope.launch {
if (bottomSheetScaffoldState.bottomSheetState.isCollapsed) {
bottomSheetScaffoldState.bottomSheetState.expand()
} else {
bottomSheetScaffoldState.bottomSheetState.collapse()
}
}
}
) {
Text("Open/Close bottom sheet")
}
}
}
}
```
Call-site usage:
```
class BottomSheetScaffoldExampleActivity: ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
SampleBottomSheet()
}
}
}
```
[](https://i.stack.imgur.com/yjiZV.gif)
All these codes are copy-and-paste-able.
| null | CC BY-SA 4.0 | null | 2022-12-12T02:56:40.717 | 2022-12-12T02:56:40.717 | null | null | 19,023,745 | null |
74,766,300 | 2 | null | 70,238,021 | 0 | null | If you haven't solved this problem, try renaming the folder of pyemd.
For example X:\xxx\Lib\site-packages\pyemd → X:\xxx\Lib\site-packages\PyEMD.
Besides, before renaming, we had better to install emd-signal(pip install EMD-signal). Otherwise, we can not import CEEMDAN, EEMD, and other methods based on emd.
| null | CC BY-SA 4.0 | null | 2022-12-12T03:11:13.363 | 2022-12-12T03:11:35.087 | 2022-12-12T03:11:35.087 | 14,738,996 | 14,738,996 | null |
74,766,433 | 2 | null | 74,766,096 | 2 | null | you can exclude your uid from the `Query`, with the `where()` filtering method like this:
```
return StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection('users').where("uId", isNotEqualTo: FirebaseAuth.instance.currentUser!.uid).snapshots(),
// ...
```
this will return all documents of your `users` collection which have an `uid` property different than your uid for from Firebase auth.
| null | CC BY-SA 4.0 | null | 2022-12-12T03:39:51.923 | 2022-12-12T04:37:27.673 | 2022-12-12T04:37:27.673 | 209,103 | 18,670,641 | null |
74,766,490 | 2 | null | 24,424,459 | 0 | null | Don't have the rep points to add a comment, but needs to change the hooked action from:
```
add_action( 'admin_menu', 'remove_menus' );
```
to:
```
add_action( 'admin_init', 'remove_menus' );
```
and then you can do something like:
```
function remove_menus(){
// If the current user is not an admin
if ( !current_user_can('manage_options') ) {
remove_submenu_page('woocommerce', 'wc-status');
}
}
```
if you are trying to remove core woocommerce submenu items.
(responding to Do Xuan Nguyen's comment)
| null | CC BY-SA 4.0 | null | 2022-12-12T03:57:12.203 | 2022-12-12T04:02:49.473 | 2022-12-12T04:02:49.473 | 19,446,852 | 19,446,852 | null |
74,766,569 | 2 | null | 74,766,554 | 0 | null | user sparator from select only '-----'
```
SELECT count(*) as Count_F3112 FROM PRODDTA.F3112
UNION ALL
SELECT '-----------'
UNION ALL
SELECT count(*) as Count_F4801 FROM PRODDTA.F4801
UNION ALL
SELECT '-----------'
UNION ALL
SELECT count(*) as Count_F0006 FROM PRODDTA.F0006
UNION ALL
SELECT '-----------'
SELECT count(*) as Count_F0101 FROM PRODDTA.F0101
```
| null | CC BY-SA 4.0 | null | 2022-12-12T04:16:22.783 | 2022-12-12T04:16:22.783 | null | null | 2,644,575 | null |
74,766,570 | 2 | null | 74,766,554 | 0 | null | You can use a `UNION`!
```
SELECT count(*) as Count_F3112 FROM PRODDTA.F3112 UNION
SELECT count(*) as Count_F4801 FROM PRODDTA.F4801 UNION
SELECT count(*) as Count_F0006 FROM PRODDTA.F0006 UNION
SELECT count(*) as Count_F0101 FROM PRODDTA.F0101;
```
| null | CC BY-SA 4.0 | null | 2022-12-12T04:16:22.903 | 2022-12-12T04:16:22.903 | null | null | 495,455 | null |
74,766,577 | 2 | null | 74,766,554 | 1 | null | You could use a union query:
```
SELECT COUNT(*) AS cnt, 'WO Routing' AS label FROM PRODDTA.F3112
UNION ALL
SELECT COUNT(*), 'WO Header (Master File)' FROM PRODDTA.F4801
UNION ALL
SELECT COUNT(*), 'Business Unit Master' FROM PRODDTA.F0006
UNION ALL
SELECT COUNT(*), 'Address Book Master' FROM PRODDTA.F0101;
```
| null | CC BY-SA 4.0 | null | 2022-12-12T04:17:38.387 | 2022-12-12T04:17:38.387 | null | null | 1,863,229 | null |
74,766,983 | 2 | null | 69,326,284 | 0 | null | I was having the same problem for some time now, app ads text file was not showing for one of my app in Admob, but for other apps it was visible.
Today, as I was checking the store settings of my app I realized that I was using a social media link in the place of website. I changed it immediately to my website.
After 10 minutes or so when I refreshed the Admob App Settings page, it found my app ads text file successfully.
Hope that helps!
[](https://i.stack.imgur.com/vtmxP.jpg)
| null | CC BY-SA 4.0 | null | 2022-12-12T05:36:58.173 | 2022-12-12T05:36:58.173 | null | null | 8,003,636 | null |
74,767,045 | 2 | null | 74,766,853 | 0 | null | Put if condition inside `.then` method, also you can remove `async` as you are not using `await`
```
created() {
console.log('teams list is before loading teams',this.teamsList);
this.loadTeams()
.then((response) => {
this.teamsList = response.data;
console.log('teams list is after loadteams',this.teamsList);
if (this.teamsList.teamName==='admins') {
this.haveAccess=true
console.log('access-check',this.teamsList.teamName);
}
console.log('access-check', this.haveAccess,this.teamsList);
})
.catch((error) => {
console.log(error);
});
}
```
| null | CC BY-SA 4.0 | null | 2022-12-12T05:47:05.217 | 2022-12-12T05:47:05.217 | null | null | 14,505,740 | null |
74,767,051 | 2 | null | 74,766,853 | 0 | null | An object's property can not be access directly if it is inside an array.
In your code, the `teamsList` variable is an array which is holding 3 items.
Therefore, you can not access the property `teamName` directly on that array.
If your data is dynamic then you need to loop on each time to access its property `teamName`.
```
this.teamsList.forEach(item => {
if (item.teamName === 'admins') {
this.haveAccess=true;
console.log('access-check', item.teamName);
}
})
```
If your data is fixed which means always an array of 3 items with fixed data then you can access it like this-
```
if (this.teamsList[0].teamName === 'admins') {
this.haveAccess=true;
console.log('access-check', this.teamsList[0].teamName);
}
```
| null | CC BY-SA 4.0 | null | 2022-12-12T05:48:02.813 | 2022-12-12T05:48:02.813 | null | null | 11,834,856 | null |
74,767,083 | 2 | null | 74,766,084 | 1 | null | you should go for subcollections something like as follows :
```
final docEducation = FirebaseFirestore.instance
.collection("education")
.doc(FirebaseAuth.instance.currentUser!.uid)
.collection("educations")
.doc();
```
| null | CC BY-SA 4.0 | null | 2022-12-12T05:52:49.167 | 2022-12-12T05:52:49.167 | null | null | 17,755,737 | null |
74,767,281 | 2 | null | 70,649,610 | 0 | null |
```
int x[] = {1,2,3,4,5,6,7,8,9};
int len_x = sizeof(x)/sizeof(x[0]);
cv::Mat mat3D(1,len_x, CV_32S,x);
mat3D = mat3D.reshape(3,3); //(dimension, height)
```
| null | CC BY-SA 4.0 | null | 2022-12-12T06:18:26.597 | 2022-12-12T11:47:15.183 | 2022-12-12T11:47:15.183 | 9,427,260 | 9,427,260 | null |
74,767,536 | 2 | null | 74,763,436 | 0 | null | Next to is a dropdown (see your and my screenshots). By default is selected, but you can also choose to export to Microsoft Excel or only running selected (marked) queries.
[](https://i.stack.imgur.com/chFtx.png)
| null | CC BY-SA 4.0 | null | 2022-12-12T06:50:57.373 | 2022-12-12T06:50:57.373 | null | null | 4,923,755 | null |
74,767,841 | 2 | null | 74,766,393 | 0 | null | There's no in Paramiko. It's just that Paramiko (or actually your server) can return more permissons bits than Python `stat` module can handle.
I've explained this in:
[Pysftp "cd" fails against AIX server with "OverflowError: mode out of range" error](https://stackoverflow.com/q/65832614/850848)
If you work with such server, you either have to analyze the bits without using the `stat` functions, like:
```
S_IFMT = 0o170000
(row.st_mode & S_IFMT) == stat.S_IFDIR
```
Or trim the excess bites, before passing the value to `stat` functions:
```
stat.S_ISDIR(row.st_mode & 0xFFFF)
```
---
`AutoAddPolicy`[MITM attacks](https://en.wikipedia.org/wiki/Man-in-the-middle_attack)[Paramiko "Unknown Server"](https://stackoverflow.com/q/10670217/850848#43093883).
| null | CC BY-SA 4.0 | null | 2022-12-12T07:25:03.213 | 2022-12-16T07:52:36.577 | 2022-12-16T07:52:36.577 | 850,848 | 850,848 | null |
74,767,978 | 2 | null | 74,767,824 | 0 | null |
1. less than or equal is <= - the => is called a fat arrow and used in the arrow function below
2. onclick is the event, but use an eventListener
3. You do not store the age from the input field
4. You do not have a demo element
Here is a better script. Please study it.
```
window.addEventListener("DOMContentLoaded", () => { // when the page has loaded
const findButton = document.getElementById("find");
const demo = document.getElementById("demo");
findButton.addEventListener("click", e => { // clicking the button
let msg;
let age = document.getElementById("age").value;
if (age >= 0 && age <= 2) {
msg = "Toddler";
} else if (age >= 3 && age <= 11) {
msg = "Child";
} else if (age >= 12 && age <= 17) {
msg = "Adolescent";
} else {
msg = "Adult";
}
demo.innerHTML = msg;
});
});
```
```
Age: <input type="text" id="age"> <button type="button" id="find">Find Category</button>
<span id="demo"></span>
```
| null | CC BY-SA 4.0 | null | 2022-12-12T07:40:55.813 | 2022-12-12T08:07:42.467 | 2022-12-12T08:07:42.467 | 295,783 | 295,783 | null |
74,768,198 | 2 | null | 74,768,072 | 0 | null | You can simply map it
like this :
```
let mappedData = data.map(item => {
return {
...item,
...item.attributes,
item_detail: item.attributes.item_detail ? {
...item.attributes.item_detail.data.attributes,
id: item.attributes.item_detail.data.id,
} : {},
item_dimension: item.attributes.item_dimension ? {
...item.attributes.item_dimension.data.attributes,
id: item.attributes.item_dimension.data.id,
new_unit:item.attributes.item_dimension.data.attributes.item_id.data
} : {},
is_returnable: item.attributes.is_returnable,
};
});
```
| null | CC BY-SA 4.0 | null | 2022-12-12T08:06:29.913 | 2022-12-12T13:58:57.637 | 2022-12-12T13:58:57.637 | 11,434,567 | 11,434,567 | null |
74,768,691 | 2 | null | 74,760,398 | 0 | null | @Bushmaster's solution works fine. Another option is to transpose the column, then pivot with [pivot_longer](https://pyjanitor-devs.github.io/pyjanitor/api/functions/#janitor.functions.pivot.pivot_longer) from [pyjanitor](https://pyjanitor-devs.github.io/pyjanitor/):
```
# pip install pyjanitor
import janitor
import pandas as pd
df = pd.read_csv('Downloads/original.csv')
(df
.astype({"Entry":str})
.set_index('Entry')
.T
.pivot_longer(
index=None,
ignore_index=False,
names_to = '.value',
names_pattern='(.)')
)
0 1 2 3
Blue 3/20/20 3:09 PM O 12
Red 3/20/20 9:13 PM C 0
Purple 11/26/22 3:09 PM O 34
Green 3/20/20 3:09 PM O 24
Black 3/20/20 3:09 PM O 133
Orange 3/20/20 3:09 PM O 72
Yellow 3/20/20 3:09 PM O 2
Gold 3/20/20 3:00 PM O 13
White 3/20/20 3:00 PM O 31
Silver 3/20/20 8:49 PM O 43
Bronze 3/20/20 2:22 PM C 13
Platinum 3/20/20 3:00 PM O 59
Titanium 3/20/20 3:00 PM O 63
Blue 5/1/20 9:13 PM O 23
Red 5/1/20 9:13 PM C 0
Purple 5/1/20 5:24 PM O 45
Green 5/1/20 12:09 PM O 67
Black 5/1/20 3:09 PM O 56
Orange 5/1/20 3:09 PM O 754
Yellow 5/1/20 3:09 PM O 23
Gold 5/1/20 3:00 PM O 56
White 5/1/20 3:00 PM O 121
Silver 5/1/20 8:49 PM O 92
Bronze 5/1/20 2:22 PM C 13
Platinum 5/1/20 3:00 PM O 59
Titanium 5/1/20 3:00 PM O 63
```
| null | CC BY-SA 4.0 | null | 2022-12-12T08:55:20.940 | 2022-12-12T08:55:20.940 | null | null | 7,175,713 | null |
74,769,157 | 2 | null | 74,769,057 | 1 | null | `dispersion_glmer` calculates "the square root of the penalized residual sum of squares divided by n". The result is not unit-less.
```
20.75102 * sqrt(1000)
#[1] 656.2049
```
(Machine precision and convergence issues could also play a limited role here.)
| null | CC BY-SA 4.0 | null | 2022-12-12T09:39:36.997 | 2022-12-12T10:13:11.707 | 2022-12-12T10:13:11.707 | 1,412,059 | 1,412,059 | null |
74,769,343 | 2 | null | 74,769,302 | 0 | null | Just type in REPL (or in python script) and run it:
```
x=print("whatever")
print(x)
```
`print` function has `None` as the return type, so it's expected to happen.
This:
```
data.append([ru_name, original_name, remain, rate, link])
```
Does exactly the same as this:
```
data.append([None, None, None, None, None])
```
In order to achieve what you want there are at least 2 options:
-
```
link = "https://www.kinopoisk.ru"+e.find('a',class_= 'base-movie-main-info_link__YwtP1').get('href')
print(link)
```
-
```
print(f"{(link:='<your_whole_string_goes_here>')}")
```
And then append as you do right now (no changes required, since in both cases `link` is your string, not a `None` anymore.
| null | CC BY-SA 4.0 | null | 2022-12-12T09:57:25.357 | 2022-12-12T10:10:01.937 | 2022-12-12T10:10:01.937 | 17,507,911 | 15,923,186 | null |
74,769,403 | 2 | null | 74,769,302 | 0 | null | The print function returns `None` so any value given to the print function just returns None. So `ru_name = print(e.find(...)` also return the None. Means `ru_name` is set to `None`.
```
data = []
for e in movie:
ru_name = e.find(...
original_name = e.find(...
remain = e.find(...
rate = e.find(...
link = "https://ww.kinopoisk.ru" + e.find(...
## if you also want to print these then
print(ru_name)
print(original_name)
print(remain)
print(rate)
print(link)
## Append to the list
data.append([ru_name, original_name, remain, rate, link])
```
| null | CC BY-SA 4.0 | null | 2022-12-12T10:03:01.750 | 2022-12-12T10:03:01.750 | null | null | 17,507,911 | null |
74,770,268 | 2 | null | 17,237,812 | 0 | null | This is a simple css solution:
```
.dataTables_scroll {
overflow:auto;
display:inline-block
}
```
| null | CC BY-SA 4.0 | null | 2022-12-12T11:13:21.630 | 2022-12-18T05:25:39.117 | 2022-12-18T05:25:39.117 | 3,945,675 | 8,803,610 | null |
74,770,411 | 2 | null | 74,406,010 | 0 | null | check type with these code.
```
const vnodeList = this.$slots.default()
const childList = []
let existNonValidSubCom = false
let i = 0
do {
const vnode = vnodeList[i]
// html tag
if (typeof vnode.type === 'string') {
existNonValidSubCom = true
break
} else if ([TabHeader, TabContent].includes(vnode.type)) {
childList.push(vnode)
}
else if (typeof vnode.type === 'symbol' && Array.isArray(vnode.children)) {
// Symbol(Fragment)
// childList.push(h(vnode.type, null, vnode.children))
vnode.children.forEach(child => {
if ([TabHeader, TabContent].includes(child.type)) {
childList.push(child)
}
})
}
else if (typeof vnode.type === 'symbol' && typeof vnode.children === 'string') {
// Symbol(Comment) skip
} else {
existNonValidSubCom = true
break
}
} while (++i < vnodeList.length && !existNonValidSubCom)
```
| null | CC BY-SA 4.0 | null | 2022-12-12T11:26:40.893 | 2022-12-12T11:26:40.893 | null | null | 6,524,962 | null |
74,770,565 | 2 | null | 26,926,888 | 1 | null | select folder -> File -> File Properties -> Line Separator -> LF
All files will be markd as `changed`.
Make regular commit with line separator changes ounly.
It will fail but `changed` marks will disappear.
New files will inherit folder property.
| null | CC BY-SA 4.0 | null | 2022-12-12T11:40:12.227 | 2022-12-28T15:14:24.533 | 2022-12-28T15:14:24.533 | 13,550,483 | 13,550,483 | null |
74,771,010 | 2 | null | 66,934,688 | 0 | null | You have to modify this code as follow:
```
SELECT (
(
SELECT SUM(CO.CANTIDAD)
FROM CLIENTE CL
JOIN COMPRA CO ON CO.DNI = CL.DNI
)
-
(
SELECT SUM(CO.CANTIDAD)
FROM CLIENTE CL
JOIN COMPRA CO ON CO.DNI = CL.DNI
JOIN PRODUCTO PR ON PR.IDP = CO.IDP
JOIN CATEGORIA CA ON CA.IDC = PR.IDC
WHERE CA.CATEGORIA = 'PANADERIA'
)
) from dual
```
| null | CC BY-SA 4.0 | null | 2022-12-12T12:19:46.547 | 2022-12-12T12:20:17.470 | 2022-12-12T12:20:17.470 | 17,721,156 | 17,721,156 | null |
74,771,206 | 2 | null | 45,122,179 | 0 | null | In navigation 6x, you can do the following to get the drawer status.
```
import { useDrawerStatus } from '@react-navigation/drawer';
const isDrawerOpen = useDrawerStatus() === 'open';
```
here is the full documentation. [https://reactnavigation.org/docs/drawer-navigator/#events](https://reactnavigation.org/docs/drawer-navigator/#events)
| null | CC BY-SA 4.0 | null | 2022-12-12T12:36:40.267 | 2022-12-12T12:36:40.267 | null | null | 17,318,037 | null |
74,771,227 | 2 | null | 66,934,688 | 0 | null | According to your description, you just want `CA.CATEGORIA != 'PANADERIA'`
```
SELECT SUM(CO.CANTIDAD)
FROM CLIENTE CL
JOIN COMPRA CO ON CO.DNI = CL.DNI
JOIN PRODUCTO PR ON PR.IDP = CO.IDP
JOIN CATEGORIA CA ON CA.IDC = PR.IDC
WHERE CA.CATEGORIA != 'PANADERIA'
```
| null | CC BY-SA 4.0 | null | 2022-12-12T12:39:02.597 | 2022-12-12T12:39:02.597 | null | null | 53,341 | null |
74,771,441 | 2 | null | 74,337,089 | -1 | null | I think it's a problem witht he define part, cause this is happening me too and it worked fine until I added define
| null | CC BY-SA 4.0 | null | 2022-12-12T12:56:00.867 | 2022-12-12T12:56:00.867 | null | null | 20,756,847 | null |
74,771,519 | 2 | null | 71,436,876 | 0 | null | You can fix your code by only adding this line to your code
```
options.set_capability("browserVersion", "98")
```
| null | CC BY-SA 4.0 | null | 2022-12-12T13:02:29.513 | 2022-12-12T13:07:23.030 | 2022-12-12T13:07:23.030 | 4,826,457 | 19,281,233 | null |
74,771,613 | 2 | null | 74,760,135 | 0 | null | Thanks to @ardget it works now, so I'll post the working code here in case someone needs it too.
The problem was that I didn't divide the result by the third vector component.
```
public static Vector2 ProjectiveTransform(Vector2 input, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 q1, Vector2 q2, Vector2 q3, Vector2 q4)
{
// 8x8 Matrix
float[][] A = new float[8][]
{
new float[8] { p1.x, p1.y, 1, 0, 0, 0, -p1.x * q1.x, -p1.y * q1.x },
new float[8] { 0, 0, 0, p1.x, p1.y, 1, -p1.x * q1.y, -p1.y * q1.y },
new float[8] { p2.x, p2.y, 1, 0, 0, 0, -p2.x * q2.x, -p2.y * q2.x },
new float[8] { 0, 0, 0, p2.x, p2.y, 1, -p2.x * q2.y, -p2.y * q2.y },
new float[8] { p3.x, p3.y, 1, 0, 0, 0, -p3.x * q3.x, -p3.y * q3.x },
new float[8] { 0, 0, 0, p3.x, p3.y, 1, -p3.x * q3.y, -p3.y * q3.y },
new float[8] { p4.x, p4.y, 1, 0, 0, 0, -p4.x * q4.x, -p4.y * q4.x },
new float[8] { 0, 0, 0, p4.x, p4.y, 1, -p4.x * q4.y, -p4.y * q4.y }
};
// Vector 8
float[][] B = new float[8][]
{
new float[1] { q1.x },
new float[1] { q1.y },
new float[1] { q2.x },
new float[1] { q2.y },
new float[1] { q3.x },
new float[1] { q3.y },
new float[1] { q4.x },
new float[1] { q4.y }
};
// Vector 8
float[][] x = MatrixMath.MatrixProduct(MatrixMath.MatrixInverse(A), B);
// 3x3 Matrix
float[][] T = new float[3][]
{
new float[3] {x[0][0], x[1][0], x[2][0]},
new float[3] {x[3][0], x[4][0], x[5][0]},
new float[3] {x[6][0], x[7][0], 1}
};
// Vector 3
float[][] inputMatrix = new float[3][]
{
new float[1] { input.x },
new float[1] { input.y },
new float[1] { 1 }
};
// q = T*p
// Vector 3
float[][] outputMatrix = MatrixMath.MatrixProduct(T, inputMatrix);
float W = outputMatrix[2][0];
return new Vector2(outputMatrix[0][0] / W, outputMatrix[1][0] / W);
}
```
| null | CC BY-SA 4.0 | null | 2022-12-12T13:10:25.673 | 2022-12-12T13:10:25.673 | null | null | 20,747,667 | null |
74,771,824 | 2 | null | 74,759,604 | 1 | null | It's not possible to say why that's happening from the code you've shown, but there is some "code smell": some things that look odd that may or may not be contributing.
For example:
```
stock.PriceChanged += async (sender1, args) => await updatePrice(sender1, args);
stock.LastCandleChanged += async (sender2, args) => await updateLastCandle(sender2, args);
```
In these lines, you're creating an `async void` anonymous method (with `async (sender1, args)`) to call a single async method. That adds one method to the call stack unnecessarily, but along with it all the computation required to make an extra async method work. You're better off just declaring those event handler methods as `async void` (the only acceptable use of `async void` is for event handlers) and use them directly.
Then there is also this, which is the "unnecessary context changes and marshalling" that Paulo is talking about in the comment:
```
await Task.Run(() => {
this.BeginInvoke(new Action(() => {
priceLbl.Text = price.ToString();
}));
});
```
Calling [Task.Run()](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task.run) tells it to run the code in a different thread, but then you immediately use `BeginInvoke()` to tell it to run the code in the UI thread. So both of those calls become useless because you end up back on the same thread you started from (the UI thread).
Applying those two suggestions, you'd end up with this:
```
stock.PriceChanged += updatePrice;
stock.LastCandleChanged += updateLastCandle;
public async void updatePrice(object sender, decimal price) {
if (this.Visible) // to avoid invoking when form is closed
{
priceLbl.Text = price.ToString();
}
}
public async void updateLastCandle(object sender, Candles candle) {
if (this.Visible) // to avoid invoking when form is closed
{
updateChart();
}
}
```
And the reason Paulo asked for the implementation of `updateChart()` is because it could be something in there that is preventing the text price from updating, since you say that the text stops updating when the chart is updating.
| null | CC BY-SA 4.0 | null | 2022-12-12T13:26:49.560 | 2022-12-12T13:26:49.560 | null | null | 1,202,807 | null |
74,771,887 | 2 | null | 74,771,437 | 0 | null | I pass a parameter like this:
my call to the API:
```
const getDetails = (id) => {
return api.Get(`/api/details/${id}`);
}
```
then in the react code
```
const getInfo = async(e) => {
apiCall.GetDetails(value to be passed here)
}
```
| null | CC BY-SA 4.0 | null | 2022-12-12T13:32:26.827 | 2022-12-12T13:32:26.827 | null | null | 8,382,717 | null |
74,771,950 | 2 | null | 74,769,431 | 3 | null | You could call [Animation#commitStyles()](https://developer.mozilla.org/en-US/docs/Web/API/Animation/commitStyles) after the animation completes, so that its state is "written" to your player.
You now need to come back to the default `composite: "replace"` option, and you also need to modify your initial player settings so that it's positioned using CSS `translate()` instead of using its `cx` and `cy` values (or you could also modify your calculations so they return relative positions instead).
```
let field = document.getElementById("FIELD");
let player = field.getElementById("player");
function getCenter(el, { left, top, width, height } = el.getBoundingClientRect()) {
let point = Object.assign(field.createSVGPoint(), {
x: left + width / 2,
y: top + height / 2
}).matrixTransform(field.getScreenCTM().inverse());
return {
cx: ~~point.x,
cy: ~~point.y
};
}
async function runto(destination) {
let { cx: playerX, cy: playerY } = getCenter(player);
let { cx: baseX, cy: baseY } = getCenter(field.getElementById(destination));
let translateX = baseX - playerX;
let translateY = baseY - playerY;
let track = `<line x1="${playerX}" y1="${playerY}" x2="${baseX}" y2="${baseY}" stroke-width="10" stroke="black"/>`;
field.insertAdjacentHTML("beforeend", track);
const anim = player.animate([{
transform: `translate(${baseX}px,${baseY}px)`
}], {
duration: 500,
fill: "forwards"
});
await anim.finished;
anim.commitStyles(); // write the current state to the animated element
anim.cancel(); // no need to keep it around anymore
}
runto("first").then(() => runto("second"));
```
```
<style>
#FIELD {
background: lightgreen;
width: 150px;
margin: 20px
}
</style>
<svg id=FIELD viewBox="0 0 250 250" transform="rotate(45)">
<g fill="brown">
<path id="home" d="M 150 150 h 80 v 80 h -80 v -80z" fill="green"/>
<path id="first" d="M 150 20 h 80 v 80 h -80 v -80z"/>
<path id="second" d="M 20 20 h 80 v 80 h -80 v -80z"/>
<path id="third" d="M 20 150 h 80 v 80 h -80 v -80z"/>
</g>
<circle id="player" cx="0" cy="0" r="30" style="transform:translate(190px, 190px)" fill="gold"/>
</svg>
```
| null | CC BY-SA 4.0 | null | 2022-12-12T13:37:54.177 | 2022-12-12T13:37:54.177 | null | null | 3,702,797 | null |
74,772,032 | 2 | null | 74,771,980 | 4 | null | You can reverse the order of the stack by using `position_stack(reverse = TRUE)`:
```
set.seed(123)
library(tidyr)
library(ggplot2)
library(dplyr)
df %>% pivot_longer(cols = starts_with("item")) %>%
group_by(name) %>%
count(value) %>%
mutate(perc = 100 / sum(n) * n) %>%
ungroup() %>%
mutate(value = factor(value, levels = c(1:5, 99), labels = c("--", "-", "0", "+", "++", "NA"))) %>%
ggplot(aes(x = name, y = perc, fill = value)) +
geom_col(position = position_stack(reverse = TRUE)) +
coord_flip()
```

| null | CC BY-SA 4.0 | null | 2022-12-12T13:45:35.807 | 2022-12-12T13:45:35.807 | null | null | 12,993,861 | null |
74,772,433 | 2 | null | 74,191,324 | 0 | null | Upgraded android gradle plugin >= 7.1.0 and the problem is solved.
```
classpath "com.android.tools.build:gradle:7.1.0"
```
| null | CC BY-SA 4.0 | null | 2022-12-12T14:15:27.660 | 2022-12-12T14:15:27.660 | null | null | 11,306,878 | null |
74,772,751 | 2 | null | 73,434,862 | 1 | null | You need to import `fyne.io/fyne/v2` in our code like this:
```
package main
import (
"fyne.io/fyne/v2" // add this line to your code
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Hello World")
w.SetContent(widget.NewLabel("Hello World!"))
w.ShowAndRun()
}
```
| null | CC BY-SA 4.0 | null | 2022-12-12T14:37:57.573 | 2022-12-12T14:37:57.573 | null | null | 18,370,330 | null |
74,772,948 | 2 | null | 64,997,553 | 0 | null | If you have a USB drive plugged in with an unrecognized file system, then VS code can't run notebooks because the "jupyter notebook" command crashes
| null | CC BY-SA 4.0 | null | 2022-12-12T14:52:09.580 | 2022-12-12T14:52:09.580 | null | null | 5,060,605 | null |
74,773,037 | 2 | null | 74,772,841 | 0 | null | I am assuming that your dataframe looks as it does in the screenshot.
You can forward fill the null values in column `A` and then concatenate the values from both columns. Since column `B` seems to be empty when `A` has a value, you can get rid of these rows to get the result in the bullet list.
```
# Fill null values forward
df['A'] = df['A'].ffill()
# Concatenate `B` and `A`
df['new_col'] = df['B'].astype(str) + df['A'].astype(str)
# Get rid of rows where `B` is empty
df = df[df['B'].notna()]
```
| null | CC BY-SA 4.0 | null | 2022-12-12T14:59:06.717 | 2022-12-12T14:59:06.717 | null | null | 9,795,817 | null |
74,773,158 | 2 | null | 74,769,057 | 1 | null | This is really a statistical question. (there may be some rare exceptions ...)
At a quick glance, it looks like a square-root-transformed linear mixed model would probably be fine for this.
```
gg0 <- ggplot(d_example, aes(plate, prop_ul)) + geom_point() +
geom_line(aes(group=treatment))
gg0 + scale_y_sqrt()
gg0 + scale_y_log10()
```
You could also fit a Beta model (in `brms` or `glmmTMB`) or a quasi-binomial model (`glmer` doesn't do quasi-binomial but there is [code in the GLMM FAQ](https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#fitting-models-with-overdispersion) which shows how to compute the quasi-likelihood standard errors/p-values), if you think the denominators are likely to affect the variances.
It is also the case that a binomial model without some kind of overdispersion correction is likely to be ridiculously optimistic when the counts are large.
| null | CC BY-SA 4.0 | null | 2022-12-12T15:07:18.380 | 2022-12-12T16:21:45.033 | 2022-12-12T16:21:45.033 | 190,277 | 190,277 | null |
74,773,583 | 2 | null | 74,771,236 | 10 | null | The problem is that you're expecting a `double` to be able to store an value to a given number of digits.
The precise `double` value closest to 153.4 is 153.400000000000005684341886080801486968994140625 - which is being displayed as 153.40000000000001.
There's nothing more that `Math.Round` can do there - there's no `double` value closer to 153.4.
If this is just for formatting purposes, you should to 2 decimal places rather than rounding the data.
If the actual value matters, and you want precise decimal values, you should use `decimal` instead of `double`.
| null | CC BY-SA 4.0 | null | 2022-12-12T15:39:04.620 | 2022-12-12T15:39:04.620 | null | null | 22,656 | null |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.