Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
⌀ | ParentId
int64 1.68k
75.6M
⌀ | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
⌀ | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
⌀ | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 1
21.3M
⌀ | Tags
list |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
73,933,706 | 2 | null | 73,933,480 | 0 | null | For SSH connection you should to use linux system user with password (or ssh key) not database user.
After SSH connection established you put Database user and password on the 'Main' tab, using localhost as Host
[](https://i.stack.imgur.com/wpg0r.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T09:48:18.100 | 2022-10-03T09:48:18.100 | null | null | 3,399,356 | null |
73,933,856 | 2 | null | 9,977,196 | 0 | null | The `UIStepper` has changed significantly since this question was answered. While you can still walk the view hierarchy looking for buttons if you like, this kind of solution is prone to failing when the OS updates since Apple frequently change the view hierarchy of their custom controls.
The official way to change the appearance of `UIStepper` objects is using four functions on `UIStepper` instances: `setBackgroundImage()`, `setDividerImage()`, `setIncrementImage()` and `setDecrementImage()`. All of these accept an image and a control state, which is nice since it means you can customise the control for when it is disabled, selected and so forth. It does, however, mean you have to make a lot of annoying surplus images.
I have a nice little extension on UIImage for making suitable images from simple colours (note that I'm also using a custom Error - I won't bore you with how to make those!)
```
extension UIImage {
static func create(size: CGSize, color: UIColor, scale: CGFloat = 1) throws -> UIImage {
let trueSize = size * scale
UIGraphicsBeginImageContext(trueSize)
defer { UIGraphicsEndImageContext() }
guard let ctx = UIGraphicsGetCurrentContext() else {
throw AppError.cannotProcessImage
}
color.setFill()
ctx.fill(CGRect(origin: .zero, size: trueSize))
guard let image = UIGraphicsGetImageFromCurrentImageContext() else {
throw AppError.cannotProcessImage
}
if scale == 1 { return image }
guard let cgimage = image.cgImage else {
throw AppError.cannotProcessImage
}
return UIImage(cgImage: cgimage, scale: scale, orientation: image.imageOrientation)
}
}
```
Now I need to make and assign the background and divider images. Note that I'm using some custom colours from an asset catalogue so I can support Dark Mode.
```
private func updateColours() {
let scale = UIScreen.main.scale
let bgColor = UIColor(named: "Colors/BackdropC")!
let bgSize = stepper.bounds.size
let background = try! UIImage.create(size: bgSize, color: bgColor, scale: scale)
stepper.setBackgroundImage(background, for: .normal)
let dividerColor = UIColor(named: "Colors/TitleText")!
let dividerSize = CGSize(width: 1, height: bgSize.height)
let divider = try! UIImage.create(size: dividerSize, color: dividerColor)
stepper.setDividerImage(divider, forLeftSegmentState: .normal, rightSegmentState: .normal)
}
```
I can use a little trick when setting the increment and decrement images. I simply copy the existing ones, and set them to rendering mode 'alwaysTemplate'. This will cause them to echo the control's tint colour:
```
let incImage = stepper.incrementImage(for: .normal)?.withRenderingMode(.alwaysTemplate)
stepper.setIncrementImage(incImage, for: .normal)
let decImage = stepper.decrementImage(for: .normal)?.withRenderingMode(.alwaysTemplate)
stepper.setDecrementImage(decImage, for: .normal)
```
Of course, all of this malarkey only sets the images for `normal` mode, and holding one of the buttons will make things change slightly, so you might want to set different images for the `highlighted` state at the least. The divider is a particular sticking point as it has FOUR possible states, depending on whether left, right, both or neither buttons are being depressed. I won't go into that here.
One final thing to note though is that I'm allowing dark mode in my app. Images created from asset-based colours won't automatically change when dark mode is turned on or off, so we have to do that manually by calling the above function from `traitCollectionDidChange`
```
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
self.updateColours()
}
```
So, as you can see, UIStepper is now very customisable, but to customise everything you need to change a LOT of images manually. It therefore might be slightly less painful to simply make your own version of UIStepper from a couple of buttons.
| null | CC BY-SA 4.0 | null | 2022-10-03T10:04:17.353 | 2022-10-03T10:04:17.353 | null | null | 414,476 | null |
73,933,927 | 2 | null | 73,041,587 | 0 | null | Had similar experience and these are the steps I took.
If you've push the project to github or any source control system, copy the package.json file in the repo, delete the corrupted package.json file in the project folder, then paste the copied package.json file on your project folder.
| null | CC BY-SA 4.0 | null | 2022-10-03T10:10:57.977 | 2022-10-03T10:10:57.977 | null | null | 19,522,786 | null |
73,934,574 | 2 | null | 71,844,778 | 0 | null | as far as I know this is the only way.
The answer from priya-sindkar is only applicable to "One-time codes" (i.e. codes that can be used once and by a single user to install or get your 1-time IAP for free).
For "Custom Codes" (i.e. the code that can be used by many users to get an extended free trial) it seems that the only way is the one described in the question, and a further restriction is that the workflow must be done from within the app itself, just before paying for the subscription as described on [this answer](https://support.google.com/googleplay/android-developer/answer/6321495) from Google support.
| null | CC BY-SA 4.0 | null | 2022-10-03T11:10:43.180 | 2022-10-03T11:10:56.433 | 2022-10-03T11:10:56.433 | 1,953,274 | 1,953,274 | null |
73,934,800 | 2 | null | 58,351,489 | 0 | null | You need to open Update policies settings and set the policy you want to use to "Enabled" (the default is "Follow Office Preview").
[enter image description here][1]
[1]: [MS Teams Update policy](https://i.stack.imgur.com/2UytG.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T11:31:29.423 | 2022-10-03T12:04:17.520 | 2022-10-03T12:04:17.520 | 7,126,426 | 7,126,426 | null |
73,934,843 | 2 | null | 18,796,221 | 0 | null | Here is a simple solution without any plugins. Only html and some jquery.
You can save following code sample as a html file and test it.
```
function myFunction() {
$("#dropdown-values").addClass("show");
}
$(document).click(function(e) {
if( e.target.id != 'myInput') {
$("#dropdown-values").removeClass("show");
}
});
function filterFunction() {
var input, filter, a, i;
filter = $("#myInput").val().toUpperCase();
div = document.getElementById("myDropdown");
a = div.getElementsByTagName("a");
for (i = 0; i < a.length; i++) {
txtValue = a[i].textContent || a[i].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
a[i].style.display = "";
} else {
a[i].style.display = "none";
}
}
}
function setValueOfInput(e) {
$("#myInput").val(e.innerHTML);
}
```
```
.dropdown-content {
position: absolute;
background-color: #f6f6f6;
overflow: auto;
}
.dropdown-content a {
color: black;
padding: 10px 16px;
text-decoration: none;
display: block;
}
.dropdown a:hover {background-color: #ddd;}
.show {display: block !important;}
.dropdown-values{
display: none;
}
```
```
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h2>Dropdown with search</h2>
<div class="dropdown">
<div id="myDropdown" class="dropdown-content">
<input type="text" placeholder="Search.." id="myInput" onkeyup="filterFunction()" onclick="myFunction()">
<div id="dropdown-values" class="dropdown-values">
<a onclick="setValueOfInput(this)">option 1</a>
<a onclick="setValueOfInput(this)">option 2</a>
<a onclick="setValueOfInput(this)">option 3</a>
<a onclick="setValueOfInput(this)">option 4</a>
<a onclick="setValueOfInput(this)">option 5</a>
</div>
</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-10-03T11:35:22.380 | 2022-10-03T11:35:22.380 | null | null | 7,871,380 | null |
73,934,875 | 2 | null | 73,934,697 | 1 | null | You won't be able to align them when you print one after the other.
The egg has new line characters in it which means that something printed after it will always be underneath it.
The simple solution to this is to print the cat and the egg at the same time i.e. have the cat and egg in the same string.
Update:
To Achieve what (I think) you want to do, all you need is to have a token that you replace with whitespace to make the cat move closer to the egg e.g.:
```
public static class CatAndEgg
{
private const string ReplacementString = "[SPACES]";
private const string Image = @" [SPACES] _,'| _.-''``-...___..--';
[SPACES] /_ \\'. __..-' , ,--...--'''
___ [SPACES] <\\ .`--''' ` /'
/ \\[SPACES] `-';' ; ; ;
|’ |[SPACES] __...--'' ___...--_..' .;.'
\\___/ [SPACES](,__....----''' (,..--'' ";
public static void PrintImageWithSpaces(int numberOfSpaces)
{
string spaces = new(' ', numberOfSpaces);
Console.Write(Image.Replace(ReplacementString, spaces));
Console.Write(Environment.NewLine);
}
public static void DoAnimation()
{
PrintImageWithSpaces(20);
Task.Delay(200).Wait();
PrintImageWithSpaces(15);
Task.Delay(200).Wait();
PrintImageWithSpaces(10);
Task.Delay(200).Wait();
PrintImageWithSpaces(5);
Task.Delay(200).Wait();
PrintImageWithSpaces(0);
}
}
```
The method `PrintImageWithSpaces()` prints the cat and the egg with the specified number of spaces between them. By staring off with x number of spaces and then reducing the number of spaces each time you call `PrintImageWithSpaces()`, the cat moves closer to the egg.
Calling `DoAnimation()` would provide an example of the animation that you want.
i.e.:
```
public static void Main()
{
//Animation Example
CatAndEgg.DoAnimation();
//Manually Move cat closer to egg
CatAndEgg.PrintImageWithSpaces(10);
Task.Delay(200).Wait();
CatAndEgg.PrintImageWithSpaces(5);
Task.Delay(200).Wait();
CatAndEgg.PrintImageWithSpaces(0);
}
```
Note: the time delays are added in the above code so you can see the prints gradually added but you wouldn't need them if you print each time a user inputs a wrong answer.
| null | CC BY-SA 4.0 | null | 2022-10-03T11:38:01.607 | 2022-10-05T14:05:41.930 | 2022-10-05T14:05:41.930 | 19,214,431 | 19,214,431 | null |
73,935,020 | 2 | null | 70,398,678 | 0 | null | In my case a not used component importing led to the error. Simply remove unwanted component imported.
> import {ReactDOM} from "React"
| null | CC BY-SA 4.0 | null | 2022-10-03T11:50:13.973 | 2022-10-03T11:50:13.973 | null | null | 9,117,945 | null |
73,935,725 | 2 | null | 73,663,628 | 0 | null | After some investigation, a solution could be to set to false the HasNavigationBar property into ReactiveContentPage xaml file. So, for example:
```
<rxui:ReactiveContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:rxui="clr-namespace:ReactiveUI.Maui;assembly=ReactiveUI.Maui"
xmlns:vm="clr-namespace:MySpace.Maui.ViewModels"
x:DataType="vm:FirstViewModel"
x:TypeArguments="vm:FirstViewModel"
x:Class="MySpace.Maui.Views.Tab1Page"
NavigationPage.HasNavigationBar="False"
Title="">
<rxui:ReactiveContentPage.Content>
"Here your stuff"
</rxui:ReactiveContentPage.Content>
</rxui:ReactiveContentPage>
```
| null | CC BY-SA 4.0 | null | 2022-10-03T12:48:55.837 | 2022-10-03T12:48:55.837 | null | null | 3,132,789 | null |
73,935,776 | 2 | null | 25,860,017 | 0 | null | You can use 'ThreadCount' to test if it is 0. Zombie processes have 0 because any normal process has at least 1.
Another possibility is to use 'OpenProcess' and ask 'GetExitCodeProcess'. If the process is running it will return 'STILL_ACTIVE' while Zombies will return their exit code. But this is a little bit slower than the first method. A bit unclear what happens if a process sets his exit code to 'STILL_ACTIVE'. I guess Win32 won't allow that.
| null | CC BY-SA 4.0 | null | 2022-10-03T12:53:22.920 | 2022-10-03T12:53:22.920 | null | null | 5,080,758 | null |
73,936,240 | 2 | null | 73,911,814 | 1 | null | This error occurs because `replace.all` is a method that was not available earlier. The replaceAll method is defined inside `lib.es2021.string.d.ts`
In your tsconfig.json, add this compiler options:
```
{
...,
"compilerOptions": {
...,
"lib": [
...,
"ES2021.String"
]
}
}
```
| null | CC BY-SA 4.0 | null | 2022-10-03T13:34:35.120 | 2022-10-03T13:34:35.120 | null | null | 17,632,251 | null |
73,936,413 | 2 | null | 38,104,560 | 0 | null | close this chrome extension worked for me.
[](https://i.stack.imgur.com/P6Bdw.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T13:47:49.193 | 2022-10-03T13:47:49.193 | null | null | 11,690,165 | null |
73,936,422 | 2 | null | 73,935,465 | 0 | null | Here's a fairly simple solution in `dplyr`. We first create a column finding the first measurement in each measurement group (rows where `is_measurement == 1` and the previous row `is_measurement == 0`). We do a cumulative sum of those to count groups, and multiply by `is_measurement` to 0 out the rows where `is_measurement == 0`:
```
library(dplyr)
df %>%
mutate(
is_first_measurement = is_measurement == 1 & lag(is_measurement == 0, default = 0),
measurement_id = cumsum(is_first_measurement) * is_measurement
)
```
| null | CC BY-SA 4.0 | null | 2022-10-03T13:48:27.100 | 2022-10-03T13:48:27.100 | null | null | 903,061 | null |
73,936,485 | 2 | null | 57,946,835 | 0 | null | Setting datetime-local input using javascript in Laravel Dusk:
```
$browser->script('
var dateString = "10/4/22 7:9:00 PM"
if (dateString !== "") {
var dateVal = new Date(dateString);
var day = dateVal.getDate().toString().padStart(2, "0");
var month = (1 + dateVal.getMonth()).toString().padStart(2, "0");
var hour = dateVal.getHours().toString().padStart(2, "0");
var minute = dateVal.getMinutes().toString().padStart(2, "0");
var sec = dateVal.getSeconds().toString().padStart(2, "0");
var ms = dateVal.getMilliseconds().toString().padStart(3, "0");
var inputDate = dateVal.getFullYear() + "-" + (month) + "-" + (day) + "T" + (hour) + ":" + (minute);
$("#deadline").val(inputDate);
}
');
```
| null | CC BY-SA 4.0 | null | 2022-10-03T13:53:20.060 | 2022-10-03T14:23:02.403 | 2022-10-03T14:23:02.403 | 4,257,737 | 4,257,737 | null |
73,936,511 | 2 | null | 73,936,100 | 0 | null | You're attaching the `onSnapshot` to `dbRef`, which is initialized as:
```
const dbRef = collection(db, "data");
...
onSnapshot(dbRef, (querySnapshot) => {
```
To listen only to the user's data, do:
```
onSnapshot(doc(dbRef, uid), (querySnapshot) => {
```
| null | CC BY-SA 4.0 | null | 2022-10-03T13:55:02.810 | 2022-10-03T13:55:02.810 | null | null | 209,103 | null |
73,936,627 | 2 | null | 73,936,417 | 0 | null | Without knowing how this is implemented, I can only give the "boilerplate" code at best.
```
import pandas as pd
data={'Name':['10000','Votes','12','10100', 'Votes', '13']}
Name = [data["Name"][i] for i in range(0,len(data["Name"]),3)]
Votes = [data["Name"][i] for i in range(2,len(data["Name"]),3)]
newData = {
"Name": Name,
"Votes": Votes
}
df = pd.DataFrame(newData)
print(df)
```
You would probably have to change this code around to work with your use case, but this is what I gathered from your question.
| null | CC BY-SA 4.0 | null | 2022-10-03T14:03:57.500 | 2022-10-03T14:03:57.500 | null | null | 6,586,516 | null |
73,936,682 | 2 | null | 73,936,417 | 1 | null | Heres one way using [np.roll](https://numpy.org/doc/stable/reference/generated/numpy.roll.html), but it might not catch all of the edge cases
```
is_votes = df.Name=="Votes"
pd.DataFrame({'Name':df.loc[np.roll(is_votes,-1),"Name"].values , 'Votes':df.loc[np.roll(is_votes,1),"Name"].values})
# Name Votes
#0 10000 12
# 10100 13
```
| null | CC BY-SA 4.0 | null | 2022-10-03T14:08:38.643 | 2022-10-03T14:08:38.643 | null | null | 2,077,270 | null |
73,936,713 | 2 | null | 73,933,455 | 3 | null | You are likely using Nvim v0.8.0 (released 3 days ago), which introduced several breaking changes and is incompatible with AstroNvim v1.10.0 (the current stable version; refer to [this discussion](https://github.com/AstroNvim/AstroNvim/discussions/1020)).
AstroNvim v2.0 was pushed to the project's nightly branch and will support the new Nvim release; however, seeing as it is currently unstable, for now your best option would be to .
| null | CC BY-SA 4.0 | null | 2022-10-03T14:11:18.030 | 2022-10-03T14:13:43.673 | 2022-10-03T14:13:43.673 | 11,151,907 | 11,151,907 | null |
73,936,722 | 2 | null | 73,936,638 | 1 | null | Looks like python, in which case exponentiation is higher precedence than unary minus. So writing -5 ** .5 is treated as -(5 ** .5)
| null | CC BY-SA 4.0 | null | 2022-10-03T14:11:44.000 | 2022-10-03T14:11:44.000 | null | null | 20,035,978 | null |
73,936,734 | 2 | null | 73,936,638 | 1 | null | In the [operator precedence](https://docs.python.org/3/reference/expressions.html#operator-precedence) table for Python, the `negative` operator (`-x`) has a lower precedence than the `exponentiation` operator (`**`).
Therefore,
```
-5 ** 0.5
```
is equivalent to
```
-(5 ** 0.5)
```
| null | CC BY-SA 4.0 | null | 2022-10-03T14:12:52.327 | 2022-10-03T14:42:44.233 | 2022-10-03T14:42:44.233 | 5,567,382 | 5,567,382 | null |
73,936,825 | 2 | null | 30,978,616 | 0 | null | ```
Object.entries(obj)
```
E.g.
```
const objVariable = {name: "Ted", job: "Dentist"}
const 2dArray = Object.entries(objVariable)
console.log(2dArray) // will print [["name", "Ted"], ["job", "Dentist"]]
```
Object.entries is a static method that belongs to the Object class. As a parameter, it accepts an object and returns a two-dimensional array.
Read more about it here: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries)
| null | CC BY-SA 4.0 | null | 2022-10-03T14:20:14.680 | 2022-10-03T14:20:14.680 | null | null | 19,200,142 | null |
73,937,014 | 2 | null | 73,778,517 | 0 | null | I'm getting the issue as well. It has something to do with the size of the image file.
I can't find any documentation on the size limits, so I don't know what they are.
But the image file itself has a size limit. So even if you resize it in code, it won't matter.
Update: PNG with size 145x145 seems to do the trick.
| null | CC BY-SA 4.0 | null | 2022-10-03T14:36:28.843 | 2022-10-10T21:31:40.240 | 2022-10-10T21:31:40.240 | 4,959,716 | 4,959,716 | null |
73,937,094 | 2 | null | 73,936,417 | 0 | null | Another possible solution, based on indexing and [pandas.concat](https://pandas.pydata.org/docs/reference/api/pandas.concat.html):
```
pd.concat([df.iloc[0:len(df):3].reset_index(drop=True), df['Name'].rename(
'Votes').iloc[2:len(df):3].reset_index(drop=True)], axis=1)
```
Output:
```
Name Votes
0 10000 12
1 10100 13
```
| null | CC BY-SA 4.0 | null | 2022-10-03T14:43:09.317 | 2022-10-03T14:43:09.317 | null | null | 11,564,487 | null |
73,937,357 | 2 | null | 73,936,562 | 0 | null | Try this:
```
Grouped Table =
SUMMARIZE(
YourTable,
YourTable[id],
"status", MAX(YourTable[status])
)
```
```
Yes =
CALCULATE(
COUNTROWS('Grouped Table'),
'Grouped Table'[status] = "Yes"
)
```
```
No =
CALCULATE(
COUNTROWS('Grouped Table'),
'Grouped Table'[status] = "No"
)
```
Which looks like
[](https://i.stack.imgur.com/9PifS.png)
OR: Add another if you like
```
Count Table =
SUMMARIZE(
'Grouped Table',
'Grouped Table'[status],
"count", COUNT('Grouped Table'[status])
)
```
[](https://i.stack.imgur.com/Uy1zu.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T15:04:42.407 | 2022-10-03T15:17:51.280 | 2022-10-03T15:17:51.280 | 7,108,589 | 7,108,589 | null |
73,938,114 | 2 | null | 14,320,159 | 0 | null | For those who may still have problem with , although the `origin` keyword helps, be aware of the coordinate axes as well.
> Generally, for an array of shape (M, N), the first index runs along the vertical, the second index runs along the horizontal. The pixel centers are at integer positions ranging from 0 to N' = N - 1 horizontally and from 0 to M' = M - 1
You can find more details from the [matplotlib website](https://matplotlib.org/stable/tutorials/intermediate/imshow_extent.html).
For example, consider the following code:
```
M=5; N=10
a=np.zeros((M, N))
for i in range(M):
for j in range(N):
a[i,j]=i**2
plt.imshow(a, origin="lower")
print(f'here is a:\n{a}\n')
print(f'shape of a: {a.shape}')
print(f'a[0,0]: {a[0,0]}')
print(f'a[0,5]: {a[0,5]}')
print(f'a[0,9]: {a[0,9]}')
print(f'a[4,0]: {a[4,0]}')
```
Here is the output:
[](https://i.stack.imgur.com/k1wYb.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T16:14:43.723 | 2022-10-03T16:14:43.723 | null | null | 17,658,327 | null |
73,938,288 | 2 | null | 24,116,318 | 0 | null | This is an old post, but seeing that this is a top hit for making bottom residual plots, I thought it is useful to modify the code by @jaydeepsb that runs as is.
```
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
# Data
x = np.arange(1,10,0.2)
ynoise = x*np.random.rand(len(x))
ydata = x**2 + ynoise
Fofx = lambda x,a,b,c: a*x**2+b*x+c
p, cov = curve_fit(Fofx,x,ydata)
# Upper plot
fig1 = plt.figure(1)
frame1 = fig1.add_axes((.1,.3,.8,.6))
plt.plot(x,ydata,'.b')
plt.plot(x,Fofx(x,*p),'-r')
frame1.set_xticklabels([])
plt.grid()
# Residual plot
difference = Fofx(x,*p) - ydata
frame2 = fig1.add_axes((.1,.1,.8,.2))
plt.plot(x,difference,'or')
plt.grid()
```
| null | CC BY-SA 4.0 | null | 2022-10-03T16:31:28.403 | 2022-10-03T16:31:28.403 | null | null | 20,151,531 | null |
73,938,636 | 2 | null | 73,938,594 | 1 | null | If you'd like the dataframe to include only the top 10 schools, I would first [sort by ranking](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.sort_values.html).
```
df = df.sort_values(by=['ranking'])
```
Then index the top 10 rows:
```
df_topten = df.iloc[:10]
```
| null | CC BY-SA 4.0 | null | 2022-10-03T17:04:36.937 | 2022-10-03T17:04:36.937 | null | null | 19,249,371 | null |
73,938,674 | 2 | null | 73,937,823 | 1 | null | If you are looking to convert two rows into one, you can do the following...
1. Stack the dataframe and reset the index at level=1, which will convert the data and columns into a stack. This will end up having each of the column headers as a column (called level_1) and the data as another column(called 0)
2. Then set the index as level_1, which will move the column names as index
3. Remove the index name (level_1). Then transpose the dataframe
Code is shown below.
```
df3=df3.stack().reset_index(level=1).set_index('level_1')
df3.index.name = None
df3=df3.T
```
df3
[](https://i.stack.imgur.com/iLwgI.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T17:08:58.117 | 2022-10-03T17:08:58.117 | null | null | 16,404,872 | null |
73,938,997 | 2 | null | 73,938,760 | 0 | null | The `id` is a number but `doc()` function takes only string path segments. Also, you must pass the `documentId` to update a specific document. Try changing the following line:
```
onClick={() =>
likePost(post.id, post.likes) // pass .id and not .postid
}
```
If `postid` is the document ID itself, then try:
```
const likePost = async (id, likes) => {
await updateDoc(doc(db, "posts", String(id)), {
likes: likes + 1,
});
};
```
Also, as @FrankVanPuffelen commented, you can use [increment()](https://firebase.google.com/docs/firestore/manage-data/add-data#increment_a_numeric_value) instead as shown below:
```
import { increment } from "firebase/firestore"
await updateDoc(doc(db, "posts", String(id)), {
likes: increment(1),
});
```
| null | CC BY-SA 4.0 | null | 2022-10-03T17:42:38.007 | 2022-10-03T17:54:47.617 | 2022-10-03T17:54:47.617 | 13,130,697 | 13,130,697 | null |
73,939,150 | 2 | null | 73,910,460 | 0 | null | If you remove the height css, it will fix the issue.
here:
```
.project-1, .project-2, .project-3, .project-4{
margin: 5% 7%;
}
```
| null | CC BY-SA 4.0 | null | 2022-10-03T17:58:34.047 | 2022-10-03T17:58:34.047 | null | null | 20,029,377 | null |
73,939,230 | 2 | null | 73,938,878 | 0 | null | `psql` uses the language from the locale in its environment. Change that to English, and you will have less trouble reading the messages. On a Linux system, you could set the `LC_MESSAGES` environment variable to `C`.
| null | CC BY-SA 4.0 | null | 2022-10-03T18:07:30.620 | 2022-10-03T18:07:30.620 | null | null | 6,464,308 | null |
73,939,432 | 2 | null | 24,941,209 | 0 | null | try:
```
=INDEX(TEXT(A2:A; "00000"))
```
advantages: short, works, smells nice
to map out empty cells you can do:
```
=INDEX(IF(A2:A="";;TEXT(A2:A; "00000")))
```
| null | CC BY-SA 4.0 | null | 2022-10-03T18:30:50.060 | 2022-10-03T18:30:50.060 | null | null | 5,632,629 | null |
73,939,564 | 2 | null | 73,939,346 | 1 | null | Use below
```
select date,
extract(hour from parse_time('%I:%M:%S %p', time)) as hour,
count(distinct order_id) as orders
from your_table
group by date, hour
```
if applied to sample data in your question - output is
[](https://i.stack.imgur.com/6oe8t.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T18:43:59.990 | 2022-10-03T18:43:59.990 | null | null | 5,221,944 | null |
73,939,877 | 2 | null | 73,939,807 | 0 | null | You should use flexbox for this type of layout. CSS Grid isn't the best solution for centering last rows like that. This is what flexbox was made for.
```
.grid {
display: flex;
flex-flow: row wrap;
justify-content: center;
align-items: center;
padding: 40px;
}
.item {
height: 30px;
width: 200px;
margin: 10px;
background: tomato;
}
```
```
<div class="grid">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-10-03T19:18:36.980 | 2022-10-03T19:18:36.980 | null | null | 19,952,935 | null |
73,940,217 | 2 | null | 73,939,878 | 0 | null | My understanding is that a QMainWindow needs to have a centralWidget and you set the layout on the centralWidget. Your QMainWindow should only have one splitter.
Try this:
```
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget, QFrame,QHBoxLayout,QSplitter
from PyQt5.QtWidgets import QMenu, QMenuBar, QLineEdit
class Window(QtWidgets.QMainWindow):
# Main window
def __init__(self, parent=None):
super().__init__(parent)
# self.setWindowIcon(QtGui.QIcon("honeywellIcon.png"))
self.setWindowTitle("Materials Database")
# self.showMaximized()
self._createMenuBar()
self.setCentralWidget(QWidget())
hbox = QHBoxLayout()
rightFrame = QFrame()
rightFrame.setFrameShape(QFrame.StyledPanel)
mainSplit = QSplitter(Qt.Horizontal)
lineEdit = QLineEdit()
mainSplit.addWidget(lineEdit)
#mainSplitLeft.setSizes([200,500])
mainSplit.addWidget(rightFrame)
hbox.addWidget(mainSplit)
self.centralWidget().setLayout(hbox)
self.show()
# Menu bars on main window
def _createMenuBar(self):
menuBar = self.menuBar()
# Creating 'File' menu option and adding to menuBar
fileMenu = QMenu("&File", self)
menuBar.addMenu(fileMenu)
# Creating 'Options' menu option and adding to menuBar
optionsMenu = menuBar.addMenu("&Options")
menuBar.addMenu(optionsMenu)
# Creating 'View' menu option and adding to menuBar
viewMenu = menuBar.addMenu("&View")
menuBar.addMenu(viewMenu)
# Creating 'Create' menu option and adding to menuBar
createMenu = menuBar.addMenu("&Create")
menuBar.addMenu(createMenu)
# Creating 'Help' menu option and adding to menuBar
helpMenu = menuBar.addMenu("&Help")
menuBar.addMenu(helpMenu)
if __name__ == "__main__":
app = QApplication(sys.argv)
win = Window()
win.show()
sys.exit(app.exec_())
```
If your window layout gets more complicated than this, you might consider doing the layout in Qt Designer.
| null | CC BY-SA 4.0 | null | 2022-10-03T19:53:32.487 | 2022-10-03T19:53:32.487 | null | null | 9,705,687 | null |
73,940,397 | 2 | null | 73,940,257 | 0 | null | Int the future please do not post images of code, copy/paste the code as text.
What you want is Transliteration:
```
$input = 'how can I make the system print "ae" instead of "æ", "o" instead of "ø" and "aa" instead of "å"';
$t = Transliterator::create("Any-Latin; Latin-ASCII");
var_dump($t->transliterate($input));
```
Output:
```
string(96) "how can I make the system print "ae" instead of "ae", "o" instead of "o" and "aa" instead of "a""
```
I know it doesn't transliterate 'å' as desired, but I would side with ICU's transliteration interpretation rather than trying to build a custom transliterator.
You might also want to check what encodings that your printer accepts, as it may well print an ISO-8859-1 or cp1252 version of the data just fine. Then you just have to apply the correct conversion, eg:
```
$newstring = mb_convert_encoding($input, "ISO-8859-1", "UTF-8");
```
| null | CC BY-SA 4.0 | null | 2022-10-03T20:12:23.047 | 2022-10-03T20:12:23.047 | null | null | 1,064,767 | null |
73,940,438 | 2 | null | 73,940,257 | 0 | null | use str_replace in PHP
```
$text = str_replace(array('æ', 'ø', 'å'), array('ae', 'o', 'aa'), $text);
```
For more help, we need a few codelines before an d after.
| null | CC BY-SA 4.0 | null | 2022-10-03T20:17:21.017 | 2022-10-03T20:17:21.017 | null | null | 15,222,409 | null |
73,940,526 | 2 | null | 73,940,257 | -1 | null | ```
}
public function columnify($leftCol, $rightCol, $leftWidthPercent, $rightWidthPercent, $char_per_line=32,$space = 2)
{
$leftWidth = $char_per_line * $leftWidthPercent / 100;
$rightWidth = $char_per_line * $rightWidthPercent / 100;
$leftWrapped = wordwrap($leftCol, $leftWidth, "\n", true);
$rightWrapped = wordwrap($rightCol, $rightWidth, "\n", true);
$leftLines = explode("\n", $leftWrapped);
$rightLines = explode("\n", $rightWrapped);
$allLines = array();
for ($i = 0; $i < max(count($leftLines), count($rightLines)); $i++) {
$leftPart = str_pad(isset($leftLines[$i]) ? $leftLines[$i] : '', $leftWidth, ' ');
$rightPart = str_pad(isset($rightLines[$i]) ? $rightLines[$i] : '', $rightWidth, ' ');
$allLines[] = $leftPart . str_repeat(' ', $space) . $rightPart;
}
if (!defined('PHP_VERSION_ID')) {
$version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
$imploded=null;
try {
$imploded=implode($allLines, "\n") . "\n";
} catch (\Exception $e) {
$imploded=implode("\n",$allLines) . "\n";
}
return $imploded;
}
private function printLine(){
$this->printer->text("___________________________");
$text = str_replace(array('æ', 'ø', 'å'), array('ae', 'o', 'aa'), $text);
$this->printer->feed();
}
}
```
| null | CC BY-SA 4.0 | null | 2022-10-03T20:28:50.523 | 2022-10-03T20:28:50.523 | null | null | 20,152,838 | null |
73,940,529 | 2 | null | 73,932,176 | 0 | null | The code below shows how to copy/paste a picture from one worksheet to another or how to insert a picture based on a file path and file name displayed in a cell
The code goes into the `ThisWorkbook` code module and will activate every time a cell value is changed. You will need to modify it to make it work for your needs but it should get you most of the way there. I've got comments in the code to explain what different sections of it do and you can uncomment/comment sections out to use what you want.
```
Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim tShp As Shape
If Sh.Name = "Sheet2" Then ' check to make sure this is the sheet that you want to monitor for changes
If Target.Address = "$A$2" Then ' this checks to see if it is a specific cell you want to monitor for changes
Application.ScreenUpdating = False
'==========================================
'this section deletes all existing pictures on the page before pasting or inserting a new one.
'For Each tShp In Sh.Shapes
' tShp.Delete
'Next tShp
'==========================================
'==========================================
'this section delets pictures which intersect a given cell range
For Each tShp In Sh.Shapes
If Not Application.Intersect(tShp.TopLeftCell, Sh.Range("E2")) Is Nothing Then
tShp.Delete
End If
Next tShp
'===========================================
'use this to copy the picture from the "Pictures" sheet
'Sheets("Pictures").Shapes(Sh.Range("A2").Value).Copy
'Sh.Paste
'===========================================
'===========================================
'use this to insert from a file and give the picture in excel the same name as the file name
Sh.Pictures.Insert("{Some_File_Path_here}" & "\" & Sh.Range("A2").Value).Name = Sh.Range("A2").Value
'===========================================
With Sh.Shapes(Sh.Range("A2").Value)
.Top = Sh.Range("E2").Top
.Left = Sh.Range("E2").Left
End With
Application.ScreenUpdating = True
End If
End If
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-10-03T20:29:26.073 | 2022-10-03T20:29:26.073 | null | null | 8,099,673 | null |
73,940,588 | 2 | null | 72,523,448 | 0 | null | If you can't find the key for the + method, look for the or key. If this is accessible by the key, try ++/.
| null | CC BY-SA 4.0 | null | 2022-10-03T20:36:39.060 | 2022-10-03T20:36:39.060 | null | null | 6,085,335 | null |
73,941,002 | 2 | null | 73,939,747 | 0 | null | Looks like the issue lay with a lack of understanding in 'return default(T)'.
I'm not sure why it was repeating but by removing the try catch blocks that returned 'default(T)' and responding to the exception 'return new settings()' it allowed the properties value to not be null and function as intended.
Code LoadViaDataContractSerialization:
```
public static T LoadViaDataContractSerialization<T>(string filepath)
{
T serializableObject;
using (var fileStream = new FileStream(filepath, FileMode.Open))
{
using (var reader = XmlDictionaryReader.CreateTextReader(fileStream, new XmlDictionaryReaderQuotas()))
{
var serializer = new DataContractSerializer(typeof(T));
serializableObject = (T)serializer.ReadObject(reader, true);
reader.Close();
}
fileStream.Close();
}
return serializableObject;
}
```
Code LoadSettings:
```
public void LoadSettings()
{
string filePath = "Config/Settings.txt";
if (!Directory.Exists(Path.GetDirectoryName(filePath)))
{
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
}
if (File.Exists(filePath))
{
try
{
SettingsContainer = LoadViaDataContractSerialization<Settings>(filePath);
}
catch (Exception ex) //only exception needed
{
Log.GlobalLog.WriteError("LoadViaDataContractSerialization() error:\n" + ex.Message + "\nStackTrace: \n" + ex.StackTrace);
SettingsContainer = new Settings();//<---this was the fix
}
}
else
{
File.Create(filePath);
}
if(SettingsContainer == null)
{
SettingsContainer = new Settings();
}
}
```
Thank you to 'Generic Snake' for pointing me at the right place.
| null | CC BY-SA 4.0 | null | 2022-10-03T21:28:19.887 | 2022-10-03T21:28:19.887 | null | null | 19,454,837 | null |
73,941,108 | 2 | null | 73,102,284 | 0 | null | To create a ray direction that matches a perspective matrix from screen space, the following ray direction formula can be used:
```
vec3 rd = normalize(vec3(((2.0 / screenWidth) * gl_FragCoord.xy) - vec2(aspectRatio, 1.0), -proj_matrix[1][1]));
```
The value of `2.0 / screenWidth` can be pre-computed or the opengl built-in uniform structs can be used.
To get a bounding box or other shape for your spheres, it is very important to use camera-facing shapes, and not camera-plane-facing shapes. Use the following process where `position` is the incoming VBO position data, and the w-component of `position` is the radius:
```
vec4 p = vec4((cam_matrix * vec4(position.xyz, 1.0)).xyz, position.w);
o.vpos = p;
float l2 = dot(p.xyz, p.xyz);
float r2 = p.w * p.w;
float k = 1.0 - (r2/l2);
float radius = p.w * sqrt(k);
if(l2 < r2) {
p = vec4(0.0, 0.0, -p.w * 0.49, p.w);
radius = p.w;
k = 0.0;
}
vec3 hx = radius * normalize(vec3(-p.z, 0.0, p.x));
vec3 hy = radius * normalize(vec3(-p.x * p.y, p.z * p.z + p.x * p.x, -p.z * p.y));
p.xyz *= k;
```
Then use `hx` and `hy` as basis vectors for any 2D shape that you want the billboard to be shaped like for the vertices. Don't forget later to multiply each vertex by a perspective matrix to get the final position of each vertex. Here is a visualization of the billboarding on desmos using a hexagon shape: [https://www.desmos.com/calculator/yeeew6tqwx](https://www.desmos.com/calculator/yeeew6tqwx)
| null | CC BY-SA 4.0 | null | 2022-10-03T21:43:13.847 | 2022-11-10T17:04:57.713 | 2022-11-10T17:04:57.713 | 15,817,321 | 15,817,321 | null |
73,941,127 | 2 | null | 55,091,195 | 0 | null | In some cases this event is more reliable.
```
cy.contains('Automation').trigger('mouseenter')
```
| null | CC BY-SA 4.0 | null | 2022-10-03T21:45:19.597 | 2022-10-03T21:45:19.597 | null | null | 12,308,816 | null |
73,941,529 | 2 | null | 73,441,724 | -1 | null | You can fix that file with `watchForFileChanges: false,`
```
const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
watchForFileChanges: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
```
| null | CC BY-SA 4.0 | null | 2022-10-03T22:50:42.870 | 2022-10-03T22:50:42.870 | null | null | 20,063,823 | null |
73,941,625 | 2 | null | 73,920,852 | 0 | null | Your middle loop, `for y in range (-1,-349,10)` is broken due to the `range` specification. Your other two loops are fine. You just need to rework copies of them to cover the area in question.
Below, I've reworked, and simplified, your code to finish the drawing, but also to synchronize the colors (in the finished pattern) and rearrange the loops to show a continuous, contiguous turtle motion instead of jumping around:
```
import turtle
COLORS = ['red', 'pink', 'white', 'orange', 'green', 'blue']
def dibujar_linea(x, y):
turtle.penup()
turtle.goto(0, y)
turtle.pendown()
turtle.goto(x, 0)
def dibujarParabola():
for y in range(-350, -1, 10):
turtle.pencolor(COLORS[-y//10 % len(COLORS)])
x = y + 350
dibujar_linea(x, y)
for y in range(0, 351, 10):
turtle.pencolor(COLORS[y//10 % len(COLORS)])
x = 350 - y
dibujar_linea(x, y)
for y in range(350, -1, -10):
turtle.pencolor(COLORS[y//10 % len(COLORS)])
x = y - 350
dibujar_linea(x, y)
for y in range(0, -351, -10):
turtle.pencolor(COLORS[-y//10 % len(COLORS)])
x = -350 - y
dibujar_linea(x, y)
turtle.speed('fastest') # because I have no patience
dibujarParabola()
turtle.hideturtle()
turtle.done()
```
[](https://i.stack.imgur.com/Nz8xH.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T23:08:23.097 | 2022-10-03T23:08:23.097 | null | null | 5,771,269 | null |
73,941,722 | 2 | null | 27,030,559 | 0 | null | This supplements @matt's answer with an example (with Swift 5, iOS 16), ... a function added to a subclass of `UIView`, where the view is comprised of sublayers of `CAShapeLayer` derived from `UIBezierPath`.
As Matt indicated, CGContext rotation centers at origin, therefore one must
translate center of view to origin, do the rotation, then translate back. Note, also the conversion of degrees to radians in the parameter of `rotate()`.
```
func asImage(rotationDegrees: CGFloat) -> UIImage {
let renderer = UIGraphicsImageRenderer(bounds: bounds)
let image = renderer.image(actions: { _ in
if let ctx = UIGraphicsGetCurrentContext() {
ctx.translateBy(x: bounds.size.width / 2, y: bounds.size.height / 2)
ctx.rotate(by: rotationDegrees * .pi / 180)
ctx.translateBy(x: -bounds.size.width / 2, y: -bounds.size.height / 2)
for sublayer in self.layer.sublayers!.reversed() {
sublayer.render(in: ctx)
}
}
})
return image
}
```
| null | CC BY-SA 4.0 | null | 2022-10-03T23:23:26.013 | 2022-10-03T23:23:26.013 | null | null | 2,079,103 | null |
73,941,758 | 2 | null | 23,836,000 | 0 | null | This is for me the best form:
```
import tkinter as tk
from turtle import title, width
root= tk.Tk()
root.title('Civ IV select songs')
canvas1 = tk.Canvas(root, width = 300, height = 600)
canvas1.pack()
```
[](https://i.stack.imgur.com/5XRvI.png)
| null | CC BY-SA 4.0 | null | 2022-10-03T23:31:15.337 | 2022-10-03T23:31:15.337 | null | null | 13,843,868 | null |
73,942,245 | 2 | null | 41,337,336 | 0 | null | just wipe your android emulator data and you should be fine, worked for me
| null | CC BY-SA 4.0 | null | 2022-10-04T01:15:44.263 | 2022-10-04T01:15:44.263 | null | null | 20,154,334 | null |
73,942,427 | 2 | null | 73,942,214 | 0 | null | You can turn it into a tibble and then filter with `dplyr`:
```
#### Load Library ####
library(tidyverse)
#### Save Table as Object ####
admissions <- ftable(round(proportions(UCBAdmissions, c(2, 3)) * 100, 1),
row.vars = c(2, 1),
col.vars = 3)
#### Convert to Tibble and Filter ####
admissions %>%
as_tibble() %>%
filter(!Admit == "Rejected")
```
Giving you this:
```
# A tibble: 12 × 4
Gender Admit Dept Freq
<fct> <fct> <fct> <dbl>
1 Male Admitted A 62.1
2 Female Admitted A 82.4
3 Male Admitted B 63
4 Female Admitted B 68
5 Male Admitted C 36.9
6 Female Admitted C 34.1
7 Male Admitted D 33.1
8 Female Admitted D 34.9
9 Male Admitted E 27.7
10 Female Admitted E 23.9
11 Male Admitted F 5.9
12 Female Admitted F 7
```
| null | CC BY-SA 4.0 | null | 2022-10-04T01:56:00.510 | 2022-10-04T01:56:00.510 | null | null | 16,631,565 | null |
73,942,487 | 2 | null | 73,941,879 | 0 | null | because absolute positioned elements are removed from the normal flow and can overlap elements. and if you want to use position absolute, then you must position the element in its parent where you want it to be. and parent position will be relative.
please read and watch to learn and practice about position properties and how to use them.
you can start [here](https://www.w3schools.com/css/css_positioning.asp)
there are many youtube channels that will explain all of that to you in less than 10 minutes. one of my favorites is this [channel](https://youtu.be/jx5jmI0UlXU). check it out.
| null | CC BY-SA 4.0 | null | 2022-10-04T02:04:46.667 | 2022-10-04T02:04:46.667 | null | null | 6,467,902 | null |
73,943,544 | 2 | null | 12,806,450 | 0 | null | new c++ supported cin and cout keywords. You can use those
[](https://i.stack.imgur.com/DkBIK.png)
| null | CC BY-SA 4.0 | null | 2022-10-04T05:46:51.240 | 2022-10-04T05:46:51.240 | null | null | 11,123,185 | null |
73,943,565 | 2 | null | 73,906,765 | 0 | null | I found the solution. After i read [this](https://stackoverflow.com/questions/71668052/react-native-web-error-rnw-blogpost-bundle-js1414-uncaught-typeerror-cannot-r) post, your react, react-dom, and react-test-renderer must have same version. Then i downgrade my react-dom to version 16(which currently version 18, while react and react-test-renderer version 16).
Then i change my index.web.js back to this.
```
import {AppRegistry} from 'react-native';
import App from '/App.web.tsx';
import {name as appName} from './app.json';
if (module.hot) {
module.hot.accept();
}
AppRegistry.registerComponent(appName, () => App);
AppRegistry.runApplication(appName, {
initialProps: {},
rootTag: document.getElementById('app-root'),
});
```
And now it's working!
[](https://i.stack.imgur.com/txpls.png)
| null | CC BY-SA 4.0 | null | 2022-10-04T05:49:32.453 | 2022-10-04T05:49:32.453 | null | null | 15,019,505 | null |
73,943,724 | 2 | null | 73,943,188 | -1 | null | Check if this is what wanted to do
```
#include <iostream>
using namespace std;
int main() {
enum Operation {Multiply = 'M', Add = 'A', Difference = 'D'};
int result;
int num1, num2;
Operation my_operation;
char choice;
// bool = true;
cout<<"Enter two integers:"; cin>>num1>>num2;
do
{
cout<<"Choose from the list of operations:"<<endl;
cout<<"M / Multiply"<<endl;
cout<<"A / Add"<<endl;
cout<<"D / Difference"<<endl;
cin>>choice;
switch (choice){
case Multiply:
result = num1 * num2;
cout<<"The result of the operation is "<<result<<endl;
break;
case Add:
result = num1 + num2;
cout<<"The result of the operation is "<<result<<endl;
break;
case Difference:
result = num1 - num2;
cout<<"The result of the operation is "<<result<<endl;
break;
default:
cout<<"Try again. Please choose to Multiply, Add, or to find the Difference.";
break;
}
} while (true);
return 0;
}
```
You have some unnecessary things in your code. I haven't changed those. I have tried to do minimum modification to make your code working.
| null | CC BY-SA 4.0 | null | 2022-10-04T06:11:04.400 | 2022-10-04T06:11:04.400 | null | null | 14,705,704 | null |
73,944,020 | 2 | null | 73,943,973 | 1 | null | you have extra point
value = jsonData[0]
| null | CC BY-SA 4.0 | null | 2022-10-04T06:46:20.993 | 2022-10-04T06:46:20.993 | null | null | 14,290,361 | null |
73,944,025 | 2 | null | 70,346,567 | 0 | null | For me, the problem was resolved after I added the `download` attribute to the link, This is changing the element in the DOM, but it keeps the solution simple:
```
cy.get('[href="download?type=php"]')
.then((el) => {
el.attr('download', '');
})
.click();
```
| null | CC BY-SA 4.0 | null | 2022-10-04T06:46:31.353 | 2022-10-04T06:46:31.353 | null | null | 4,323,838 | null |
73,944,082 | 2 | null | 73,943,871 | 0 | null | I am using Global key to find the widget.
```
openPopUpItem() {
GestureDetector? detector;
searchForGestureDetector(BuildContext element) {
element.visitChildElements((element) {
if (element.widget is GestureDetector) {
detector = element.widget as GestureDetector;
} else {
searchForGestureDetector(element);
}
});
}
searchForGestureDetector(popUpButtonKey.currentContext!);
detector!.onTap!();
}
```
```
class PopUpMenuTest extends StatefulWidget {
const PopUpMenuTest({super.key});
@override
State<PopUpMenuTest> createState() => _PopUpMenuTestState();
}
class _PopUpMenuTestState extends State<PopUpMenuTest> {
GlobalKey popUpButtonKey = GlobalKey();
openPopUpItem() {
GestureDetector? detector;
searchForGestureDetector(BuildContext element) {
element.visitChildElements((element) {
if (element.widget is GestureDetector) {
detector = element.widget as GestureDetector;
} else {
searchForGestureDetector(element);
}
});
}
searchForGestureDetector(popUpButtonKey.currentContext!);
detector!.onTap!();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
InkWell(
onHover: (value) {
if (value) openPopUpItem();
},
onTap: () {},
child: PopupMenuButton(
key: popUpButtonKey,
color: Color(0xFF262533),
tooltip: '',
position: PopupMenuPosition.under,
child: Icon(
Icons.person,
// color: Colors.white,
),
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
const PopupMenuItem(
child: ListTile(
title: Text(
'Login',
style: TextStyle(color: Colors.white),
),
),
),
const PopupMenuItem(
child: ListTile(
title: Text(
'Register',
style: TextStyle(color: Colors.white),
),
),
),
],
),
)
],
),
);
}
}
```
| null | CC BY-SA 4.0 | null | 2022-10-04T06:52:43.320 | 2022-10-04T06:52:43.320 | null | null | 10,157,127 | null |
73,944,084 | 2 | null | 73,943,742 | 1 | null | Since your records are not show entirely on the first page, you are not able to select them.
Pagination is good for performance optimized, but not good at all if your records are interacted.
---
There are two approach that I've used before:
## 1. Get all data in the first time, and hide the data that is not belong to the first page.
You can get all your records in the first page, and hide some records that are not in the first page().
Since records are in the dom tree, you can easily select them.
> I don't think this is a good way, since users don't know they select the records they .
## 2. Create another button says that select all and give user a hint.
Create a button and give user a hint like: `select all xxx records` to let user know they are instead of .
You can see an example in .
And more detail [here](https://ux.stackexchange.com/questions/43937/how-should-the-select-all-select-when-paginating-elements).
| null | CC BY-SA 4.0 | null | 2022-10-04T06:52:55.767 | 2022-10-04T06:52:55.767 | null | null | 10,389,571 | null |
73,944,093 | 2 | null | 27,993,380 | 0 | null | In my case i install `java_17` but latter on i uninstall `java_17` and reinstall `java_11` but its show `java_17` in `Library > Java > JavaVirtualMachines` folder ... so i run following command after deleting `java_17` from JVM folder and its work for me... `sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk`
| null | CC BY-SA 4.0 | null | 2022-10-04T06:54:18.947 | 2022-10-04T06:54:18.947 | null | null | 8,894,035 | null |
73,944,245 | 2 | null | 14,675,913 | 0 | null | I would just edit the image in some image editor - enlarge the image horizontally, therefore it will get smaller vertically when resized by the renderer to the width of the page.
So, just add some transparent left and right margins.
| null | CC BY-SA 4.0 | null | 2022-10-04T07:12:48.340 | 2022-10-04T07:12:48.340 | null | null | 5,799,173 | null |
73,944,284 | 2 | null | 49,689,063 | 2 | null | For me worked like a charm.
`df.to_csv("..\Report\Report.csv", encoding='utf_8_sig')`
| null | CC BY-SA 4.0 | null | 2022-10-04T07:16:52.153 | 2022-10-04T07:16:52.153 | null | null | 15,030,095 | null |
73,944,422 | 2 | null | 73,849,730 | 0 | null | Probably You are using google mobile ads!
if yes then you must need to say yes for Does your app use advertising ID? and also check for
Steps to Solve isse are
1- Goto play console
2- Select Application
3- Goto app Content
4- Choose Advertising ID
5- click yes for Does your app use advertising ID?
6- check Advertising or marketing
7- click save
| null | CC BY-SA 4.0 | null | 2022-10-04T07:31:14.013 | 2022-10-04T07:31:14.013 | null | null | 12,890,258 | null |
73,944,473 | 2 | null | 73,943,973 | 0 | null | remove .
```
value=jsonData[0].lotCpId
```
| null | CC BY-SA 4.0 | null | 2022-10-04T07:34:42.577 | 2022-10-04T07:34:42.577 | null | null | 20,012,195 | null |
73,944,495 | 2 | null | 73,944,383 | 0 | null | Each time you're calling `.doc()` to create the following reference, without passing anything as an argument:
```
_collectionRef.doc(user?.uid).collection('items').doc()
//
```
It literally means that you're always generating a new document ID. When you call `delete()`, you're trying to delete a document that actually doesn't exist, hence that behavior.
If you want to create a reference that points to a particular item (document) inside the `items` sub-collection, then you have to pass the document ID of that item, which already exists in the database, and generate a brand new one. So to solve this, get the document ID of the item you want to delete and pass it to the `.doc()` function like this:
```
_collectionRef.doc(user?.uid).collection('items').doc('itemDocId')
//
```
| null | CC BY-SA 4.0 | null | 2022-10-04T07:37:14.140 | 2022-10-04T07:37:14.140 | null | null | 5,246,885 | null |
73,944,572 | 2 | null | 73,944,383 | 1 | null | You have to pass the id of the document to be deleted.
so modify your code as
```
Future deleteData(BuildContext context)
{
final user = Provider.of<Userr?>(context,listen: false);
CollectionReference _collectionRef = FirebaseFirestore.instance.collection('myOrders');
return _collectionRef.doc(user?.uid).collection('items').doc('document_id_to_be_deleted').delete();
}
```
| null | CC BY-SA 4.0 | null | 2022-10-04T07:45:12.190 | 2022-10-04T07:45:12.190 | null | null | 20,067,845 | null |
73,944,889 | 2 | null | 73,944,741 | 0 | null | You can cross join to a a values clause:
```
select t.fruits,
u.*
from the_table t
cross join lateral (
values ('Store A', t.qty_store_a, t.value_store_a),
('Store B', t.qty_store_b, t.value_store_b),
('Store C', t.qty_store_c, t.value_store_c),
('Store BC', t.qty_store_bc, t.value_store_bc),
('Store DC', t.qty_store_dc, t.value_store_dc)
) as u(store, qty, value)
```
| null | CC BY-SA 4.0 | null | 2022-10-04T08:13:59.267 | 2022-10-04T08:31:14.497 | 2022-10-04T08:31:14.497 | 330,315 | 330,315 | null |
73,945,006 | 2 | null | 73,939,965 | 0 | null | Material UI has animations for every action. Perhaps the test is ending too soon, and you caught the screen mid-animation.
Try adding a final assertion like
```
cy.contains('This is dummy text for automation tests')
.should('not.be.visible')
```
Or
```
cy.contains('This is dummy text for automation tests')
.should('not.exist')
```
| null | CC BY-SA 4.0 | null | 2022-10-04T08:25:15.610 | 2022-10-04T08:25:15.610 | null | null | 18,366,749 | null |
73,945,074 | 2 | null | 71,871,614 | 0 | null | TLTR: If your database file is located in a mountable filesystem, you need to give dbeaver permission to read files from a mountable filesystem.
I have found 2 ways to solve this issue on ubuntu:
1: Make sure your database file is in home directory. Since dbeaver has permission to access your home directory, it will work.
OR
2: If you have downloaded dbeaver from:
- `ubuntu software center`- `snap install`
and your database file is located in a mountable filesystem, heard over to ubuntu software center => installed, find dbeaver in the list then click on it, on the next window top left, click on the permissions and toggle `Read system mount information and disk quotas`, put in your password in the authentication prompt and you're good to go.
| null | CC BY-SA 4.0 | null | 2022-10-04T08:30:37.800 | 2022-10-04T08:30:37.800 | null | null | 10,250,324 | null |
73,945,404 | 2 | null | 73,944,894 | 0 | null | Here is expo snack with solution, just style your borders to not be double :
[https://snack.expo.dev/kto6IOXR6](https://snack.expo.dev/kto6IOXR6)
| null | CC BY-SA 4.0 | null | 2022-10-04T08:58:41.217 | 2022-10-04T10:21:20.593 | 2022-10-04T10:21:20.593 | 15,301,266 | 15,301,266 | null |
73,945,711 | 2 | null | 73,940,257 | 0 | null | `toPrintable` is a function that converts all non-ASCII characters to a transliteration. Additional printable characters can be defined that are retained as well as individual replacements.
```
function toPrintable(string $string, string $keep = '', array $replace = []): string
{
$new = '';
$string = strtr($string,$replace);
foreach(mb_str_split($string) as $mbChar){
if(strpos($keep,$mbChar) === false){
$mbChar = iconv('UTF-8','ASCII//TRANSLIT//IGNORE',$mbChar);
}
$new .= $mbChar;
}
return $new;
}
```
Examples:
```
$text = 'æ and ø and å and äö and 3€';
echo toPrintable($text);
//ae and o and a and "a"o and 3EUR
$text = 'æ and ø and å and äö and 3€';
$keep = 'äöü߀..ABC..123'; //all printable characters
echo toPrintable($text,$keep);
//ae and o and a and äö and 3€
$text = 'æ and ø and å and äö and 3€';
$keep = 'äöü߀..ABC..123'; //all printable characters
$replace = ['å' => 'aa']; //all individual replacements
echo toPrintable($text,$keep,$replace);
//ae and o and aa and äö and 3€
```
| null | CC BY-SA 4.0 | null | 2022-10-04T09:22:49.943 | 2022-10-04T09:22:49.943 | null | null | 7,271,221 | null |
73,945,743 | 2 | null | 73,943,656 | 0 | null | The ?. operator is like the . chaining operator, except that instead of causing an error if a reference is nullish (null or undefined), the expression short-circuits with a return value of undefined. When used with function calls, it returns undefined if the given function does not exist.
so in the below code user_id: auth?.user?.id it will not be accessible until it is nullish and if it's null it will return undefined instead of crashing an application.
```
const {data, error} = await supabase.from("watchlists").insert({movie_id : movie?.id, user_id: auth?.user?.id})
```
| null | CC BY-SA 4.0 | null | 2022-10-04T09:24:31.357 | 2022-10-07T17:13:37.253 | 2022-10-07T17:13:37.253 | 17,870,361 | 17,870,361 | null |
73,946,085 | 2 | null | 73,945,928 | 0 | null | ```
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"> #CDN added here
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script> #CDN added here
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script> #CDN added here
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> #CDN added here
</head>
<body>
<div data-spy="scroll" class="container"> #Added here
<h2>Form</h2>
<form class="form-inline" action="/action_page.php">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pswd">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remember"> Remember me
</label>
</div>
<br />
<button type="submit" class="btn btn-primary">Submit</button>
<br />
<label for="email">Email:</label><br /><br />
<input type="email" class="form-control" id="email" placeholder="Enter email" name="email"><br /><br />
<label for="pwd">Password:</label><br /><br />
<input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pswd"><br /><br />
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remember"> Remember me
</label>
</div><br /><br />
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</body>
</html>
```
Just add like below tag:
#Updated here
```
<div data-spy="scroll" data-target=".nav"> #.nav is classname from navbar
<form>
#Add here your form
</form>
</div>
```
The form must be inside div tag and now form is scrollable.
And now your problem is solved.
Happy coding!
| null | CC BY-SA 4.0 | null | 2022-10-04T09:51:06.583 | 2022-10-04T11:58:41.717 | 2022-10-04T11:58:41.717 | 17,808,039 | 17,808,039 | null |
73,946,552 | 2 | null | 45,439,845 | 0 | null | In my case I was sending very simple text response e.g. "Resource not found" in the body and set Content-Type to "application/json". Depends on version Swagger has a hard time deserializing simple text to json, so im my case changing Content-Type to "text/plain" did the trick.
| null | CC BY-SA 4.0 | null | 2022-10-04T10:32:14.867 | 2022-10-04T10:32:14.867 | null | null | 5,767,639 | null |
73,946,647 | 2 | null | 73,946,338 | 1 | null | I echo with Larnu comment.
You can try something like below.
```
declare @string varchar(20) = '1 hour 28 mins'
Select @string,case when CHARINDEX('hour',@string)>1 then
SUBSTRING(@string,1,CHARINDEX('hour',@string)-1) * 60 else 0 end
+
case when CHARINDEX('mins',@string)>1 then
SUBSTRING(@string,CHARINDEX('mins',@string)-3,2) else 0 end
```
| null | CC BY-SA 4.0 | null | 2022-10-04T10:40:26.063 | 2022-10-04T10:40:26.063 | null | null | 2,307,441 | null |
73,946,799 | 2 | null | 73,946,708 | 0 | null | ```
#to export all properties
$reports | export-csv "D:\2709\PS4.csv"
#to export a selection of properties
$reports | select-object -property workspaceId | export-csv "D:\2709\PS4.csv"
```
ok I see, $reports contains a json. in principle you can convert the json to csv by doing this:
```
ConvertFrom-Json -InputObject $reports | export-csv "D:\2709\PS4.csv"
```
But this gives you only a usefull output if the structure is flat. If thats not the case we have to flattern the structure first before we can export it as csv.
| null | CC BY-SA 4.0 | null | 2022-10-04T10:53:29.563 | 2022-10-04T11:04:31.250 | 2022-10-04T11:04:31.250 | 19,895,159 | 19,895,159 | null |
73,947,009 | 2 | null | 55,211,640 | 0 | null | the easiest way to do it is to import services.dart and use SystemUIOverlayStyle:
```
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
));
runApp(NameOfYourApp());
}
```
| null | CC BY-SA 4.0 | null | 2022-10-04T11:09:55.643 | 2022-10-04T13:35:32.833 | 2022-10-04T13:35:32.833 | 11,533,269 | 11,533,269 | null |
73,947,008 | 2 | null | 73,662,863 | 0 | null |
The latest Azure CLI command `"az ad app update"` does not include the oauth2permissions anymore.
I tried with below scripts and added scope successfully.
```
$AppId ="your application id"
$scopeGUID = [guid]::NewGuid()
$permission = @{
adminConsentDescription="admin only"
adminConsentDisplayName="readwrite"
id="$scopeGUID"
isEnabled=$true
type="User"
userConsentDescription="null"
userConsentDisplayName="null"
value="readwrite"
}
$azAppObjId = (az ad app show --id $AppId | ConvertFrom-JSON).id
$accesstoken = (Get-AzAccessToken -Resource "https://graph.microsoft.com/").Token
$header = @{
'Content-Type' = 'application/json'
'Authorization' = 'Bearer ' + $accesstoken
}
$bodyaccess = @{
'api' = @{
'oauth2PermissionScopes' = @($permission)
}
}|ConvertTo-Json -d 3
Invoke-RestMethod -Method Patch -Headers $header -Uri "https://graph.microsoft.com/v1.0/applications/$azAppObjId" -Body $bodyaccess
```


Also checked with commands:
```
az ad app show --id < application id >
```

Please refer the similar kind of [SO-Thread](https://stackoverflow.com/questions/62665491/how-to-create-scope-using-azure-cli-az-ad-app) which is resolved by A2AdminGuy.
| null | CC BY-SA 4.0 | null | 2022-10-04T11:09:53.817 | 2022-10-04T11:09:53.817 | null | null | 19,144,428 | null |
73,947,037 | 2 | null | 73,945,698 | 0 | null | [hi Wouter my below link may help you.... thank you]
[ https://codepen.io/soumenework/full/rNvKrvR ]:
| null | CC BY-SA 4.0 | null | 2022-10-04T11:12:54.403 | 2022-10-04T11:12:54.403 | null | null | 17,585,934 | null |
73,947,124 | 2 | null | 73,947,072 | -2 | null | You need to pass the target URL as a parameter to that function e.g. if there is a function `newInPrivate(url)` then :
```
<form>
<button onclick="newInPrivate('https://UrlHere')">
<img src=".\AssetHere" />
<label><span>Description here</span></label>
</button>
</form>
```
If you are looking for a general click listener instead of editing the formaction attributes then:
```
$(document).ready(function(){
$('button[formaction]').click(function(e){
e.preventDefault();
var targetUrl=$(this).attr("formaction");
newInPrivate(targetUrl);
return false;
})
})
```
| null | CC BY-SA 4.0 | null | 2022-10-04T11:21:43.963 | 2022-10-04T11:28:40.227 | 2022-10-04T11:28:40.227 | 4,700,922 | 4,700,922 | null |
73,947,202 | 2 | null | 73,947,072 | 0 | null | I'm pretty sure you don't need any form, just a bunch of buttons.
---
Whatever you pass to the `onclick` attribute is executed once the user clicks the button.
I suggest creating a function that receives a URL and using the chrome API to open the tab in incognito. Here is an example of the function implementation, as described [here](https://developer.chrome.com/docs/extensions/reference/windows/#method-create).
```
function openUrlInNewIncognitoTab(url) {
chrome.windows.create({
url, // that's the same as url: url
incognito: true
});
}
```
Then, for each button you display, set the `onclick` attribute to `openUrlInNewIncognitoTab('https://UrlHere')`.
You'll get a button like this:
```
<button onclick="openUrlInNewIncognitoTab('https://UrlHere')">
<img src=".\AssetHere" />
<label><span>Description here</span></label>
</button>
```
| null | CC BY-SA 4.0 | null | 2022-10-04T11:27:57.993 | 2022-10-04T11:27:57.993 | null | null | 8,031,115 | null |
73,947,213 | 2 | null | 73,947,072 | 0 | null | You can only do this in an extension
Either use click (simpler)
```
document.getElementById("buttonDiv").addEventListener("click", e => {
e.preventDefault()
windows.create({"url": e.target.getAttribute("formaction"), "incognito": true});
})
```
```
<div id="buttonDiv">
<button formaction="https://google.com">
<img src=".\AssetHere" />
<label><span>Description here</span></label>
</button>
</div>
```
or submit event handler:
```
document.getElementById("buttonDiv").addEventListener("submit", e => {
e.preventDefault()
windows.create({"url": document.activeElement.getAttribute("formaction"), "incognito": true});
})
```
```
<div id="buttonDiv">
<form>
<button formaction="https://google.com">
<img src=".\AssetHere" />
<label><span>Description here</span></label>
</button>
</form>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-10-04T11:28:35.903 | 2022-10-04T11:28:35.903 | null | null | 295,783 | null |
73,947,299 | 2 | null | 19,947,419 | 0 | null | In [Android Studio Dolphin | 2021.3.1](https://developer.android.com/studio/preview/features?utm_source=android-studio-2022-1-1&utm_medium=studio-assistant-preview#logcat) add `package:mine` in Logcat search bar. Using this filter you will see only your local app logs and errors.
See more [here](https://developer.android.com/studio/releases#logcat-search)
| null | CC BY-SA 4.0 | null | 2022-10-04T11:35:46.663 | 2022-10-04T11:35:46.663 | null | null | 12,228,296 | null |
73,947,582 | 2 | null | 64,377,779 | 0 | null | As said by other developers running this command
`flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"`
that issue got resolved for me. I am running Microsoft windows 10.[](https://i.stack.imgur.com/emqXX.jpg)
| null | CC BY-SA 4.0 | null | 2022-10-04T12:03:59.420 | 2022-10-04T12:03:59.420 | null | null | 10,024,618 | null |
73,947,796 | 2 | null | 73,947,586 | 0 | null | Your approach is correct. You just need to pass the relevant values as function parameters as shown below:
```
Future<void> updateBagStatus(String docId, bool status) {
return bags
.doc(docId)
.update({'isChecked': status})
.then((value) => print("isChecked Updated"))
.catchError((error) => print('Failed: $error'));
}
```
```
onTap: () => updateBagStatus(!data.docs[index]['isChecked'], data.docs[index].id)
```
| null | CC BY-SA 4.0 | null | 2022-10-04T12:22:57.027 | 2022-10-04T12:22:57.027 | null | null | 13,130,697 | null |
73,947,889 | 2 | null | 39,445,475 | 0 | null | Coming in late, but if you want to keep `EnableHeadersVisualStyles = true`, you may change `AdvancedColumnHeaderBorderStyle`, `AdvancedRowHeadersBorderStyle`, `AdvancedCellBorderStyle` side properties. To solve [@niaomingjian](https://stackoverflow.com/q/39445475/11409835) example, you would need to change these as:
```
dgv.AdvancedColumnHeadersBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None;
dgv.AdvancedColumnHeadersBorderStyle.Left = DataGridViewAdvancedCellBorderStyle.None;
dgv.AdvancedColumnHeadersBorderStyle.Right = DataGridViewAdvancedCellBorderStyle.Single;
dgv.AdvancedColumnHeadersBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.Single;
dgv.AdvancedCellBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None;
dgv.AdvancedCellBorderStyle.Left = DataGridViewAdvancedCellBorderStyle.None;
dgv.AdvancedCellBorderStyle.Right = DataGridViewAdvancedCellBorderStyle.Single;
dgv.AdvancedCellBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.Single;
dgv.AdvancedRowHeadersBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None;
dgv.AdvancedRowHeadersBorderStyle.Left = DataGridViewAdvancedCellBorderStyle.None;
dgv.AdvancedRowHeadersBorderStyle.Right = DataGridViewAdvancedCellBorderStyle.Single;
dgv.AdvancedRowHeadersBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.Single;
```
Setting `AdvancedColumnHeaderBorderStyle.All`, `AdvancedRowHeadersBorderStyle.All` or `AdvancedCellBorderStyle.All` to a single style, seems to work differently so you need to adjust every side separately to trigger such styling.
| null | CC BY-SA 4.0 | null | 2022-10-04T12:30:33.007 | 2022-10-04T12:40:24.143 | 2022-10-04T12:40:24.143 | 11,409,835 | 11,409,835 | null |
73,947,999 | 2 | null | 73,932,844 | 0 | null | Conda is designed to minimize redundant files by using hardlinking with a fallback to softlinking when working across volumes. One possibility is that the terminal emulation doesn’t support some of these operations. One can configure Conda not to use them by setting it to copy-only mode.
```
conda config --set always_copy true
```
Note that this means Conda will no longer be disk space efficient. You might want to spend time identifying what operations are not working in the emulation. That is, try using the `ln` function in the shell to create hard and soft links to see if they work. That would be helpful information to pass along to the emulator developers so they can work on supporting it.
| null | CC BY-SA 4.0 | null | 2022-10-04T12:39:57.643 | 2022-10-04T12:39:57.643 | null | null | 570,918 | null |
73,948,254 | 2 | null | 73,924,896 | 0 | null | I also encountered the same. On july I did a django project using django version 4.1.1, I think the issue might be vscode augus update
| null | CC BY-SA 4.0 | null | 2022-10-04T12:59:16.710 | 2022-10-04T12:59:16.710 | null | null | 15,948,101 | null |
73,948,445 | 2 | null | 1,713,335 | 0 | null | As mentioned at the bottom of this [page](https://stackoverflow.com/questions/24656367/find-peaks-location-in-a-spectrum-numpy/61841804#61841804) there is no universal definition of a peak. Therefore a universal that finds peaks cannot work without bringing in additional assumptions (conditions, parameters etc.). This page provides some of the most suggestions. All the literature listed in the answers above is a more or less roundabout manner to do the same so feel free to take your pick.
In any case, it is your duty to narrow down the properties a feature needs to have in order to be classified as a peak, based on your experience and properties of spectra (curves) in question (noise, sampling, bandwidths, etc.)
| null | CC BY-SA 4.0 | null | 2022-10-04T13:12:52.677 | 2022-10-04T13:12:52.677 | null | null | 4,408,539 | null |
73,948,618 | 2 | null | 73,945,980 | 0 | null | Take a look at following demo. I made it simple.
Create a WinForms project (in this example it's name is WindowsFormsApp3).
Create a strongly-typed data set - `ProductsDataSet`.
[](https://i.stack.imgur.com/yaOoq.png)
Add a new static class `Extensions` to the project
```
namespace WindowsFormsApp3
{
using Microsoft.Office.Interop.Excel;
static class Extensions
{
}
}
```
Insert into this class following 2 methods
First method
```
private static void Export(this ProductsDataSet dataSet, Worksheet worksheet)
{
var products = dataSet.Product.Select();
for (int i = 1, j = 6; i < products.Length; i++, j += 5)
{
worksheet.Range["A1", "D4"].Copy(Type.Missing);
worksheet.Range[$"A{j}"].PasteSpecial(XlPasteType.xlPasteAll,
XlPasteSpecialOperation.xlPasteSpecialOperationNone,
true, Type.Missing);
}
for (int i = 0, j = 3; i < products.Length; i++, j += 5)
{
worksheet.Range[$"B{j}"].Value = products[i][0];
worksheet.Range[$"C{j}"].Value = products[i][1];
}
}
```
Second method
```
public static void Export(this ProductsDataSet dataSet, string fileName)
{
Application application = new Application();
var workbook = application.Workbooks.Open(fileName,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing
);
dataSet.Export((Worksheet)workbook.Worksheets[1]);
application.Visible = true;
}
```
Customize `Form1` as below
[](https://i.stack.imgur.com/59yxS.png)
Subscribe following event handler to button's click event.
```
private void Button1_Click(object sender, EventArgs e)
{
using (var openFileDialog = new OpenFileDialog())
{
switch (openFileDialog.ShowDialog())
{
case DialogResult.OK:
var directoryName = System.IO.Path
.GetDirectoryName(openFileDialog.FileName);
var fileName = System.IO.Path
.GetFileName(openFileDialog.FileName);
var destFileName =
$"{directoryName}\\{DateTime.Now.Ticks}.{fileName}";
System.IO.File.Copy(openFileDialog.FileName, destFileName);
productsDataSet1.Export(destFileName);
break;
}
}
}
```
I created following excel template file, similar to yours. The program will open this file and populate it with data from `productsDataSet1`.
[](https://i.stack.imgur.com/fDzXd.png)
Here is running application
[](https://i.stack.imgur.com/dub7W.png)
Here is exported data in the excel file
[](https://i.stack.imgur.com/MoxHP.png)
| null | CC BY-SA 4.0 | null | 2022-10-04T13:27:08.067 | 2022-10-04T13:27:08.067 | null | null | 3,709,537 | null |
73,948,682 | 2 | null | 73,947,086 | 2 | null | Is this what you were looking for?
I've changed some of the variables slightly to save a bit of typing.
```
library(kableExtra)
library(dplyr)
date <- c("24-02-2022", "04-04-2022", "01-04-2022", "18-05-2022", "28-02-2022", "04-03-2022", "05-03-2022", "08-03-2022", "05-05-2022", "12-05-2022", "25-05-2022")
pr <- c("Negative", "Negative", "Negative", "Neutral", "Negative", "Positive", "Positive", "Negative", "Positive", "Negative", "Neutral")
df3 <-
data.frame(date, pr) |>
mutate(pr = cell_spec(pr, color = ifelse(pr == "Positive", "green", ifelse(pr == "Negative", "red", "black"))))
df3 |>
kable(caption = "Timeline of Events",
col.names = c("Date", "Predicted Reaction"),
escape = FALSE) |>
kable_classic(full_width = F, html_font = "Cambria")|>
pack_rows("All", 1, 4) |>
pack_rows("Specific", 5, 11)
```
[](https://i.stack.imgur.com/iJrU0.jpg)
| null | CC BY-SA 4.0 | null | 2022-10-04T13:31:59.213 | 2022-10-04T15:31:03.730 | 2022-10-04T15:31:03.730 | 6,936,545 | 6,936,545 | null |
73,948,806 | 2 | null | 73,948,672 | 0 | null | You could replace this
```
<label>Employee Number</label><br>
<b><?php echo $row['emp_num']; ?><br></b>
```
With a hidden fields to hold the key you need later in a way that you can access it when you need to
```
<input type="hidden" value="<?php echo $row['emp_num']; ?>" name="id">
```
The user will not see this, but it will allow `$_POST[id]` to hold the value of the `emp_num` when you get back to the PHP code after submission
You would also need to change the update query
```
WHERE employee.first_name='$_POST[id]'
```
To
```
WHERE employee.emp_num='$_POST[id]'
```
| null | CC BY-SA 4.0 | null | 2022-10-04T13:40:52.757 | 2022-10-04T13:46:55.787 | 2022-10-04T13:46:55.787 | 2,310,830 | 2,310,830 | null |
73,949,092 | 2 | null | 28,779,559 | 2 | null | Here is my very basic solution:
Just read the color from the previous plot with `.get_color()` and hand it over to the next one with the keyword `color`:
```
import numpy as np
import itertools
import matplotlib.pyplot as plt
m = 5
n = 5
x = np.zeros(shape=(m, n))
plt.figure(figsize=(5.15, 5.15))
plt.clf()
plt.subplot(111)
marker = itertools.cycle(('o', 'v', '^', '<', '>', 's', '8', 'p'))
for i in range(1, n):
x = np.dot(i, [1, 1.1, 1.2, 1.3])
y = x ** 2
lines = plt.plot(x, y, linestyle='', markeredgecolor='none', marker=next(marker))
linecolor = lines[0].get_color()
plt.plot(x, y, linestyle='-',color=linecolor)
plt.ylabel(r'$y$', labelpad=6)
plt.xlabel(r'$x$', labelpad=6)
plt.show()
```
As noted in [this answer](https://stackoverflow.com/a/60972020/5941051), the code was updated to run in Python 3.x.
You may also get what you want with the `plt.plot` keyword `markevery=...`, demonstrated [here](https://matplotlib.org/stable/gallery/lines_bars_and_markers/markevery_demo.html).
| null | CC BY-SA 4.0 | null | 2022-10-04T13:59:49.803 | 2022-10-04T13:59:49.803 | null | null | 5,941,051 | null |
73,949,264 | 2 | null | 73,948,960 | -1 | null | You can pass the custom drawable as icon. check this code.
Replace your RatingStar() function as it is using canvas to draw star, instead pass the custom drawable.
```
@Composable
private fun starShow(){
val icon = if (isSelected)
//your selected drawable
else
//your unselected drawable
Icon(
painter = painterResource(id = icon),
contentDescription = null,
tint = MyColor.starColor)
}
```
| null | CC BY-SA 4.0 | null | 2022-10-04T14:12:47.420 | 2022-10-04T14:12:47.420 | null | null | 7,248,394 | null |
73,949,383 | 2 | null | 73,100,046 | 0 | null | I've got this style by default:
```
api "com.google.android.material:material:1.6.1"
```
and used style: `<style name="AppTheme" parent="Theme.Material3.Light.NoActionBar">`
| null | CC BY-SA 4.0 | null | 2022-10-04T14:21:27.947 | 2022-10-04T14:21:27.947 | null | null | 1,293,668 | null |
73,949,597 | 2 | null | 73,949,504 | 0 | null | If the problem statement is
> So, for each meal of each day of each event I need to store how many people have chosen each one of the available dishes, taking into account that one person cannot choose more than one dish in each meal.
then I'd go with the basic models
- `Event`- `Dish`- `Person`- `EventDay``date`
and for meal selections, simply
```
class MealSelection(models.Model):
day = models.ForeignKey('EventDay')
person = models.ForeignKey('Person')
meal = models.CharField() # could add choices breakfast/lunch/dinner, or make this an FK
dish = models.ForeignKey('Dish')
class Meta:
unique_together = [('day', 'person', 'meal')]
```
The `unique_together` statement will prohibit, on the database level, anyone from choosing multiple dishes per meal per day per event.
Then, to query the counts, you could just
```
dish_counts = dict( # make dict out of tuples
MealSelection.objects.filter(event=..., day=...)
.values('dish') # group by dish
.annotate(n=Count('*')) # select group counts
.values_list('dish', 'n') # select dish/n as tuple
)
```
and you'd get a dict mapping Dish IDs to their counts.
Yes, you'd have up to N_DAYS * N_ATTENDEES * N_MEALs of `MealSelection`s, but SQL databases are efficient at dealing with that.
| null | CC BY-SA 4.0 | null | 2022-10-04T14:39:26.703 | 2022-10-04T14:39:26.703 | null | null | 51,685 | null |
73,949,652 | 2 | null | 73,948,057 | 1 | null | Maybe you could try using something like this:
```
import pandas as pd
def fix_row(row: pd.Series, column_name: str) -> pd.Series:
"""Split a row into multiple rows if `column_name` is a comma separated string.
Parameters
----------
row : pd.Series
The row to split.
column_name : str
The name of the column to split.
Returns
-------
pd.Series
The original row, or row created from splitting `column_name`.
"""
value = row[column_name]
formated_value = str(value).split(',')
if len(formated_value) > 1:
return pd.Series(dict(zip(row.keys(), formated_value)))
return row
# == Example ==================================================
df = pd.DataFrame(
{
"col1": ["1234,2022-02-02,10", "1234", "EBX10", "EBX20,2022-02-02,10"],
"col2": [None, "2022-02-02", "2022-03-02", None],
"col3": [None, 10, 50, None],
}
)
# Dataframe `df` looks like this:
#
# col1 col2 col3
# 0 1234,2022-02-02,10 None NaN <-- Column with formating problem
# 1 1234 2022-02-02 10.0
# 2 EBX10 2022-03-02 50.0
# 3 EBX20,2022-02-02,10 None NaN <-- Column with formating problem
# Call `fix_row` function using apply, and specify the name of the column
# to maybe split into multiple columns.
new_df = df.apply(fix_row, column_name='col1', axis=1)
# Dataframe `new_df` looks like this:
#
# col1 col2 col3
# 0 1234 2022-02-02 10
# 1 1234 2022-02-02 10.0
# 2 EBX10 2022-03-02 50.0
# 3 EBX20 2022-02-02 10
```
## Notes on fix_row function
The `fix_row` function works based on a couple of assumptions that need to be true, in order for it to work:
1. The function assumes that values from column_name parameter (in the example above, 'col1'), will only contain multiple commas, when there's a formatting problem.
2. When there's a row to fix, the function assumes that all the row values need to be replaced with the values from the column_name you specify, and they are in the correct order.
## Input and Output from the Example
`df`
| col1 | col2 | col3 |
| ---- | ---- | ---- |
| 1234,2022-02-02,10 | | nan |
| 1234 | 2022-02-02 | 10 |
| EBX10 | 2022-03-02 | 50 |
| EBX20,2022-02-02,10 | | nan |
`df.apply(fix_row, column_name='col1', axis=1)`
| col1 | col2 | col3 |
| ---- | ---- | ---- |
| 1234 | 2022-02-02 | 10 |
| 1234 | 2022-02-02 | 10 |
| EBX10 | 2022-03-02 | 50 |
| EBX20 | 2022-02-02 | 10 |
## Variations to fix_row you might consider trying
Instead of checking the length of the `formated_value`, you might swap the `if` condition statement, checking whether the other values from the row are empty or not. You could do that using something like this:
```
def fix_row(row: pd.Series, column_name: str) -> pd.Series:
value = row[column_name]
formated_value = str(value).split(',')
if row[[col for col in row.keys() if col != column_name]].isna().all():
return pd.Series(dict(zip(row.keys(), formated_value)))
return row
```
| null | CC BY-SA 4.0 | null | 2022-10-04T14:42:48.160 | 2022-10-04T14:42:48.160 | null | null | 17,587,002 | null |
73,950,016 | 2 | null | 73,948,680 | 0 | null | I replayed your example locally and it is looking like you are facing an exploding gradient issue: the algorithm tries to update the parameter but the step sizes are too large and it moves it out of the space allowed by the constraint. Since this is forbidden, no update is happening. To reduce the step size, scaling the objective function is enough:
```
def objective_fcn(x):
x1 = x[0]
x2 = x[1]
x3 = x[2]
profit = (128375.0 + x3*147187.0)*149.12*(1+x1) - (44.92*(1+x2))*(x3*147187.0 + 20326.0 + 147187.0*(1-x3))
return profit * -1 * 1e-7
```
which converges to:
```
The full result is:
fun: -3.84099195200049
jac: array([-2.19485256, 0.75246841, -3.84099194])
message: 'Optimization terminated successfully'
nfev: 12
nit: 3
njev: 3
status: 0
success: True
x: array([ 0.75 , -1. , 0.1278102])
```
Multiply the objective value by `-1e7` to know the optimal profit.
I picked `1e-7` at second trial (`1e-5` failed first). It can be interpreted as a manual tuning of the learning rate, and if you want to automate that, look into hyperparameter optimization in ML - for instance.
| null | CC BY-SA 4.0 | null | 2022-10-04T15:12:12.547 | 2022-10-04T15:18:33.893 | 2022-10-04T15:18:33.893 | 3,275,464 | 3,275,464 | null |
73,950,036 | 2 | null | 73,320,178 | 0 | null | You can check with the following code whether your batch list is indeed empty.
```
context.get_batch_list(batch_request=batch_request)
```
If this is empty, you probably have an issue with your data_asset_names.
You can check whether the correct data asset name has been used in the output of the following code.
```
context.test_yaml_config(yaml.dump(my_spark_datasource_config))
```
In the output there is a list of available data_asset_names that you can choose from. If the data asset_name of your BatchRequest is not in the list, you will have an empty batch_list as the data asset is not available. There should be a warning here but I think it is not implemented.
I had the same issue but figured it out yesterday. Also, you should produce a workable example of your error so people can explore the code. That way it is easier to help you.
Hopefully this helps!
| null | CC BY-SA 4.0 | null | 2022-10-04T15:13:31.420 | 2022-10-04T15:13:31.420 | null | null | 15,388,844 | null |
73,950,671 | 2 | null | 73,662,624 | 0 | null | I'm also experiencing the same problem and figured that this has something to do with the overlay css that comes with the dialog module. My hunch why online examples work is because they already installed Material Theme in their project and all overlay css are included in it.
The solution is try importing the pre-built overlay css as indicated in the overlay CDK Documentation.
Reference:
[https://material.angular.io/cdk/overlay/overview](https://material.angular.io/cdk/overlay/overview)
In my Angular case, I imported it in and it now works. cheers!
```
@import '@angular/cdk/overlay-prebuilt.css';
```
| null | CC BY-SA 4.0 | null | 2022-10-04T16:08:59.847 | 2022-10-04T16:17:20.937 | 2022-10-04T16:17:20.937 | 10,651,821 | 10,651,821 | null |
73,950,700 | 2 | null | 73,950,565 | 0 | null | You do not need to have a state for each album, you just need to set `albumList` as a state:
```
const [albumList, setAlbumList] = setState({});
function addAlbum(albumId, image) {
const newList = {...albumList};
if(!(albumId in albumList)) {
newList[albumId] = true;
} else {
delete albumList[albumId]
}
setAlbumList(newList);
}
```
And then in your loop you can make a condition to display the check mark or not by checking if the `id` is in `albumList`.
| null | CC BY-SA 4.0 | null | 2022-10-04T16:11:56.350 | 2022-10-04T16:11:56.350 | null | null | 9,718,056 | null |
73,950,844 | 2 | null | 73,901,740 | 0 | null | I found an undocumented feature in the kendo grid source. It will use a property called "ref" on the filter if available. This also seems to require the `from` and `to` properties be changed to a string address in the excel file. Not sure how stable this is, but this works on the latest version of kendoui.
```
filter: { ref: "A2:B2", from: "A2", to: "B2" },
```
[](https://i.stack.imgur.com/D4dJV.png)
Implemented in event handler for excel export, it looks something like
```
var intFrom = sheet["filter"]["from"];
var intTo = sheet["filter"]["to"];
// kendo uses zero based index for column, but need column 1 to be "A"
var colFrom = excelGetCharFromNumber(intFrom + 1);
var colTo = excelGetCharFromNumber(intTo + 1);
// "2" row is hardcoded here
sheet["filter"] = {
// redefine "from" and "to"
"ref": "" + colFrom + "2:" + colTo + "2",
"from": "" + colFrom + "2",
"to": "" + colTo + "2"
};
```
Where `excelGetCharFromNumber` is [this answer](https://stackoverflow.com/a/15678976/1462295):
```
function excelGetCharFromNumber(columnNumber){
var dividend = columnNumber;
var columnName = "";
var modulo;
while (dividend > 0)
{
modulo = (dividend - 1) % 26;
columnName = String.fromCharCode(65 + modulo).toString() + columnName;
dividend = parseInt((dividend - modulo) / 26);
}
return columnName;
}
```
| null | CC BY-SA 4.0 | null | 2022-10-04T16:24:14.323 | 2022-10-04T16:24:14.323 | null | null | 1,462,295 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.