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,557,220 | 2 | null | 74,557,158 | 1 | null | Do yourself a favor and watch a YouTube video on how to debug in Visual Studio!
What you need to do is put a Breakpoint on this line:
```
cartprice = Price * numQuantity.Text
```
> convert a string to double
You're multplying a number by a String! You want to do something like this:
```
cartprice = Price * Convert.ToDouble(numQuantity.Text)
```
I'd personally do a `double.TryParse` to see if its valid and use the output value when performing the operation.
PS: As a challenge , try and move all the code logic to a Business Logic class, then use Bingings/BindingControls so the Presentation layer is separated from the logic. That way you can Unit Test the business logic layer!
| null | CC BY-SA 4.0 | null | 2022-11-24T07:43:07.177 | 2022-11-24T07:52:45.847 | 2022-11-24T07:52:45.847 | 495,455 | 495,455 | null |
74,557,260 | 2 | null | 60,547,348 | 1 | null | you should use StiLicense.Key on your controller constructor
| null | CC BY-SA 4.0 | null | 2022-11-24T07:47:47.083 | 2022-11-24T07:47:47.083 | null | null | 3,643,534 | null |
74,557,270 | 2 | null | 74,557,178 | 2 | null | Do not use functions like `ta.highest` in a local scope. You will break the history and get unreliable return values. Instead, put it in global scope and use its value conditionally.
Also, if you want your lines to be shown as in your screenshot, you need to use the `offset` argument of the `plot()`. Because you want to draw something on the past bars.
```
//@version=5
indicator(title='Test-1', shorttitle='Test-1', overlay=true, timeframe='')
barLength = input.int(50,minval=1,title='Length')
h = ta.highest(barLength)
var float higher = 0
var counter = 0
counter := counter + 1
if counter == barLength
counter := 0
higher := h
counterPlot = plot(higher, title = 'higher', color = color.new(color.green,0), offset=-barLength)
bgcolor((counter == 0) ? color.new(color.blue, 85) : na)
```
[](https://i.stack.imgur.com/TiAGr.png)
| null | CC BY-SA 4.0 | null | 2022-11-24T07:48:41.697 | 2022-11-24T08:46:25.393 | 2022-11-24T08:46:25.393 | 7,209,631 | 7,209,631 | null |
74,557,623 | 2 | null | 17,821,828 | 0 | null | I use the following c# class to scale between 3 colours (typically red for negative, yellow for the mid point and green for positive numbers:
```
using System.Drawing;
namespace Utils.Maths;
public class ColourScaler
{
public static (int r, int g, int b) HighestColor = (99, 190, 123);
public static (int r, int g, int b) MidColor = (255, 235, 132);
public static (int r, int g, int b) LowestColor = (248, 105, 107);
public double MidValue { get; set; } = 0;
public double HighestValue { get; set; } = 0;
public double LowestValue { get; set; } = 0;
public IEnumerable<double> Values
{
set
{
var items = value.OrderBy(o => o).Distinct().ToArray();
if (items.Length > 0)
{
LowestValue= items[0];
HighestValue = items[items.Length - 1];
}
}
}
public ColourScaler(IEnumerable<double>? values = null, double midValue = 0)
{
Values = values ?? Enumerable.Empty<double>();
MidValue = midValue;
}
public (int r, int g, int b) GetRgb(double value)
{
if (value < LowestValue || value > HighestValue)
throw new ArgumentOutOfRangeException().AddData("value", value);
if (value >= 0)
{
if (HighestValue - MidValue == 0)
return HighestColor;
var ratio = (value - MidValue) / (HighestValue - MidValue);
var r = (int)(MidColor.r - (MidColor.r - HighestColor.r) * ratio);
var g = (int)(MidColor.g - (MidColor.g - HighestColor.g) * ratio);
var b = (int)(MidColor.b - (MidColor.b - HighestColor.b) * ratio);
return (r, g, b);
}
else
{
if (MidValue - LowestValue == 0)
return LowestColor;
var ratio = (MidValue - value) / (MidValue - LowestValue);
var r = (int)(MidColor.r - (MidColor.r - LowestColor.r) * ratio);
var g = (int)(MidColor.g - (MidColor.g - LowestColor.g) * ratio);
var b = (int)(MidColor.b - (MidColor.b - LowestColor.b) * ratio);
return (r, g, b);
}
}
public Color GetColour(double value)
{
var rgb = GetRgb(value);
return Color.FromArgb(rgb.r, rgb.g, rgb.b);
}
}
```
And here are some tests:
```
namespace Tests.ColourScaler;
[TestClass]
public class ColourScalerTests
{
[TestMethod]
public void ColourScaler_Values()
{
var item = new ColourScaler { Values = new double[] { 13, -2, -3, 4, 3, -3, 4, 1, 0 } };
Assert.AreEqual(-3, item.LowestValue);
Assert.AreEqual(0, item.MidValue);
Assert.AreEqual(13, item.HighestValue);
item = new ColourScaler { Values = new double[] { } };
Assert.AreEqual(0, item.LowestValue);
Assert.AreEqual(0, item.MidValue);
Assert.AreEqual(0, item.HighestValue);
}
[TestMethod]
public void ColourScaler_New()
{
var item = new ColourScaler(new double[] { 13, -2, -3, 4, 3, -3, 4, 1, 0 }, 1);
Assert.AreEqual(-3, item.LowestValue);
Assert.AreEqual(1, item.MidValue);
Assert.AreEqual(13, item.HighestValue);
item = new ColourScaler(new double[] { 13, -2, -3, 4, 3, -3, 4, 1, 0 });
Assert.AreEqual(-3, item.LowestValue);
Assert.AreEqual(0, item.MidValue);
Assert.AreEqual(13, item.HighestValue);
item = new ColourScaler(new double[] { });
Assert.AreEqual(0, item.LowestValue);
Assert.AreEqual(0, item.MidValue);
Assert.AreEqual(0, item.HighestValue);
}
[TestMethod]
public void ColourScaler_GetRgb()
{
var item = new ColourScaler { Values = new double[] { -7, -5, -3, -1, 0, 2, 4, 6 } };
var rgb = item.GetRgb(-7);
Assert.AreEqual(248, rgb.r);
Assert.AreEqual(105, rgb.g);
Assert.AreEqual(107, rgb.b);
rgb = item.GetRgb(-6);
Assert.AreEqual(249, rgb.r);
Assert.AreEqual(123, rgb.g);
Assert.AreEqual(110, rgb.b);
rgb = item.GetRgb(-5);
Assert.AreEqual(250, rgb.r);
Assert.AreEqual(142, rgb.g);
Assert.AreEqual(114, rgb.b);
rgb = item.GetRgb(-2);
Assert.AreEqual(253, rgb.r);
Assert.AreEqual(197, rgb.g);
Assert.AreEqual(124, rgb.b);
rgb = item.GetRgb(-1);
Assert.AreEqual(254, rgb.r);
Assert.AreEqual(216, rgb.g);
Assert.AreEqual(128, rgb.b);
rgb = item.GetRgb(0);
Assert.AreEqual(255, rgb.r);
Assert.AreEqual(235, rgb.g);
Assert.AreEqual(132, rgb.b);
rgb = item.GetRgb(1);
Assert.AreEqual(229, rgb.r);
Assert.AreEqual(227, rgb.g);
Assert.AreEqual(130, rgb.b);
rgb = item.GetRgb(2);
Assert.AreEqual(203, rgb.r);
Assert.AreEqual(220, rgb.g);
Assert.AreEqual(129, rgb.b);
rgb = item.GetRgb(4);
Assert.AreEqual(151, rgb.r);
Assert.AreEqual(205, rgb.g);
Assert.AreEqual(126, rgb.b);
rgb = item.GetRgb(5);
Assert.AreEqual(125, rgb.r);
Assert.AreEqual(197, rgb.g);
Assert.AreEqual(124, rgb.b);
rgb = item.GetRgb(6);
Assert.AreEqual(99, rgb.r);
Assert.AreEqual(190, rgb.g);
Assert.AreEqual(123, rgb.b);
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-24T08:20:20.090 | 2022-11-24T08:39:53.813 | 2022-11-24T08:39:53.813 | 3,714,181 | 3,714,181 | null |
74,558,402 | 2 | null | 62,915,300 | 1 | null | The `tabularray` package makes merging cells very easy:
```
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\noindent%
\begin{tblr}{
colspec={lXc},
vlines,
hlines
}
\SetCell[r=2]{} some text & \SetCell[r=2]{} some long text some long text some long text & short text\\
&& short text\\
\end{tblr}
\end{document}
```
| null | CC BY-SA 4.0 | null | 2022-11-24T09:27:36.700 | 2022-11-24T09:27:36.700 | null | null | 2,777,074 | null |
74,558,722 | 2 | null | 74,558,282 | 1 | null | if you have Excel 365 current channel you can use this formula to return both values:
```
=LET(data,A1:D5,
selectMonth,B7,
dataMonth,CHOOSECOLS(data,1,MATCH(selectMonth,CHOOSEROWS(data,1),0)),
TAKE(SORT(dataMonth,2,-1),2))
```
The basic idea is to first reduce the data range to the first column and the month that should be evaluated.
Then sort that "range" descending by the months values (= column 2 of new range) and take the first 2 rows (including header) - as this is the max value.
[](https://i.stack.imgur.com/yIXwr.png)
| null | CC BY-SA 4.0 | null | 2022-11-24T09:51:41.170 | 2022-11-24T09:51:41.170 | null | null | 16,578,424 | null |
74,558,759 | 2 | null | 66,860,765 | 0 | null | ```
sortComparator: (v1, v2) => parseInt(v1) - parseInt(v2),
```
work for me
| null | CC BY-SA 4.0 | null | 2022-11-24T09:54:37.593 | 2022-11-28T10:43:55.323 | 2022-11-28T10:43:55.323 | 20,241,005 | 20,589,548 | null |
74,559,167 | 2 | null | 72,632,199 | 1 | null | Had the same warning since upgrading our GitHub Enterprise to `3.6.3` on one of our repos.
Turns out that one of the files within the repo contains a reference to a file which is no longer in the master branch. For me, it was simply that the readme was pointing to an image file which was no longer present. Where you have 'none', mine had reference to an `svg` file. If you do a text search for 'none' you might find where the problem is.
The fix was is to simply remove the reference to the missing file or re-add it back to the affected branch.
Looks like the official GHE v3.6.x [release notes](https://docs.github.com/en/[email protected]/admin/release-notes) have now been updated to include the following which I believe is the cause of this experience:
> Following an upgrade to GitHub Enterprise Server 3.6 or later, existing inconsistencies in a repository such as broken refs or missing objects, may now be reported as errors like invalid sha1 pointer 0000000000000000000000000000000000000000, Zero-length loose reference file, or Zero-length loose object file. Previously, these indicators of repository corruption may have been silently ignored. GitHub Enterprise Server now uses an updated Git version with more diligent error reporting enabled. For more information, see this upstream commit in the Git project.
| null | CC BY-SA 4.0 | null | 2022-11-24T10:23:37.773 | 2022-11-30T16:08:51.977 | 2022-11-30T16:08:51.977 | 6,742,821 | 6,742,821 | null |
74,559,339 | 2 | null | 58,613,492 | 0 | null | Too late for this answer :)
After trying all the possible solutions, this worked for me:
The solution, that works for me:
>
1. create a file named jest/mocks/@react-native-firebase/crashlytics.js
> `export default () => ({ log: jest.fn(), recordError: jest.fn(), });`
>
1. create a file named jest/jestSetupFile.js
> `import mockFirebaseCrashlytics from './mocks/@react-native-firebase/crashlytics';`
> > `jest.mock('@react-native-firebase/crashlytics', () => mockFirebaseCrashlytics);`
>
1. in package.json add
> `"jest": { "setupFiles": ["./jest/jestSetupFile.js"] },`
| null | CC BY-SA 4.0 | null | 2022-11-24T10:36:04.450 | 2022-11-24T10:36:04.450 | null | null | 7,574,428 | null |
74,559,397 | 2 | null | 74,545,965 | 1 | null | Solution is to reinstall vscode with deb package from official website. See the edited part of the question.
| null | CC BY-SA 4.0 | null | 2022-11-24T10:40:10.957 | 2022-11-24T10:40:10.957 | null | null | 20,581,105 | null |
74,559,583 | 2 | null | 74,559,111 | 0 | null | Here is a proposition using standard [pandas frame's](https://pandas.pydata.org/docs/reference/frame.html) functions :
```
import pandas as pd
import numpy as np
def flag_delete(df):
df.insert(0, "temp_col", df.groupby("Col_A")["Col_A"].transform("count"))
df.loc[df.pop("temp_col").eq(1), df.columns!="Col_A"] = "DELETE"
return df
def format_dates(df):
temp_df = df.select_dtypes('datetime64')
df[temp_df.columns] = temp_df.apply(lambda x: x.dt.strftime('%d-%b-%Y'))
return df
df= (
pd.read_excel("BrunoA.xlsx", header=None, dtype=str)
.assign(Col_A= lambda x: pd.Series(np.where(~x[0].str.contains("\d{4}-\d{2}-\d{2}", regex=True), x[0], np.NaN)).ffill(),
Col_B= lambda x: np.where(x[0].str.contains("\d{4}-\d{2}-\d{2}", regex=True), x[0], np.NaN))
.drop(columns=0)
.drop_duplicates()
.apply(lambda _: pd.to_datetime(_, format='%Y-%m-%d', errors="ignore"))
.pipe(format_dates)
.pipe(flag_delete)
.dropna()
.rename(columns={"Col_A": -1, "Col_B": 0})
.sort_index(axis=1)
.reset_index(drop=True)
)
display(df)
```
#### # Output :
[](https://i.stack.imgur.com/Hw9R9.png)
| null | CC BY-SA 4.0 | null | 2022-11-24T10:54:12.710 | 2022-11-24T11:33:45.347 | 2022-11-24T11:33:45.347 | 16,120,011 | 16,120,011 | null |
74,559,943 | 2 | null | 74,544,910 | 0 | null | As I can see from your screenshots you are having problem with the horizontally stacked views
Instead of a container view you can use to embed in your and Buttons and give for the StackView with its SuperView. Also you can add desired spacing between items inside the UIStackView.
You can repeat the same method for the social sign in buttons below also.
Hope this helps!
| null | CC BY-SA 4.0 | null | 2022-11-24T11:20:54.860 | 2022-11-24T11:20:54.860 | null | null | 6,081,374 | null |
74,560,791 | 2 | null | 9,034,999 | 1 | null | Did you save the file?
when it happened to me, I found out that I had just turned off the "Auto Save" in my editor (VSCode), everything got back to normal when I turned it on again...
| null | CC BY-SA 4.0 | null | 2022-11-24T12:27:46.020 | 2022-11-24T12:27:46.020 | null | null | 19,942,211 | null |
74,561,291 | 2 | null | 17,941,083 | 0 | null | This should work :
```
plt.legend(YourDataFrame.columns)
```
| null | CC BY-SA 4.0 | null | 2022-11-24T13:06:39.030 | 2022-11-30T23:10:20.373 | 2022-11-30T23:10:20.373 | 17,561,930 | 19,661,245 | null |
74,561,319 | 2 | null | 28,597,243 | 1 | null | [As others pointed out](https://stackoverflow.com/a/64901035/7580760), setting a footer view no longer removes the last separator on iOS 15+. By pushing the separator out of frame, we can achieve the same result. This is my general solution:
```
if indexPath == tableView.lastCellIndexPath {
// Push the separator line out of frame
cell.separatorInset = UIEdgeInsets(top: 0, left: tableView.bounds.width + 1, bottom: 0, right: 0)
} else {
cell.separatorInset = .zero
}
```
With `UITableView` extension:
```
extension UITableView {
/// Calculates the last cell index path if available
var lastCellIndexPath: IndexPath? {
for section in (0..<self.numberOfSections).reversed() {
let rows = numberOfRows(inSection: section)
guard rows > 0 else { continue }
return IndexPath(row: rows - 1, section: section)
}
return nil
}
}
```
## Caveat
This solution won't work when you're not reloading the entire table view or cells are moved in the last index path. Also, it turns out if you're using Diffable Data Sources and try to reload the previous last items, this reload will happen in the cell provider before the table view data source reports the updated `numberOfRows`. I could not figure out an easy way around that so far.
| null | CC BY-SA 4.0 | null | 2022-11-24T13:09:07.507 | 2022-11-25T14:01:40.617 | 2022-11-25T14:01:40.617 | 7,580,760 | 7,580,760 | null |
74,561,364 | 2 | null | 74,393,295 | 0 | null | I wasn't running the app in Xcode using Debug-mode.
| null | CC BY-SA 4.0 | null | 2022-11-24T13:12:55.377 | 2022-11-24T13:12:55.377 | null | null | 9,451,152 | null |
74,561,556 | 2 | null | 74,559,296 | 2 | null | `<202b>` is how Vim represents the character [U+202B](https://unicode-table.com/en/202B/), the presence of which kind of makes sense because your data appears to be a mix of left-to-right and right-to-left scripts.
You can't search it with `/<202b>` because the characters `<202b>` are not actually in the text, it is just how Vim displays the character `U+202B` when it encounters it.
You can:
- `<C-v>u202b``:help i_ctrl-v_digit`- `/\%u202b``:help /\%u`
[](https://i.stack.imgur.com/hSRnA.gif)
As for getting rid of them… it depends on whether they are here accidentally or purposely.
| null | CC BY-SA 4.0 | null | 2022-11-24T13:28:36.100 | 2022-11-24T13:33:47.443 | 2022-11-24T13:33:47.443 | 546,861 | 546,861 | null |
74,561,756 | 2 | null | 74,443,198 | 0 | null | `current_user_can('edit_post')` is no longer valid in WordPress 6.1. [Here's the relevant core trac ticket.](https://core.trac.wordpress.org/ticket/56962)
You must now use one of these formats:
```
current_user_can( 'edit_posts' );
current_user_can( 'edit_post', $post->ID );
current_user_can( 'edit_post_meta', $post->ID, $meta_key );
```
| null | CC BY-SA 4.0 | null | 2022-11-24T13:44:08.453 | 2022-11-24T13:44:08.453 | null | null | 1,741,346 | null |
74,561,918 | 2 | null | 19,452,244 | 0 | null | You can use the [Git References API](https://docs.github.com/en/rest/git/refs).
This can return also all the tags matching a certain prefix.
In you case, you probably want something like:
```
https://api.github.com/repos/rails/rails/git/matching-refs/tags/v
```
Or in the case of a monorepo:
```
https://api.github.com/repos/grafana/loki/git/matching-refs/tags/helm-loki-
```
:
- [semver](https://semver.org/)-
- -
| null | CC BY-SA 4.0 | null | 2022-11-24T13:58:15.367 | 2022-11-24T15:12:59.653 | 2022-11-24T15:12:59.653 | 454,103 | 454,103 | null |
74,562,592 | 2 | null | 74,562,415 | 1 | null | You are creating the new array `newArray` in `AddByteToArray` and return it. But at the call site you are never using this returned value and the `bytePic` array remains unchanged.
The code in `AddByteToArray` makes no sense. Why create a new array when the intention was to insert one byte into an existing array? What you need to do is to cast the `int` into `byte`. Simply write:
```
byte[] bytePic = new byte[arrPic.Length];
for (int i = 0; i < arrPic.Length; i++)
{
bytePic[i] = (byte)arrPic[i];
}
```
And delete the method `AddByteToArray`.
This assumes that every value in the `int` array is in the range 0 to 255 and therefore fits into one byte.
There are different ways to do this. With LINQ you could also write:
```
byte[] bytePic = arrPic.Select(i => (byte)i).ToArray();
```
| null | CC BY-SA 4.0 | null | 2022-11-24T14:51:02.390 | 2022-11-24T15:01:58.260 | 2022-11-24T15:01:58.260 | 880,990 | 880,990 | null |
74,562,680 | 2 | null | 74,562,415 | 0 | null | I would assume your original array uses a int to represent a full RGBA-pixel, since 32bit per pixel mono images are very rare in my experience. And if you do have such an image, you probably want to be more intelligent in how you do this conversion. The only time just casting int to bytes would be a good idea is if you are sure only the lower 8 bits are used, but if that is the case, why are you using an int-array in the first place.
If you actually have RGBA-pixles you do not want to convert individual int-values to bytes, but rather convert a single int value to 4 bytes. And this is not that difficult to do, you just need to use the right methods. The old school options is to use [Buffer.BlockCopy](https://learn.microsoft.com/en-us/dotnet/api/system.buffer.blockcopy?redirectedfrom=MSDN&view=net-7.0#System_Buffer_BlockCopy_System_Array_System_Int32_System_Array_System_Int32_System_Int32_).
Example:
```
byte[] bytePic = new byte[arrPic.Length * 4];
Buffer.BlockCopy(arrPic, 0, bytePic, 0, bytePic.Length);
```
But if your write-method accepts a span you might want to just convert your array to a span and [cast this to the right type](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.memorymarshal.cast?source=recommendations&view=net-7.0), avoiding the copy.
| null | CC BY-SA 4.0 | null | 2022-11-24T14:58:17.587 | 2022-11-24T15:03:59.507 | 2022-11-24T15:03:59.507 | 12,342,238 | 12,342,238 | null |
74,562,903 | 2 | null | 74,561,745 | 0 | null | You can query with:
```
SubscriptionsPlans.objects.filter(subscriptionsorder__user_id=4)
```
This will list all `SubscriptionPlans` for which there is a `SubscriptionOrder` with `4` as `user_id`.
| null | CC BY-SA 4.0 | null | 2022-11-24T15:15:52.317 | 2022-11-24T15:15:52.317 | null | null | 67,579 | null |
74,562,912 | 2 | null | 20,875,823 | 1 | null | If you are not using storyboard
Open info.plist
In the info.plist file delete the following feature
Information Property List -> Scene configuration -> Application Session Role -> Item 0 -> StoryBoard Name
| null | CC BY-SA 4.0 | null | 2022-11-24T15:16:28.563 | 2022-11-24T15:16:28.563 | null | null | 20,592,088 | null |
74,563,068 | 2 | null | 74,562,403 | 0 | null | This is a possible solution in only 6 lines:
```
for i in range(6, 0, -2):
Spaceship.step(2)
for k, j in enumerate([1, 2, 2, 2, 1]):
Dev.step(i * j)
if k != 4:
Dev.turnRight()
```
The idea is to group all steps of the robot in a list in order to do a and turn only if it is not the last element of the list.
| null | CC BY-SA 4.0 | null | 2022-11-24T15:29:35.360 | 2022-11-24T15:29:35.360 | null | null | 13,763,683 | null |
74,563,146 | 2 | null | 21,205,652 | 0 | null | [https://stackoverflow.com/a/21206274/17291932](https://stackoverflow.com/a/21206274/17291932)
I've edited this answer ^^^ a bit just to make it automatic.
Here are the important parts:
JS:
```
function generatePie(el) {
if(el.getAttribute("data-percent") != 0 && el.getAttribute("data-percent") % 100 == 0) {
el.style.backgroundImage = "green";
return;
}
var percent = el.getAttribute("data-percent") % 100;
if(percent <= 50) {
el.style.backgroundImage = "linear-gradient(" + (90+(3.6*percent)) + "deg, transparent 50%, white 50%),linear-gradient(90deg, white 50%, green 50%)";
} else {
el.style.backgroundImage = "linear-gradient(90deg, transparent 50%, green 50%),linear-gradient(" + ((percent-50)/50*180+90) + "deg, white 50%, transparent 50%)";
}
}
```
USECASE DEMO:
```
// Function used to generate the pie - copy-paste this
function generatePie(el) {
if(el.getAttribute("data-percent") != 0 && el.getAttribute("data-percent") % 100 == 0) {
el.style.backgroundImage = "green";
return;
}
var percent = el.getAttribute("data-percent") % 100;
if(percent <= 50) {
el.style.backgroundImage = "linear-gradient(" + (90+(3.6*percent)) + "deg, transparent 50%, white 50%),linear-gradient(90deg, white 50%, var(--color) 50%)";
} else {
el.style.backgroundImage = "linear-gradient(90deg, transparent 50%, var(--color) 50%),linear-gradient(" + ((percent-50)/50*180+90) + "deg, white 50%, transparent 50%)";
}
}
// Showcase
generatePie(document.getElementById("1"));
generatePie(document.getElementById("2"));
generatePie(document.getElementById("3"));
generatePie(document.getElementById("4"));
generatePie(document.getElementById("5"));
```
```
/* Also customisible */
pie {
--color: orange;
width: 5em;
height: 5em;
display: block;
border-radius: 50%;
background-color: var(--color);
border: 2px solid var(--color);
float: left;
margin: 1em;
}
```
```
<pie data-percent="0" id="1"></pie>
<pie data-percent="25" id="2"></pie>
<pie data-percent="50" id="3"></pie>
<pie data-percent="75" id="4"></pie>
<pie data-percent="100" id="5"></pie>
```
EDIT - code explanation:
Main idea of this approach is to layer 2 linear gradients on each other. (Each of them is half filled, half transparent/white)
First we check, if the percent is 100 or some multiple of 100. In that case we fill the whole thing. We do this because it's the easiest way to handle full circles.
If that fails, we extract the percent value (for example: 150% -> 50%), which covers all the (positive) edge cases.
Than we check, if the percent value is under 50. In that case, we draw the first gradient to fill the right half of the circle and then, on top of that we draw half-white gradient in the corresponding angle, which "deletes" exces colored area.
If the value is > than 50, we start the same way but instead of subtracting from it, we add more colored area.
| null | CC BY-SA 4.0 | null | 2022-11-24T15:36:25.623 | 2022-12-10T19:26:21.197 | 2022-12-10T19:26:21.197 | 17,291,932 | 17,291,932 | null |
74,563,222 | 2 | null | 74,561,758 | 0 | null | In most DBMS, you can use the query you've shown as subquery.
And then use `GREATEST` with `CASE WHEN` to create the expected outcome.
So you can do following:
```
SELECT country,
CASE GREATEST(Liquids, Veg, NonVeg, Fish, Chocolates, Commodities)
WHEN Liquids THEN 'Liquids'
WHEN Veg THEN 'Veg'
WHEN NonVeg THEN 'NonVeg'
WHEN Fish THEN 'Fish'
WHEN Chocolates THEN 'Chocolates'
ELSE 'Commodities'
END AS MostPopularProduct
FROM
(SELECT Country,
SUM(Liquids) AS Liquids,
SUM(Veg) AS Veg,
SUM(NonVeg) AS NonVeg,
SUM(Fish) AS Fish,
SUM(Chocolates) AS Chocolates,
SUM(Commodities) AS Commodities
FROM marketing_data
GROUP BY COUNTRY) sub;
```
But attention! If the values you want to sum can be `NULL`, you need to replace null values by another value (very likely, you want them to be zero), otherwise the whole sum will be null, too!
That's a typical use case for `COALESCE`:
```
SELECT country,
CASE GREATEST(Liquids, Veg, NonVeg, Fish, Chocolates, Commodities)
WHEN Liquids THEN 'Liquids'
WHEN Veg THEN 'Veg'
WHEN NonVeg THEN 'NonVeg'
WHEN Fish THEN 'Fish'
WHEN Chocolates THEN 'Chocolates'
ELSE 'Commodities'
END AS MostPopularProduct
FROM
(SELECT Country,
SUM(COALESCE(Liquids,0)) AS Liquids,
SUM(COALESCE(Veg,0)) AS Veg,
SUM(COALESCE(NonVeg,0)) AS NonVeg,
SUM(COALESCE(Fish,0)) AS Fish,
SUM(COALESCE(Chocolates,0)) AS Chocolates,
SUM(COALESCE(Commodities,0)) AS Commodities
FROM marketing_data
GROUP BY COUNTRY) sub;
```
This query will do on Oracle DB's, MySQL DB's, Maria DB's, Postgres DB's and SQLServer 2022 DB's.
If your DBMS is none of them, you can also use this concept, but you likely have to replace `GREATEST` by a similar function that they provide.
| null | CC BY-SA 4.0 | null | 2022-11-24T15:42:04.010 | 2022-11-24T15:42:04.010 | null | null | 18,794,826 | null |
74,563,335 | 2 | null | 74,562,803 | 0 | null | That's because you are looping all the images, tags, etc individually. As you said you want the whole element to be multiplied in your comments, that's what you need to do, loop the whole card.
```
<div>
<!-- I want this whole element below to be multiplied -->
<div class="col-md-4" v-for="(project,id) in projectList" v-
bind:key="project.id" >
<div class="card card--project">
<img class="card__img" " :src="project.img" alt="" />
<div class="card__text">
<p class="project-label text-md text-md--md" >{{ project.tag }}</p>
<h4 class="text-gradient-primary">{{ project.name }}</h4>
<p class="project-desc text-md" >{{ project.desc }}</p>
<a href="#" class="links">Read More</a>
</div>
</div>
</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-11-24T15:51:33.807 | 2022-11-24T15:51:33.807 | null | null | 12,177,406 | null |
74,563,657 | 2 | null | 74,562,532 | 3 | null | You need to save (commit and push) your results, otherwise neither you, GitLab, nor Iterative Studio will be able to retrieve any results.
```
...
# add a comment to GitLab
- cml comment create report.md
# upload code/metadata
- cml pr create . # this will git commit, push, and open a merge request
# upload data/artefacts
- dvc push
```
Note for `dvc push` to work, you will need to [setup storage credentials](https://cml.dev/doc/cml-with-dvc#cloud-storage-provider-credentials) if you haven't done so already.
| null | CC BY-SA 4.0 | null | 2022-11-24T16:18:23.433 | 2022-11-24T16:24:01.977 | 2022-11-24T16:24:01.977 | 3,896,283 | 3,896,283 | null |
74,564,329 | 2 | null | 74,563,980 | 0 | null | Could you use the following if the button is the only instance of the class 'gw-action--inner'?
```
document.querySelector('.gw-action--inner').click()
```
| null | CC BY-SA 4.0 | null | 2022-11-24T17:17:36.140 | 2022-11-24T17:17:36.140 | null | null | 3,050,310 | null |
74,564,681 | 2 | null | 63,591,238 | 0 | null | I used `plt.rcParams['axes.grid'] = True` in one of the first cells (for another matplotlib charts). So before the ConfusionMatrixDisplay I turned it off.
```
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay
plt.rcParams['axes.grid'] = True
...
plt.rcParams['axes.grid'] = False
fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(16, 6))
disp_rfc.plot(ax = ax[0], cmap='coolwarm')
disp_cbc.plot(ax = ax[1], cmap='coolwarm')
plt.show()
```
| null | CC BY-SA 4.0 | null | 2022-11-24T17:57:01.720 | 2022-11-24T17:57:01.720 | null | null | 20,307,460 | null |
74,564,860 | 2 | null | 74,564,755 | 0 | null | Because you know all of the possible values, you could use a `dict` with department names as keys and counts as values.
You could initialize it as:
```
departments = {"Cardiology": 0, "Neurology": 0, "Orthopaedics": 0, "Gynaecology": 0, "Oncology": 0}
```
As a style suggestion, since you're iterating over the elements of a list, you don't need to access them by index, instead you can loop over the list directly. Combining that with the dictionary, you can do:
```
for dept in A:
departments[dept] += 1
max_patients = max(departments)
return max_patients
```
Of course, if you're willing to explore the documentation a little, the [collections.Counter](https://docs.python.org/3/library/collections.html#collections.Counter) object does the same thing (but probably a little faster)
| null | CC BY-SA 4.0 | null | 2022-11-24T18:17:26.877 | 2022-11-24T18:17:26.877 | null | null | 11,542,834 | null |
74,564,865 | 2 | null | 74,564,755 | 0 | null | You can solve this very easily with `collections.Counter`. You don't want or need dictionaries, side lists or anything else extra. Everything you add is another thing to break. Keep it as simple as possible.
```
from collections import Counter
def solution(A):
return max(Counter(A).values())
```
I only stuck this in a function to give you context. There's no reason for this to be a function. Wrapping this in a function is basically just giving the operation an alias. Unfortunately, your alias doesn't give any indication of what you aliased. It's better to just put the one line in place.
| null | CC BY-SA 4.0 | null | 2022-11-24T18:18:29.850 | 2022-11-24T18:25:39.777 | 2022-11-24T18:25:39.777 | 10,292,330 | 10,292,330 | null |
74,565,049 | 2 | null | 74,564,755 | 0 | null | Based on assumptions and the return value:
```
def solution(A):
A = [A.count(A[i]) for i in set(range(len(A)))]
return max(A)
A = ["Cardiology", "Neurology", "Oncology", "Orthopaedics", "Gynaecology", "Oncology", "Oncology"]
print(solution(A))
# 3
```
| null | CC BY-SA 4.0 | null | 2022-11-24T18:40:45.570 | 2022-11-24T18:53:41.667 | 2022-11-24T18:53:41.667 | 19,574,157 | 19,574,157 | null |
74,565,311 | 2 | null | 74,562,403 | 0 | null | You can avoid pythonesque code like so:
```
for i in range(6,0,-2):
Spaceship.step(2)
for idk in range(4):
Dev.step(i)
Dev.turnRight()
Dev.step(i)
```
| null | CC BY-SA 4.0 | null | 2022-11-24T19:09:23.177 | 2022-11-24T19:09:23.177 | null | null | 20,593,682 | null |
74,565,339 | 2 | null | 73,678,181 | 0 | null | CaptureElement not yet supported on WinUI3, however workaround does exists.
The simplest alternative is: Capture the media frames, and render them on Image Element to make a preview.
```
<!--CaptureElement x:Name="capturePreview" Width="640" Height="480" /-->
<Image x:Name="imagePreview" Stretch="Fill" Width="640" Height="480" />
```
Test sample located at: [https://github.com/microsoft/microsoft-ui-xaml/issues/4710#issuecomment-1296906888](https://github.com/microsoft/microsoft-ui-xaml/issues/4710#issuecomment-1296906888)
| null | CC BY-SA 4.0 | null | 2022-11-24T19:11:55.310 | 2022-11-24T19:17:30.680 | 2022-11-24T19:17:30.680 | 20,593,517 | 20,593,517 | null |
74,565,686 | 2 | null | 71,563,426 | 0 | null | You can use below code [result](https://i.stack.imgur.com/82yG8.png)
```
# admin.py
list_display = ('title', 'description', 'embed_pdf', 'deadline')
def embed_pdf(self, obj):
try:
html = f'<iframe src="{obj.add_file.url}" width="200px" height="200px" frameborder="2"></iframe>'
formatted_html = format_html(html.format(url=obj.add_file.url))
return formatted_html
except Exception as e:
pass
embed_pdf.short_description = "File/Image"
admin.site.register(Order, OrderAdmin)
```
| null | CC BY-SA 4.0 | null | 2022-11-24T19:54:37.210 | 2022-11-28T20:16:47.233 | 2022-11-28T20:16:47.233 | 14,267,427 | 15,070,994 | null |
74,566,054 | 2 | null | 54,191,643 | 0 | null |
# Problem
I had the same problem while trying to reinstall flutter using the recommended windows install guide found here [https://docs.flutter.dev/get-started/install/windows](https://docs.flutter.dev/get-started/install/windows)
(flutter_windows_3.3.9-stable).
. It did not matter if I was in the flutter console, PowerShell, VS Code terminal or Admin Command prompt.
This made running `flutter doctor` impossible, and thus I couldn't complete the flutter setup.
### Environment
- - - - - [https://git-scm.com/download/win](https://git-scm.com/download/win)-
# Solution
This solution worked for me and should resolve most install problems related to installing flutter on a Windows environment.
.
### Step 0 - Remove flutter from system:
If reinstalling flutter, do this step, otherwise move to step 1 if preforming a fresh installation.
1. Open file explorer and delete the folder titled flutter if already installed.
2. Type environment variables into the windows search bar and open Edit the system environment variables.
3. Click environment variables in the Advanced tab.
4. Double-click the word Path found under User variables for {YOUR USER NAME}.
5. Select any entries that end with \flutter or \flutter\bin and delete them.
6. Click the Ok button and then the Ok button to apply the changes.
### Step 1 - Download Stable Flutter Version:
1. Go to the official flutter website https://docs.flutter.dev/development/tools/sdk/releases and download the most recent flutter version in the Stable channel (Windows).
2. Once downloaded, unzip the folder.
3. Place the flutter folder found inside the Zip file wherever you would like to store it on your computer. Flutter recommend putting it in C:\src\flutter. You can place it where've you like as long as It's not in a folder that requires elevated privileges to access, such as the C:\Program Files\ folder.
Note* I used Windows Explorer to unzip the file, however others report used 7-Zip file Manager for unzipping solved their problem.
### Step 2 - Setup Environment Variables:
1. Type environment variables into the windows search bar and open Edit the system environment variables.
2. Click environment variables in the Advanced tab.
3. Double-click the word Path found under User variables for {YOUR USER_NAME}.
4. Click Browse... and navigate to where you placed the flutter folder. Then navigate to the bin file inside the flutter folder and click ok. A new environment variable should have been added that looks like C:\src\flutter\bin.
5. You also need to make sure Git\bin\cmd, Git\bin\git.exe and, C:\Windows\System32\WindowsPowerShell\v1.0\ system environment paths are setup. These were post likely configured during your git for windows install.
Follow the "Update your path section" found here [https://docs.flutter.dev/get-started/install/windows](https://docs.flutter.dev/get-started/install/windows) if this doesn't work for you.
Note* If Path doesn't exist, click new... and set variable name to `Path` and Variable value to the file path of your bin folder found in the flutter folder you just unzipped.
### Step 3 - Reboot your computer in Safe Mode with Networking:
1. Press the Windows key + I on the keyboard to open Settings, or type settings in the windows search bar.
2. Click Update & Security and on the left pane select Recovery.
3. Under Advanced Startup, click Restart Now.
4. After the computer restarts, on the Choose an Option screen, select Troubleshoot > Advanced Options > Startup Settings > Restart.
5. After the computer restarts, a list of options appears. Select 5 or F5 for Safe Mode with Networking or whatever key your computer says to boot into Safe Mode with Networking.
### Step 4 - Launch Administrator Command Prompt:
1. After rebooting, type command prompt into the windows search bar.
2. Right-click the application icon and click Run as administartor.
3. Run the following commands, flutter pub cache repair then flutter doctor -v. This might take quite some time if you have poor internet, as it will re-downloads every package in the cache.
4. If flutter doctor reports any red or yellow warnings with your environment, you need to resolve these first before continuing. These are quite common, and a Google search of the error or warning should solve your problem.
Note* if the command flutter is unrecognized, this means you didn't set up your environment path variables in step 2 correctly.
### Step 5 - Reboot and run your project
1. Now that flutter doctor has run in safe mode, we can restart the computer and get out of safe mode.
2. Open your flutter project in Visual Studio Code.
3. Open a terminal window under terminal > new Terminal.
4. run the command, git config --global --add safe.directory C:/src/flutter make sure you use forward / and set the file path to wherever you saved your flutter folder. This can also be run from the administrator command prompt if you don't have VS Code or a flutter project.
5. Then run flutter doctor -v in the VS Code terminal to make sure everything is working.
6. Now we need to rebuild all of our packages and dependencies, run the following list of commands in order.
```
flutter clean
flutter pub cache repair
flutter pub get
flutter pub upgrade --major-versions
```
# Troubleshooting
These are other solutions I noticed on stack overflow while trying to solve the problem for myself. These didn't work for my situation, but may help you solve yours.
- Flutter doctor, running very slowly. Try deleting the `cache` folder found in, `C:\src\flutter\bin\cache\` then running `flutter doctor -v` again. [Flutter doctor hangs on start, no output](https://stackoverflow.com/questions/54191643/flutter-doctor-hangs-on-start-no-output)- If you are in China. Download flutter through a mirror site.- Try installing a different type of unzip program (like 7-zip).- Make sure you are using the Stable flutter channel.- Make sure your path variables are set up correctly.- getting error "Waiting for another flutter command to release the startup lock" Use task manager to forcibly close any flutter or dart programs.- Can't delete old flutter folder, in use for some reason. Restart and immediately delete the folder.- Make sure flutter isn't installed in a folder that requires admin privileges to access, such as `C:\Program Files\`.- Make sure you have git for windows installed and have set up your ssh keys.- Add the Flutter and Dart extensions to VS Code.- Add the flutter and Dart plugins to Android Studio.
| null | CC BY-SA 4.0 | null | 2022-11-24T20:44:52.937 | 2022-12-09T16:33:04.077 | 2022-12-09T16:33:04.077 | 15,890,040 | 15,890,040 | null |
74,566,656 | 2 | null | 26,697,760 | 0 | null | Depending on your case and functionality inside the div, you could also use mask on the parent div. If I understood you correctly, it works as you want but it doesn't actually clip the content as the clip-path would.
[https://developer.mozilla.org/en-US/docs/Web/CSS/mask](https://developer.mozilla.org/en-US/docs/Web/CSS/mask)
| null | CC BY-SA 4.0 | null | 2022-11-24T22:12:29.217 | 2022-11-24T22:12:29.217 | null | null | 13,890,131 | null |
74,567,450 | 2 | null | 18,386,210 | 1 | null | a minor modification of the draw_brace of [@Joooeey](https://stackoverflow.com/a/61454455/14126908) and [@guezy](https://stackoverflow.com/a/61454455/14126908) to have also the brace upside down
+argument upsidedown
```
def draw_brace(ax, xspan, yy, text, upsidedown=False):
"""Draws an annotated brace on the axes."""
# shamelessly copied from https://stackoverflow.com/questions/18386210/annotating-ranges-of-data-in-matplotlib
xmin, xmax = xspan
xspan = xmax - xmin
ax_xmin, ax_xmax = ax.get_xlim()
xax_span = ax_xmax - ax_xmin
ymin, ymax = ax.get_ylim()
yspan = ymax - ymin
resolution = int(xspan/xax_span*100)*2+1 # guaranteed uneven
beta = 300./xax_span # the higher this is, the smaller the radius
x = np.linspace(xmin, xmax, resolution)
x_half = x[:int(resolution/2)+1]
y_half_brace = (1/(1.+np.exp(-beta*(x_half-x_half[0])))
+ 1/(1.+np.exp(-beta*(x_half-x_half[-1]))))
if upsidedown:
y = np.concatenate((y_half_brace[-2::-1], y_half_brace))
else:
y = np.concatenate((y_half_brace, y_half_brace[-2::-1]))
y = yy + (.05*y - .01)*yspan # adjust vertical position
ax.autoscale(False)
line = ax.plot(x, y, color='black', lw=1)
if upsidedown:
text = ax.text((xmax+xmin)/2., yy+-.07*yspan, text, ha='center', va='bottom',fontsize=7)
else:
text = ax.text((xmax+xmin)/2., yy+.07*yspan, text, ha='center', va='bottom',fontsize=7)
return line, text
```
| null | CC BY-SA 4.0 | null | 2022-11-25T01:00:19.963 | 2022-11-25T01:00:19.963 | null | null | 3,653,343 | null |
74,567,472 | 2 | null | 58,726,104 | 0 | null | I tried that however failed as it would not handle if you have folder structure in the blob and you'd like to mirror that structure in SP and copy individual files to folders.
| null | CC BY-SA 4.0 | null | 2022-11-25T01:04:52.930 | 2022-11-25T01:04:52.930 | null | null | 20,595,095 | null |
74,567,595 | 2 | null | 74,546,036 | 0 | null | The calcul in Pinescript are discrete, at the end of each bar.
So you can't calculate when each indicator's line 'meet'.
You should calculate the average distance between your 3 lines and decide when this distance is so little that you can consider your 3 lines have met.
Here is a exemple with 3 bottom line of the bolinger band indicator.
In this exemple, we consider that the 3 lines have met when the average distance between the 3 lines is under 8 and then plot a red line :
```
//@version=5
indicator("My script", overlay=true)
level = input.float(8,"Level under which you consider the 3 bb are touching themselves")
[middle1, upper1, lower1] = ta.bb(close,20,2)
[middle2, upper2, lower2] = ta.bb(close,40,2)
[middle3, upper3, lower3] = ta.bb(close,60,2)
plot(lower1)
plot(lower2)
plot(lower3)
distance = math.avg(math.abs(lower1-lower2), math.abs(lower1-lower3), math.abs(lower2-lower3))
price = math.avg(lower1, lower2, lower3)
plot(distance>level?na:price,color=color.red,style=plot.style_linebr, linewidth = 4)
```
[](https://i.stack.imgur.com/Gl8xX.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T01:38:54.433 | 2022-11-25T01:38:54.433 | null | null | 7,206,632 | null |
74,568,287 | 2 | null | 74,567,068 | 1 | null | When you use extend, you don't need to call config, you can just use data.
```
class config{
constructor(config){
this.config = config;
}
}
class data extends config{
constructor(config){
super(config)
console.log(this.config)
}
}
new data('123456789')
```
| null | CC BY-SA 4.0 | null | 2022-11-25T04:13:46.780 | 2022-11-25T04:13:46.780 | null | null | 9,981,147 | null |
74,568,616 | 2 | null | 74,558,556 | 0 | null | stripeJS seems to be a client-side object, when it has confirmXXX methods, and uses a Publishable Key. To create Billing Portal session, you need a server-side API, or the NodeJS [Stripe SDK](https://github.com/stripe/stripe-node) which will use a Secret Key.
| null | CC BY-SA 4.0 | null | 2022-11-25T05:22:08.983 | 2022-11-25T05:22:08.983 | null | null | 3,631,795 | null |
74,568,877 | 2 | null | 19,449,374 | 0 | null | I've checked the latest version of RTF to HTML .Net and now, It works well.
The tags \cb and \highlight are fully recognized.
| null | CC BY-SA 4.0 | null | 2022-11-25T06:08:08.183 | 2022-11-25T06:08:08.183 | null | null | 20,500,653 | null |
74,569,239 | 2 | null | 72,273,557 | 0 | null | My team got the same issue today (@angular/cli version 15.0.1), two of our custom components work well in the dev mode, but not rendered in the production mode.
It works after we removed all useless references\methods from the imports in these issue components.
/*
It shall be the different behaviors between JIT and AOT, but we don't find out the root cause. :(
*/
UPDATE:
Well, it turns out that there was a circular reference (just imported but not been used) in our components, and the imports removing we did before just breaks it and fixed the issue. Not sure why there's no warnings or errors in the neither dev mode nor prod mode when there's a circular reference in Angular. Need to dig more in the source code :-P
| null | CC BY-SA 4.0 | null | 2022-11-25T06:59:49.793 | 2022-11-25T07:52:01.953 | 2022-11-25T07:52:01.953 | 20,596,731 | 20,596,731 | null |
74,569,438 | 2 | null | 74,548,601 | 0 | null | I'm afraid that there is no supported function to preview screenshots in the test run at present. You may submit a suggestion at website:[feature request](https://developercommunity.visualstudio.com/AzureDevOps/suggest?space=21)
But when i test in my Test plans, i find a workaround to add screenshot and preview it.
1 use the web runner to take screenshots of the web app while testing.
[](https://i.stack.imgur.com/LIGm1.png)
2 Create bug. The steps and your comments and screenshots are automatically added to the bug.And you can see the screenshot in your bug detail.
[](https://i.stack.imgur.com/HC56B.png)
3 click the screenshot and drag it manually, you'll see `upload file UI` .After uploading, you can preview screenshots in Attachment Tab in your new bug.
[](https://i.stack.imgur.com/Fkl6K.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T07:25:08.587 | 2022-11-25T07:25:08.587 | null | null | 20,288,521 | null |
74,569,494 | 2 | null | 74,563,154 | 0 | null | You can not hide it from user. You can set empty string from your code to make it go away. Like this
```
if(surname == "" ||surname == null){
yourEditText.setText(getString(R.string.surname,""))
}
```
| null | CC BY-SA 4.0 | null | 2022-11-25T07:31:19.397 | 2022-11-25T07:31:19.397 | null | null | 17,890,931 | null |
74,569,577 | 2 | null | 28,713,964 | 0 | null | ```
$('#datepicker').datepicker({ autoclose: true,format: 'yyyy-mm-dd',forceParse :false }).on('changeDate', function (e) {
var value = $("#datepicker").val();
var firstDate = moment(value, "YYYY-MM-DD").day(0).format("YYYY-MM-DD");
var lastDate = moment(value, "YYYY-MM-DD").day(6).format("YYYY-MM-DD");
$("#datepicker").val(firstDate + " / " + lastDate);
});
```
```
.datepicker .datepicker-days .table-condensed tr:hover {
background-color: #808080;
}
```
```
<link href="http://gotoastro.local.com/assets/bower_components/bootstrap-datepicker/css/bootstrap-datepicker3.css" rel="stylesheet"/>
<div class="col-md-12">
<div class="form-group">
<input type="text" class="form-control" name="datepicker" id="datepicker" value="">
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script src="http://gotoastro.com/front-assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
```
| null | CC BY-SA 4.0 | null | 2022-11-25T07:40:53.303 | 2022-11-28T18:51:40.437 | 2022-11-28T18:51:40.437 | 14,267,427 | 20,597,028 | null |
74,569,784 | 2 | null | 74,263,033 | 0 | null | First make sure your connection string is correct. Then the database name avoids the use of dashes (`-`).
The same code works fine for me.
[](https://i.stack.imgur.com/mcA1W.png)
Download the connection package [here](https://mariadb.com/downloads/connectors/connectors-data-access/java8-connector).
[](https://i.stack.imgur.com/peol1.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T08:04:00.023 | 2022-11-25T08:04:00.023 | null | null | 19,133,920 | null |
74,569,861 | 2 | null | 73,917,347 | 1 | null | I had a similar issue running `bowtie 2.5.0` against index files built by `bowtie 2.4.5`. The error message shows `readU: No such file or directory` even though the files are there.
[](https://i.stack.imgur.com/yWTkF.png)
I rebuilt the indexes using `bowtie 2.5.0` and the issue was resolved. So I'd suggest rebuilding the indexes using the same version as the aligner, and then running it again.
| null | CC BY-SA 4.0 | null | 2022-11-25T08:14:07.620 | 2022-11-25T17:55:01.650 | 2022-11-25T17:55:01.650 | 1,940,886 | 1,940,886 | null |
74,569,913 | 2 | null | 74,569,229 | 0 | null | Use [numpy.broadcast_to](https://numpy.org/doc/stable/reference/generated/numpy.broadcast_to.html) for new 2d arrays and divide them, then pass to DataFrame constructor:
```
array_CinA = np.array([0,125,250,500,1000])
array_Aceto = np.array([0,100,200,400,800])
vol_cina = [0, 5, 10, 20, 40]
vol_as = [0, 2, 4,8,16]
shape = (len(array_Aceto), len(array_CinA))
arr = np.core.defchararray.add(np.array(vol_cina).astype(str), '/')[:, None]
a1 = np.broadcast_to(arr, shape)
a2 = np.broadcast_to(np.array(vol_as).astype(str), shape)
df = (pd.DataFrame(np.core.defchararray.add(a1, a2), index=array_CinA, columns=array_Aceto))
print (df)
0 100 200 400 800
0 0/0 0/2 0/4 0/8 0/16
125 5/0 5/2 5/4 5/8 5/16
250 10/0 10/2 10/4 10/8 10/16
500 20/0 20/2 20/4 20/8 20/16
1000 40/0 40/2 40/4 40/8 40/16
```
| null | CC BY-SA 4.0 | null | 2022-11-25T08:20:15.450 | 2022-11-25T09:10:35.473 | 2022-11-25T09:10:35.473 | 2,901,002 | 2,901,002 | null |
74,570,002 | 2 | null | 55,614,198 | 0 | null | Re-download the latest installer run it, fixes the problem
| null | CC BY-SA 4.0 | null | 2022-11-25T08:28:55.173 | 2022-11-25T08:28:55.173 | null | null | 19,768,247 | null |
74,570,222 | 2 | null | 74,569,229 | 0 | null | The below code should be what you are after.
I am using product function from intertools library to create the full data. Then I am just converting to string type so that numpy doesn't get confused and I reshape it. Finally I am producing a dataframe providing index names and column names.
```
import numpy as np
import pandas as pd
from itertools import product
array_CinA = np.array([0, 125, 250, 500, 1000])
array_Aceto = np.array([0, 100, 200, 400, 800])
vol_cina = [0, 5, 10, 20, 40]
vol_as = [0, 2, 4, 8, 16]
# creating full data
my_product = list(product(vol_cina, vol_as))
# converting to str
my_product_str = [str(a) for a in my_product]
# converting to np array
my_product_str_np = np.array(my_product_str)
# reshaping
my_product_str_np = my_product_str_np.reshape(len(vol_cina), len(vol_as))
# producing final data
df = pd.DataFrame(my_product_str_np, index=array_CinA, columns=array_Aceto)
df.index.name="CinnamonicAcid"
df.columns.name="Acetosyringone"
print(df)
```
| null | CC BY-SA 4.0 | null | 2022-11-25T08:50:30.640 | 2022-11-25T09:04:31.857 | 2022-11-25T09:04:31.857 | 5,198,162 | 5,198,162 | null |
74,570,460 | 2 | null | 13,702,471 | 0 | null | If you are using PostgreSQL, you can use this:
```
SELECT last_value FROM <sequence_name>;
```
| null | CC BY-SA 4.0 | null | 2022-11-25T09:13:53.460 | 2022-11-25T09:13:53.460 | null | null | 14,296,759 | null |
74,570,625 | 2 | null | 74,546,212 | 0 | null | The issue was an SSR on client side.
[https://github.com/apollographql/apollo-client/issues/10311](https://github.com/apollographql/apollo-client/issues/10311)
| null | CC BY-SA 4.0 | null | 2022-11-25T09:27:52.530 | 2022-11-25T09:27:52.530 | null | null | 16,703,396 | null |
74,570,716 | 2 | null | 31,044,380 | 0 | null | For the authentication process - you can use spring data JPA for querying mySQL database using method name conversation.
Also you can use spring security's BCeypt algorithm to hash the password.
Links:
Spring data JPA: [https://spring.io/projects/spring-data-jpa](https://spring.io/projects/spring-data-jpa)
Spring Security: [https://spring.io/projects/spring-authorization-server](https://spring.io/projects/spring-authorization-server)
You can use this approach
[Authentication controller](https://i.stack.imgur.com/myWE2.png)
For the detailed implementation, you can refer this blog:
[https://www.tatvasoft.com/blog/microservices-implementation-java/](https://www.tatvasoft.com/blog/microservices-implementation-java/)
| null | CC BY-SA 4.0 | null | 2022-11-25T09:34:45.807 | 2022-11-25T09:34:45.807 | null | null | 19,939,098 | null |
74,571,317 | 2 | null | 74,569,573 | -1 | null | Here this will help
```
df["counts"] = 1
newDf = pd.DataFrame(df[[ "Region","Year","counts"]].groupby([ "Region","Year" ]).sum(["counts"])).reset_index()
```
and then after that on the new data set you can build those required graphs
```
plt.figure(figsize=(20,10))
plt.title('Regionwise Killed')
plt.xlabel('Year',fontsize=15)
plt.ylabel('Killed',fontsize=15)
sns.lineplot(x=newDf ['Year'].index,y=newDf ['counts'],hue=newDf['Region'])
plt.show()
```
| null | CC BY-SA 4.0 | null | 2022-11-25T10:24:13.537 | 2022-11-25T10:24:13.537 | null | null | 18,219,665 | null |
74,571,472 | 2 | null | 74,566,651 | 0 | null | `public class PlayerControls` has to be in a file called !
Looking at your [screenshot](https://i.stack.imgur.com/KLPal.jpg) you have in a file called
I guess you copied/renamed the class or file. Please make sure Filename and Classname match!
| null | CC BY-SA 4.0 | null | 2022-11-25T10:35:42.607 | 2022-11-25T10:35:42.607 | null | null | 5,967,872 | null |
74,572,128 | 2 | null | 74,550,185 | 0 | null | Solution1:
Add a user's uid in the comment. Use that uid to match the current logged-in user's uid to show delete button in your UI.
data structure for comments: [{uid, name, photoUrl, rating, text}]
Solution2:
The above way should work but essentially all users had delete access to anyone's comment.. it's just that you're not showing the mechanism in UI. for better security I guess you should look at [https://firebase.google.com/docs/database/security](https://firebase.google.com/docs/database/security)
something like should work
```
{
"rules": {
"items": {
"$item_id" : {
"comments": {
"$comment_id": {
".read": "auth != null",
".write": "auth != null && (data.child('uid').exists() ? (data.child('uid').val() == auth.uid) : true)"
}
}
}
}
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-25T11:27:16.657 | 2022-11-25T11:27:16.657 | null | null | 19,699,404 | null |
74,572,229 | 2 | null | 74,565,652 | 0 | null | I'm checking your request, I think you can aproach in two way, a way is define a table where you will save the patient id and a column with counter to generate your custom id
Example
Table name like PatientCounter
```
PatientID, PatientCounter
1 1
2 125
```
Or in table patient add a column Counter, I prefer the thing separeted, but this also is a option, then in the query you could do something like that.
```
DECLARE @PatientId as int
DECLARE @PatientCount as int
SET @PatientId = 21
SET @PatientCount = 1
SELECT
CAST(FORMAT(GETDATE(),'yy') as nvarchar(4)) + '/' +
CAST(MONTH(getDATE()) as nvarchar(4)) + '/' +
CAST(@PatientId as nvarchar(10)) +
CAST(REPLICATE('0', 5 - LEN(@PatientCount + 1)) + RTrim(@PatientCount + 1) as nvarchar(50)) as MyCustomId
```
The result
```
MyCustomId
22/11/2100002
```
And after confirming that your application has consumed this custom id, update the counter in the table.
```
UPDATE PatientTable SET PatientCount = PatientCount + 1 WHERE PatientID = @PatientId
```
Best Regards
| null | CC BY-SA 4.0 | null | 2022-11-25T11:36:21.067 | 2022-11-25T12:21:40.500 | 2022-11-25T12:21:40.500 | 20,478,349 | 20,478,349 | null |
74,572,356 | 2 | null | 74,572,140 | 1 | null | Probably answered somehwere else too... magic is to convert your Date to a Date format and then extract the month from it... this might do the trick:
```
data <- data.frame(Results =c(1811, 1009, 1889, 1139, 1275),
Date = c("01.09.15", "03.09.15", "20.09.15", "03.10.15", "06.10.15"))
data$Date <- as.Date(data$Date,format = "%d.%m.%y")
library(lubridate)
data$Month <- month(data$Date,label=T)
aggregate(data= data,Results~Month, FUN = sum)
```
leads to:
```
Month Results
Sep 4709
Oct 2414
```
for plotting:
```
library(ggplot2)
qplot(data=data, x = Month, y=Results, geom="col")
```
[](https://i.stack.imgur.com/Dh6G9.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T11:47:32.233 | 2022-11-25T15:42:39.003 | 2022-11-25T15:42:39.003 | 18,503,018 | 18,503,018 | null |
74,572,551 | 2 | null | 74,572,550 | 0 | null | I find we can use Request, but it is asynchronous
```
const fd = new FormData();
fd.append('name1', 'value1');
fd.append('name2', 'value2');
fd.append('name3', new Blob([`zzzzzzzzzzzzzzzzz`]));
const req = new Request(location.origin, {
method: `POST`,
body: fd,
});
const td = new TextDecoder('utf-8');
console.log(td.decode(await req.arrayBuffer()));
```
Is there a way to do this without `async/await` ?
| null | CC BY-SA 4.0 | null | 2022-11-25T12:04:45.603 | 2022-11-25T12:04:45.603 | null | null | 10,717,907 | null |
74,572,739 | 2 | null | 74,572,140 | 1 | null | Here a `tidyverse` approach that might help you
```
data <-
structure(list(Results = c(1811, 1009, 1889, 1139, 1275),
Date = c("01.09.15","03.09.15", "20.09.15", "03.10.15", "06.10.15")),
class = "data.frame", row.names = c(NA,-5L))
library(dplyr)
library(lubridate)
library(ggplot2)
data %>%
mutate(
Date = dmy(Date),
Month = month(Date,label = TRUE),
Year = year(Date)
) %>%
group_by(Year,Month) %>%
summarise(Results = sum(Results,na.rm = TRUE)) %>%
ggplot(aes(x = Month,Results))+
geom_col()
```
[](https://i.stack.imgur.com/7HyfZ.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T12:22:16.217 | 2022-11-25T12:22:16.217 | null | null | 9,696,037 | null |
74,572,875 | 2 | null | 74,564,063 | 0 | null | Use `\mathrm{\AA}` with the STIXGeneral font family, which comes with Matplotlib. This will render the symbol in non-italic style; `\AA` will render it in italics. I included both in the following examples.
```
import matplotlib.pyplot as plt
plt.rcParams['mathtext.fontset'] = 'stix'
plt.xlabel(r'Displacement ($\mathrm{\AA}$) ($\AA$)', fontname='STIXGeneral', fontsize=12)
plt.show()
```
[](https://i.stack.imgur.com/bPYPc.png)
Note that the ticks on the x-axis and y-axis still use the default font (DejaVu Sans). If you want to use Times New Roman for , just set the `font.family` parameter.
```
import matplotlib.pyplot as plt
plt.rcParams['mathtext.fontset'] = 'stix'
plt.rcParams['font.family'] = 'STIXGeneral'
plt.xlabel(r'Displacement ($\mathrm{\AA}$) ($\AA$)', fontsize=12)
plt.show()
```
[](https://i.stack.imgur.com/CVOtz.png)
Tested on Python 3.8.10 and 3.10.8.
| null | CC BY-SA 4.0 | null | 2022-11-25T12:33:33.157 | 2022-11-25T12:41:58.560 | 2022-11-25T12:41:58.560 | 6,286,575 | 6,286,575 | null |
74,573,290 | 2 | null | 74,571,240 | 0 | null | You'd probably be better off to do it this way, auto skip row 1 by starting the iteration at row 2 and update the formula using the cell row number.
```
import openpyxl
excelfile = 'foo.xlsx'
workbook= openpyxl.load_workbook(excelfile)
sheet = workbook.active
mr = sheet.max_row # Last row to add formula to
for row in sheet.iter_rows(min_col=9, max_col=9, min_row=2, max_row=mr):
for cell in row:
cr = cell.row # Get the current row number to use in formula
cell.value = f'=IF(ISNUMBER(A{cr})*(A{cr} <> 0), A{cr}, IF(ISNUMBER(F{cr})*(F{cr} <> 0), F{cr}, IF(ISBLANK(A{cr})*ISBLANK(F{cr})*ISBLANK(H{cr}), 0, H{cr})))'
workbook.save(excelfile)
```
| null | CC BY-SA 4.0 | null | 2022-11-25T13:07:14.233 | 2022-11-25T13:12:30.310 | 2022-11-25T13:12:30.310 | 13,664,137 | 13,664,137 | null |
74,573,306 | 2 | null | 74,571,240 | 0 | null | If you know the from and to row numbers, then you can use it like this:
```
from openpyxl import load_workbook
wb = load_workbook(filename="/content/sample_data/Book1.xlsx")
ws = wb.active
from_row = 2
to_row = 4
for i in range(from_row, to_row+1):
ws[f"C{i}"] = f'=_xlfn.CONCAT(A{i}, "_", B{i})'
wb.save("/content/sample_data/formula.xlsx")
```
Input (Book1.xlsx):

Output (formula.xlsx):

I don't have your data, so I did not test the following formula; but your formula can be translated to format string as:
```
for i in range(from_row, to_row+1):
ws[f"I{i}"] = f'=IF(ISNUMBER(A{i})*(A{i}<>0),A{i},IF(ISNUMBER(F{i})*(F{i}<>0),F{i},IF(ISBLANK(A{i})*ISBLANK(F{i})*ISBLANK(H{i}),0,H{i})))'
```
It formats the formula as:
```
=IF(ISNUMBER(A2)*(A2<>0),A2,IF(ISNUMBER(F2)*(F2<>0),F2,IF(ISBLANK(A2)*ISBLANK(F2)*ISBLANK(H2),0,H2)))
=IF(ISNUMBER(A3)*(A3<>0),A3,IF(ISNUMBER(F3)*(F3<>0),F3,IF(ISBLANK(A3)*ISBLANK(F3)*ISBLANK(H3),0,H3)))
=IF(ISNUMBER(A4)*(A4<>0),A4,IF(ISNUMBER(F4)*(F4<>0),F4,IF(ISBLANK(A4)*ISBLANK(F4)*ISBLANK(H4),0,H4)))
```
| null | CC BY-SA 4.0 | null | 2022-11-25T13:08:34.837 | 2022-11-25T13:14:48.040 | 2022-11-25T13:14:48.040 | 2,847,330 | 2,847,330 | null |
74,573,322 | 2 | null | 73,289,999 | 0 | null | Considering that the initial dataframe is `df`, there are various options, depending on the exact desired output.
- If one wants the `info` column to be a dictionary of lists, this will do the work```
df_new = df.groupby('studentid').apply(lambda x: x.drop('studentid', axis=1).to_dict(orient='list')).reset_index(name='info')
[Out]:
studentid info
0 1 {'course': ['math', 'history'], 'teacher': ['A...
1 2 {'course': ['math', 'history'], 'teacher': ['A...
2 3 {'course': ['math', 'history'], 'teacher': ['A...
```
- If one wants a list of dictionaries, then do the following```
df_new = df.groupby('studentid').apply(lambda x: x.drop('studentid', axis=1).to_dict(orient='records')).reset_index(name='info')
[Out]:
studentid info
0 1 [{'course': 'math', 'teacher': 'A', 'grade': 9...
1 2 [{'course': 'math', 'teacher': 'A', 'grade': 8...
2 3 [{'course': 'math', 'teacher': 'A', 'grade': 8...
```
| null | CC BY-SA 4.0 | null | 2022-11-25T13:10:11.027 | 2022-11-25T13:10:11.027 | null | null | 7,109,869 | null |
74,573,779 | 2 | null | 74,572,527 | 1 | null | You can do this by nesting your data by season, running `pairwise_cor` via `map` on the resultant `data` column, then unnesting.
It's difficult to know how you want the final plot to look (since it would have 60 different panels), so here is an example of using all 10 seasons worth of data for a faceted heatmap:
```
friends %>%
unite(scene_id, episode, scene) %>%
count(speaker, season, scene_id) %>%
semi_join(main_cast, by = "speaker") %>%
nest(data = -season) %>%
mutate(data = map(data,
~pairwise_cor(.x, speaker, scene_id, n, sort = TRUE)
)) %>%
unnest(data) %>%
mutate(season = factor(paste('Season', season), paste('Season', 1:10))) %>%
ggplot(aes(item1, item2, fill = correlation)) +
geom_tile(color = 'black') +
scale_fill_viridis_c() +
scale_x_discrete(expand = c(0, 0)) +
scale_y_discrete(expand = c(0, 0)) +
facet_wrap(~ season, nrow = 2) +
theme_minimal() +
coord_fixed() +
theme(axis.text.x = element_text(angle = 90),
panel.grid = element_blank(),
panel.border = element_rect(fill = NA))
```
[](https://i.stack.imgur.com/XCuCA.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T13:46:32.537 | 2022-11-25T13:46:32.537 | null | null | 12,500,315 | null |
74,573,896 | 2 | null | 74,571,678 | 0 | null | Add a with the following expression
```
period name =
IF (
'Table'[DATE] < DATE( YEAR(TODAY()), MONTH(TODAY()) - 6, DAY(TODAY())),
"over 6 month",
"last 6 month"
)
```
to your 'Table' and use it in your slicer.
| null | CC BY-SA 4.0 | null | 2022-11-25T13:56:22.523 | 2022-11-25T13:56:22.523 | null | null | 7,108,589 | null |
74,573,943 | 2 | null | 54,827,043 | 2 | null | - `cmd``,`- `Snippet Suggestions``top`- `Insert Mode``replace`
[](https://i.stack.imgur.com/DmRj6.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T14:01:13.123 | 2022-11-25T14:01:13.123 | null | null | 17,779,786 | null |
74,573,975 | 2 | null | 74,573,374 | 0 | null | The problem is that your `Year` variable is in character format. If you change it to a numeric format, you will get your desired output:
```
library(reshape2)
library(ggplot2)
mabar <- melt(ma, id.vars = c("Year"),
measure.vars = c("ValueWW", "ValueUS"))
ggplot(mabar, aes(x = as.numeric(Year), y = value, fill = variable)) +
geom_area(position = "fill", colour = "black", size = .2, alpha = .4) +
scale_fill_brewer(palette = "Blues") +
labs(x = 'Year')
```

[reprex v2.0.2](https://reprex.tidyverse.org)
---
Please note, I had to put your `dput` through online OCR to convert the image to text, then tidy it by hand. It is much easier to select the output as text, copy it, and paste it into your question as text:
```
ma <- structure(list(Year = c("1985", "1986", "1987", "1988", "1989",
"1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997",
"1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005",
"2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013",
"2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021"
), NumberWW = c(2676, 4228, 5279, 7440, 10135, 10814, 14722,
14102, 14772, 16816, 20278, 24310, 26227, 30218, 33132, 39783,
31047, 27201, 29573, 32953, 36025, 41407, 47455, 45173, 40710,
44844, 43976, 41480, 39568, 43847, 48052, 49991, 53302, 50607,
49327, 44926, 52000), ValueWW = c(347, 435, 506, 777, 758, 540,
397, 400, 516, 624, 1039, 1217, 1824, 2678, 4116, 3623, 1866,
1242, 1411, 2145, 2794, 4023, 4920, 3075, 2187, 2750, 2668, 2533,
2536, 3960, 4779, 3646, 3777, 3393.563, 3370.106, 2817.39, 4898
), NumberUS = c(2309, 3447, 3708, 4443, 5840, 5982, 5702, 5915,
6782, 8076, 9368, 11856, 13147, 14780, 13245, 14114, 9652, 8571,
9272, 10744, 11436, 13019, 13999, 11731, 9466, 10191, 10536,
10629, 10877, 12283, 12885, 13430, 15558, 14936, 17759, 15271,
21000), ValueUS = c(305.64, 353.54, 373.17, 586.05, 466.09, 254.16,
176.99, 185.13, 317.61, 414.7, 666.58, 750.39, 1116.22, 1816.41,
2138.18, 1965.81, 1010.58, 520.54, 668.86, 1006.42, 1342.1, 1843.89,
1967.06, 1215.09, 877.61, 981.8, 1247.04, 995.65, 1214.79, 2153.8,
2417.39, 1784.77, 1761.54, 1931.81, 1887.57, 1125.82, 2587),
GDPUS = c(4579.6325, 4855.21625, 5236.438, 5641.5795, 5963.1445,
6158.12925, 6520.32725, 6858.5585, 7287.2365, 7639.74925,
8073.12175, 8577.5525, 9062.81675, 9631.17175, 10250.952,
10581.929, 10929.10825, 11456.4495, 12217.19575, 13039.197,
13815.583, 14474.227, 14769.8615, 14478.06675, 15048.97,
15599.73175, 16253.97, 16843.19575, 17550.68775, 18206.0235,
18695.10575, 19477.3365, 20533.0575, 21380.976, 21060.47425,
23315.08125, 23315.08125)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -37L))
```
| null | CC BY-SA 4.0 | null | 2022-11-25T14:03:59.757 | 2022-11-25T14:03:59.757 | null | null | 12,500,315 | null |
74,574,021 | 2 | null | 74,566,651 | 0 | null | I figured it out. When making the "PlayerControls Input Action" I forgot to also click "generate C# class".
This makes sure that all the stuff I set up in the GUI, is applied into the C# script.
| null | CC BY-SA 4.0 | null | 2022-11-25T14:07:39.057 | 2022-11-25T14:07:39.057 | null | null | 20,594,385 | null |
74,574,182 | 2 | null | 66,253,521 | 0 | null | Hopefully this will work for you (it worked for me). I'm on Kubuntu 22.04, I had to manually download yt-dlp:
```
mkdir -p ~/.local/share/ClipGrab/ClipGrab
wget -P ~/.local/share/ClipGrab/ClipGrab/ \
https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp
```
After that clipgrab started working
| null | CC BY-SA 4.0 | null | 2022-11-25T14:22:24.467 | 2022-11-25T14:22:24.467 | null | null | 4,257,121 | null |
74,574,228 | 2 | null | 74,574,159 | 0 | null | You need to work on few things here.
First, check the records in the table, Do you really have 3 records? because As per your code it should work for 3 buttons.
Second, you are not setting the text of the button.
Use `using` with the `SqlConnection` and `SqlCommand` objects while initialling it.
And please define your connection string in some config file.
| null | CC BY-SA 4.0 | null | 2022-11-25T14:26:46.723 | 2022-11-25T14:26:46.723 | null | null | 6,527,049 | null |
74,574,311 | 2 | null | 26,459,419 | 0 | null | Switched website form https to http and had the issue come up. Updated the request config by commenting the below lines to resolve.
```
'request' => [
'cookieValidationKey' => 'SomeRandomKeyValidationString',
//'csrfCookie' => [
// 'httpOnly' => true,
// 'secure' => true,
//],
```
| null | CC BY-SA 4.0 | null | 2022-11-25T14:33:44.363 | 2022-11-25T14:33:44.363 | null | null | 3,501,144 | null |
74,574,441 | 2 | null | 74,570,361 | 1 | null | If you remove the first and second `.navigationBarTitleDisplayMode(.large)` & change your .searchable to `.searchable(text: $text, placement: .navigationBarDrawer(displayMode: .always))` it should work.
Tested and working code:
```
struct FirstView: View {
init() {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = .red
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().compactAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
}
var body: some View {
NavigationStack {
List {
NavigationLink("View 2") {
SecondView()
}
}.navigationBarTitle("View 1")
}
}
}
struct SecondView: View {
@State var text: String = ""
var body: some View {
List {
NavigationLink("View 3") {
ThirdView()
}
}.navigationTitle("View 2")
.searchable(text: $text, placement: .navigationBarDrawer(displayMode: .always))
}
}
struct ThirdView: View {
var body: some View {
Text("View 3")
.navigationTitle("View 3")
.navigationBarTitleDisplayMode(.inline)
}
}
struct TestView_Previews: PreviewProvider {
static var previews: some View {
TestView()
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-25T14:45:21.890 | 2022-11-25T14:46:06.997 | 2022-11-25T14:46:06.997 | 20,263,035 | 20,263,035 | null |
74,574,592 | 2 | null | 74,574,159 | 0 | null | To counter the issue I was facing, which ended up being buttons having no text and all displaying on top of each other, I added a FlowLayoutPanel and added the buttons(controls) into. Thanks for the previous answers that helped me solve this.
```
private void button7_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"connstring");
string strsql;
strsql = "SELECT buttonID from table1 ";
SqlCommand cmd = new SqlCommand(strsql, conn);
SqlDataReader reader = null;
cmd.Connection.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
Button newButton = new Button();
newButton.Text = reader["buttonID"].ToString();
newButton.Size = new Size(100, 50);
this.Controls.Add(newButton);
flowLayoutPanel1.Controls.Add(newButton);
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-25T14:58:26.737 | 2022-11-25T14:58:26.737 | null | null | 20,575,215 | null |
74,574,725 | 2 | null | 74,574,544 | 2 | null | Your best bet here is to pivot your data into long format. We don't your data, but we can reproduce a similar data set like this:
```
set.seed(1)
df <- data.frame(cfs_triage = sample(10, 1322, TRUE, prob = 1:10),
cfs_silver = sample(10, 1322, TRUE),
cfs_student = sample(10, 1322, TRUE, prob = 10:1))
df[] <- lapply(df, function(x) { x[sample(1322, 300)] <- NA; x})
```
Now the dummy data set looks a lot like yours:
```
head(df)
#> cfs_triage cfs_silver cfs_student
#> 1 9 NA 1
#> 2 8 4 2
#> 3 NA 8 NA
#> 4 NA 10 9
#> 5 9 5 NA
#> 6 3 1 NA
```
If we pivot into long format, then we will end up with two columns: one containing the values, and one containing the column name that the value belonged to in the original data frame:
```
library(tidyverse)
df_long <- df %>%
pivot_longer(everything())
head(df_long)
#> # A tibble: 6 x 2
#> name value
#> <chr> <int>
#> 1 cfs_triage 9
#> 2 cfs_silver NA
#> 3 cfs_student 1
#> 4 cfs_triage 8
#> 5 cfs_silver 4
#> 6 cfs_student 2
```
This then allows us to plot with `value` on the x axis, and we can use `name` as a grouping / fill variable:
```
ggplot(df_long, aes(value, fill = name)) +
geom_bar(position = 'dodge') +
scale_fill_grey(name = NULL) +
theme_bw(base_size = 16) +
scale_x_continuous(breaks = 1:10)
#> Warning: Removed 900 rows containing non-finite values (`stat_count()`).
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-11-25T15:11:50.077 | 2022-11-25T15:11:50.077 | null | null | 12,500,315 | null |
74,574,781 | 2 | null | 74,574,710 | 0 | null | make sure parent component passing function `addPost`
```
<MyPosts addPost={()=>{}} />
```
| null | CC BY-SA 4.0 | null | 2022-11-25T15:16:29.850 | 2022-11-25T15:16:29.850 | null | null | 8,818,565 | null |
74,575,130 | 2 | null | 74,574,544 | 2 | null | Maybe you need something like this: The formatting was taken from @Allan Cameron (many Thanks!):
[](https://i.stack.imgur.com/8BTEp.png)
```
library(tidyverse)
library(scales)
df %>%
mutate(id = row_number()) %>%
pivot_longer(-id) %>%
group_by(id) %>%
mutate(percent = value/sum(value, na.rm = TRUE)) %>%
mutate(percent = ifelse(is.na(percent), 0, percent)) %>%
mutate(my_label = str_trim(paste0(format(100 * percent, digits = 1), "%"))) %>%
ggplot(aes(x = factor(name), y = percent, fill = factor(name), label = my_label))+
geom_col(position = position_dodge())+
geom_text(aes(label = my_label), vjust=-1) +
facet_wrap(. ~ id, nrow=1, strip.position = "bottom")+
scale_fill_grey(name = NULL) +
scale_y_continuous(labels = scales::percent)+
theme_bw(base_size = 16)+
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
```
| null | CC BY-SA 4.0 | null | 2022-11-25T15:47:25.987 | 2022-11-25T15:47:25.987 | null | null | 13,321,647 | null |
74,575,291 | 2 | null | 74,523,496 | 0 | null | This make me think of a similar problem that I had. You could compute the of the shape. The signature can be defined as, for each pixel of the border of the shape, the distance between this pixel and the center of the shape.
For a perfect circle, the distance from the border to the center should be constant (in an ideal continuous world). When defects are visible on the edge of the circle (either dents or excesses), the ideal constant line changes to a wiggly curve, with huge variation when on the defects.
It's fairly easy to detect those variation with FFT for example, which allows to quantify the defect significance.
You can expand this solution to any given shape. If your ideal shape is a square, you can compute the signature, which will give you some kind of sinusoidal curve. Defects will appear in a same way on the curve, and would be detectable with the same logic as with a circle.
[](https://i.stack.imgur.com/qkuRb.png)
I can't give you an code example, as the project was for a company project, but the idea is still here.
| null | CC BY-SA 4.0 | null | 2022-11-25T16:00:56.593 | 2022-11-25T16:00:56.593 | null | null | 16,601,101 | null |
74,576,028 | 2 | null | 74,417,586 | 0 | null | I figured it out, for anyone else who runs into this issue. Vercel doesn't work with github lfs! I ended up hosting the video via a 3rd party (I used cloudflare) and imported it via url.
UPDATE
**
Cloudflare stream doesn't allow inline css alterations, so was unable to efficiently set it as a background video, as to it was stuck to a set aspect size, and refused to cover entire viewport at certain screen sizes.
I fixed this by using Vimeo Video hosting instead, though had to get a standard account. Vimeo worked fantastic for this use case.
| null | CC BY-SA 4.0 | null | 2022-11-25T17:10:14.170 | 2022-12-05T04:04:43.677 | 2022-12-05T04:04:43.677 | 20,489,341 | 20,489,341 | null |
74,576,191 | 2 | null | 74,576,143 | 1 | null | you're calling it as a `Function`, but you can get the current user information directly with `currentUser`, not `currentUser()`:
```
final _auth = FirebaseAuth.instance;
_auth.currentUser(); // wrong way
_auth.currentUser; // right way
```
`currentUser()` doesn't exist, `currentUser` does.
| null | CC BY-SA 4.0 | null | 2022-11-25T17:27:59.570 | 2022-11-25T17:27:59.570 | null | null | 18,670,641 | null |
74,576,315 | 2 | null | 74,576,129 | 0 | null | IIUC, there is no need for functions and/or loops here since you can use [pandas.Series.str.join](https://pandas.pydata.org/docs/reference/api/pandas.Series.str.join.html) to get your expected column/output :
```
course_name_skills["hard skills"]= course_name_skills["skills"].str.join(",")
```
`hard skills`
```
course_name_skills["hard skills"]= (
course_name_skills["skills"]
.str.strip("[]")
.replace({"'": "", "\s+": ""}, regex=True)
)
```
| null | CC BY-SA 4.0 | null | 2022-11-25T17:41:55.497 | 2022-11-25T17:47:23.387 | 2022-11-25T17:47:23.387 | 16,120,011 | 16,120,011 | null |
74,576,320 | 2 | null | 74,576,041 | 2 | null | `geom_col` is essentially just `geom_bar` with `stat = stat_identity()`. It doesn't add up multiple values if they are in the same fill group and on the same point of the x axis. We can confirm this by giving the columns an outline and making them partially transparent:
```
d %>%
ggplot(aes(study, score, group = as.factor(year))) +
geom_col(aes(fill = as.factor(year)), position = position_dodge(),
color = 'black', alpha = 0.3) +
scale_y_continuous(limits = c(0,30))
```
[](https://i.stack.imgur.com/qQKeP.png)
Notice that the bars are simply overlaid on each other.
When you say:
> After reading a bit about it, `geom_col()` should indeed take the sum of the values in case multiple value per group are given
Can you show us where you read this?
| null | CC BY-SA 4.0 | null | 2022-11-25T17:42:56.417 | 2022-11-25T17:42:56.417 | null | null | 12,500,315 | null |
74,576,336 | 2 | null | 74,576,129 | 0 | null | ```
df['skills'] = df['hard skills'].str.split(',').apply(
lambda skills: [skill.strip() for skill in skills]
)
```
And if you want to add filtering:
```
skills = list(set(df['skills'].sum()))
for skill in skills:
df[skill] = df['skills'].apply(lambda x: skill in x)
df.loc[df['Data Analysis']==True]['course_name']
```
| null | CC BY-SA 4.0 | null | 2022-11-25T17:44:20.840 | 2022-11-25T18:46:38.833 | 2022-11-25T18:46:38.833 | 9,650,095 | 9,650,095 | null |
74,576,422 | 2 | null | 74,575,519 | 0 | null | In order to install ReactJS on MacOS, you must first have NodeJS and NPM installed.
The only way you can install NodeJS is through their official website: [https://nodejs.org/](https://nodejs.org/).
Installing NodeJS will also automatically download NPM on your machine.
The you can check if the installation was successful:
‘’’
node —version
npm —version
‘’’
If its successful you should get the version.
Than to install react you run this command:
‘’’
npm install --save react react-dom
‘’’
And to create the project:
‘’’
npm create-react-app nameOfProject
,,,
| null | CC BY-SA 4.0 | null | 2022-11-25T17:52:10.520 | 2022-11-30T14:26:55.603 | 2022-11-30T14:26:55.603 | 20,337,580 | 20,337,580 | null |
74,576,769 | 2 | null | 30,572,834 | 0 | null | cx_Freeze does not recognize Reportlab because the folder in which Reportlab is installed is different from the folder in which it searches. I changed the Reportlab installation folder and put it in the same folder where the cx_Freeze files were and it worked for me
| null | CC BY-SA 4.0 | null | 2022-11-25T18:33:50.537 | 2022-11-25T18:33:50.537 | null | null | 19,579,690 | null |
74,576,937 | 2 | null | 74,574,559 | 1 | null | What really complicates your solution is you're modifying the state while calculating the layout (in the `v-for` loop).
When you change the value of state, everything that uses that piece of reactive state gets recalculated (including the items that have already been looped through).
It's an anti-pattern, for a couple of reasons:
- -
The fact you asked the question is proof to it. I'm confident you'd have figured out the function below by yourself, had you not modified the state inside the loop.
---
What you need is:
- `count`- `md:col-span-${x}``count``index`
```
const count = ref(8)
const getMdClass = (index) => {
const rest = count.value % 3;
if (index > count.value - rest - 1) {
return `md:col-span-${12 / rest}`;
}
return "md:col-span-4";
}
```
This function returns `md:col-span-4` all the time, except:
- `md:col-span-6``(3 x n) + 2`- `md:col-span-12``(3 x n) + 1`
Here's a [proof of concept](https://codesandbox.io/s/charming-grass-ctmng2?file=/src/components/Layout.vue) (haven't used typescript or `<script setup>`, but the logic is there). I made `count` a prop so it could be interacted with.
: the function is slightly modified in the sandbox because I've used `v-for="n in count"`, which is `1`-based, not `0`-based.
| null | CC BY-SA 4.0 | null | 2022-11-25T18:53:49.890 | 2022-11-25T20:07:22.853 | 2022-11-25T20:07:22.853 | 1,891,677 | 1,891,677 | null |
74,577,167 | 2 | null | 74,577,113 | 0 | null | I think you misunderstand how to use a many-to-many relation.
Only insert rows to the many-to-many relationship if there is a non-null value for both vehicle and armament.
If you have a case where a vehicle doesn't have a given armament, then just
Then you can declare both columns as NOT NULL in your table:
```
CREATE TABLE IF NOT EXISTS `mydb`.`Vehicles_has_Armament` (
`vehicle_ID` INT NOT NULL,
`armament_ID` INT NOT NULL,
PRIMARY KEY (`vehicle_ID`, `armament_ID`),
...
```
How to many a many-to-many relation "optional" is to insert rows only for pairings that are known to exist.
| null | CC BY-SA 4.0 | null | 2022-11-25T19:24:35.453 | 2022-11-25T19:24:35.453 | null | null | 20,860 | null |
74,577,251 | 2 | null | 74,577,033 | 0 | null | Here is a base SAS solution.
You can sort by `balance` then output odd rows to one data set and even rows to the other. This should ensure that they have roughly equal number of observations, and the sum of balance should be as equal as possible.
```
* create the input data;
data have;
input account $ balance;
datalines;
9999 110
9998 111
9997 112
9996 113
9995 114
9994 115
9993 116
9992 117
9991 118
9990 119
;
run;
* sort by balance;
proc sort data=have;
by balance;
run;
* output odd rows to split1, even rows to split2;
data split1 split2;
set have;
if mod(_n_,2) then output split1;
else output split2;
run;
```
| null | CC BY-SA 4.0 | null | 2022-11-25T19:36:39.473 | 2022-11-25T19:36:39.473 | null | null | 18,289,387 | null |
74,577,487 | 2 | null | 8,881,453 | 0 | null | This may help some people but may not answer the question. In my case, the problem was solved because I forgot to add the model to the correct configuration. See the screenshot attached. All the models are added to the default configuration, but my application uses the private configuration. Drag and drop your model from the default configuration to the correct configuration.
[](https://i.stack.imgur.com/eJ9P7.png)
| null | CC BY-SA 4.0 | null | 2022-11-25T20:09:36.060 | 2022-11-25T20:09:36.060 | null | null | null | null |
74,577,963 | 2 | null | 74,563,859 | 0 | null | It is totally possible to access functions through "ControlBar"
Example: Copy Selection
```
Sub TestContolExecution()
CommandBars("Standard").Controls("Copy").Execute
End Sub
```
The trick is to figure out what the control's Name or ID is.
This is how I figured mine out:
```
Sub FindControlBars()
Dim I As Integer
For I = 1 To 176
Debug.Print CommandBars(I).Name
Next I
End Sub
Sub FindControls()
Dim I As Integer
For I = 1 To 17
Debug.Print CommandBars("Standard").Controls(I).Caption
Next I
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-11-25T21:25:46.853 | 2022-11-25T21:25:46.853 | null | null | 16,826,729 | null |
74,578,112 | 2 | null | 74,523,496 | 0 | null | Here is one way to do that in Python/OpenCV.
- - - - - - - -
Input:
[](https://i.stack.imgur.com/vjrOA.png)
```
import cv2
import numpy as np
# Read image
img = cv2.imread('circle_defect.png')
hh, ww = img.shape[:2]
# threshold on white to remove red arrow
lower = (255,255,255)
upper = (255,255,255)
thresh = cv2.inRange(img, lower, upper)
# get Hough circles
min_dist = int(ww/5)
circles = cv2.HoughCircles(thresh, cv2.HOUGH_GRADIENT, 1, minDist=min_dist, param1=150, param2=15, minRadius=0, maxRadius=0)
print(circles)
# draw circles on input thresh (without red arrow)
circle_img = thresh.copy()
circle_img = cv2.merge([circle_img,circle_img,circle_img])
for circle in circles[0]:
# draw the circle in the output image, then draw a rectangle
# corresponding to the center of the circle
(x,y,r) = circle
x = int(x)
y = int(y)
r = int(r)
cv2.circle(circle_img, (x, y), r, (0, 0, 255), 1)
# draw filled circle on black background
circle_filled = np.zeros_like(thresh)
cv2.circle(circle_filled, (x,y), r, 255, -1)
# get difference between the thresh image and the circle_filled image
diff = cv2.absdiff(thresh, circle_filled)
# apply morphology to remove ring
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5,5))
result = cv2.morphologyEx(diff, cv2.MORPH_OPEN, kernel)
# count non-zero pixels
defect_count = np.count_nonzero(result)
print("defect count:", defect_count)
# save results
cv2.imwrite('circle_defect_thresh.jpg', thresh)
cv2.imwrite('circle_defect_circle.jpg', circle_img)
cv2.imwrite('circle_defect_circle_diff.jpg', diff)
cv2.imwrite('circle_defect_detected.png', result)
# show images
cv2.imshow('thresh', thresh)
cv2.imshow('circle_filled', circle_filled)
cv2.imshow('diff', diff)
cv2.imshow('result', result)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
Input without Red Arrow:
[](https://i.stack.imgur.com/gDOQ6.jpg)
Red Circle Drawn on Input:
[](https://i.stack.imgur.com/MOqoM.jpg)
Circle from HoughCircle:
[](https://i.stack.imgur.com/nILFX.jpg)
Difference:
[](https://i.stack.imgur.com/o8p2D.jpg)
Difference Cleaned Up:
[](https://i.stack.imgur.com/skx9e.png)
Textual Result:
```
defect count: 500
```
| null | CC BY-SA 4.0 | null | 2022-11-25T21:52:16.107 | 2022-11-25T21:52:16.107 | null | null | 7,355,741 | null |
74,578,177 | 2 | null | 52,746,555 | 0 | null | Adding this to the style file. it works.
```
.mat-table {
overflow-x: scroll;
display: table;
width: 100%;
}
.mat-cell,
.mat-header-cell {
word-wrap: initial;
display: table-cell;
padding: 0px 4px 4px 4px;
line-break: unset;
width: auto;
white-space: nowrap;
overflow: hidden;
vertical-align: middle;
}
.mat-row,
.mat-header-row {
display: table-row;
}
```
| null | CC BY-SA 4.0 | null | 2022-11-25T22:05:00.570 | 2022-11-25T22:10:43.093 | 2022-11-25T22:10:43.093 | 20,602,825 | 20,602,825 | null |
74,578,245 | 2 | null | 74,525,474 | 0 | null | I have found the solution.
The problem was that I was adding the implementation text line in the gradle:app but I should have added it in the setting.gradle.
I hope my answer can help other people who find the same problem.
Regards!
| null | CC BY-SA 4.0 | null | 2022-11-25T22:15:20.590 | 2022-11-25T22:15:20.590 | null | null | 9,019,362 | null |
74,578,338 | 2 | null | 24,727,290 | 0 | null | Something similar happened to me, the context was this: through the view I was loading a file through an input. When I tried to save the file to a folder, I got this error. I use laravel 9 with livewire.
In the end I just had to use the methods provided by liveware:
```
$filename = time() . $this->documento->getClientOriginalName();
$this->documento->storeAs('documents', $filename, 'public');
```
Fuentes: [https://laravel-livewire.com/docs/2.x/file-uploads](https://laravel-livewire.com/docs/2.x/file-uploads)
| null | CC BY-SA 4.0 | null | 2022-11-25T22:32:11.773 | 2022-11-25T22:32:11.773 | null | null | 20,135,595 | null |
74,578,804 | 2 | null | 16,784,703 | 1 | null | Recompile only selected files:
1. Select packages or files that needs to be compiled.
2. Menu → Build → Recompile selected files (⇧ ⌘ F9)
If you need to run or debug, you need to set `Do not build before run`:
1. Menu → Run → Edit Configurations...
2. ☑︎ Your target run configuration
3. Run / Modify options → Java / ☑︎ Do not build before run
| null | CC BY-SA 4.0 | null | 2022-11-26T00:14:29.150 | 2022-11-26T01:43:17.930 | 2022-11-26T01:43:17.930 | 1,260,976 | 1,260,976 | null |
74,578,837 | 2 | null | 61,180,304 | -1 | null | I had this problem when I uninstalled JDK and re installed it, and when I was making a new project I had the uninstalled JDK file selected, which somehow caused the system to be in red and un run-able.
| null | CC BY-SA 4.0 | null | 2022-11-26T00:21:47.347 | 2022-11-26T00:21:47.347 | null | null | 20,603,321 | null |
74,579,215 | 2 | null | 47,948,741 | 0 | null | The steps are as follows:
1. Set Do not build before run (only need to set it once) Menu → Run → Edit Configurations... ☑︎ Your run configuration Run / Modify options → Java / ☑︎ Do not build before run
2. Recompile only selected files (remember to do this step before run) Select packages or files that needs to be compiled. Menu → Build → Recompile selected files (⇧ ⌘ F9)
3. Run or debug your run configuration.
| null | CC BY-SA 4.0 | null | 2022-11-26T02:03:36.037 | 2022-11-26T02:03:36.037 | null | null | 1,260,976 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.