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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
75,397,915 | 2 | null | 75,352,643 | 1 | null | If you wants to remove the sidenavbar when you are not logged in there is two way.
1. Use a token for it and.
2. Use a state give it's initial value false, when the login api success then true the state with this condition also you need your user id to check if it's there then show the sidenavbar.
| null | CC BY-SA 4.0 | null | 2023-02-09T11:25:48.370 | 2023-02-09T11:25:48.370 | null | null | 19,398,685 | null |
75,398,352 | 2 | null | 66,396,425 | 2 | null | I know this is some time ago but i managed to do something like the wanted behavior. I wrapped a Disclosure.Panel element in Transition:
```
<Transition
className="transition-all duration-500 overflow-hidden"
enterFrom="transform scale-95 opacity-0 max-h-0"
enterTo="transform scale-100 opacity-100 max-h-96"
leaveFrom="transform scale-100 opacity-100 max-h-96"
leaveTo="transform scale-95 opacity-0 max-h-0"
>
```
If your content is taller than max-h-96 (height: 24rem; /* 384px */). You will have to customise the tailwind config to include a higher max-h.
You can also use max-h-['number'px] like so:
```
<Transition
className="transition-all duration-500 overflow-hidden"
enterFrom="transform scale-95 opacity-0 max-h-0"
enterTo="transform scale-100 opacity-100 max-h-[1000px]"
leaveFrom="transform scale-100 opacity-100 max-h-[1000px]"
leaveTo="transform scale-95 opacity-0 max-h-0"
>
```
[Show the animation, horrible quality](https://i.stack.imgur.com/BUqEp.gif)
| null | CC BY-SA 4.0 | null | 2023-02-09T12:04:34.663 | 2023-02-10T11:10:55.377 | 2023-02-10T11:10:55.377 | 19,160,076 | 19,160,076 | null |
75,398,394 | 2 | null | 75,397,412 | 0 | null | This error message is indicating that the phpunit/phpunit package requires the ext-dom extension, but it is not installed or enabled on your system.
To resolve this issue, you need to install the ext-dom extension on your system. You can do this by running the following command in your terminal:
```
sudo apt-get install php-xml
```
After installing the ext-dom extension, try running composer update again to see if the issue has been resolved. If you continue to experience the same error, you may need to restart your web server or check your PHP configuration to ensure that the ext-dom extension is properly loaded.
| null | CC BY-SA 4.0 | null | 2023-02-09T12:07:44.440 | 2023-02-09T12:07:44.440 | null | null | 16,156,791 | null |
75,398,637 | 2 | null | 75,396,095 | 0 | null | SO, I have finally managed to figure out how this can be done using github actions.
Im my actions.yml file, I have added a new step which makes use of "jfrog/setup-jfrog-cli" action from the github actions marketplace, the link to this is as follows. It shows you how to configure the action.
[https://github.com/marketplace/actions/setup-jfrog-cli](https://github.com/marketplace/actions/setup-jfrog-cli)
I have configured the artifactory platform url as well as the username and access token in this action.
A new action was created which would build my code using the "jf maven" goal. Before you can make use of maven using jfrog CLI, it needs to be configured using the "jf mvn-config" command, it is here that you can specify which are the release and snapshot repositories that you want to make use of. The following is the code snippet that I have used for the same. Please note that these are steps within the github actions pipeline job and not the completed build yml file'
```
- name: Setup jfrog
uses: jfrog/setup-jfrog-cli@v3
with:
version: latest
env:
JF_URL: "https://artifactory.com" #be mindful not to add the path /artifactory here as it will cause authentication issue
JF_USER: ${{ secrets.ARTIFACT_USER_ID }}
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACT_TOKEN }} # You have an option of giving password as well
- name: maven build
run: |
jf mvn-config --repo-deploy-releases=${ARTIFACTORY_RELEASE} --repo-deploy-snapshots=${ARTIFACTORY_SNAPSHOT} # mention the names of your release and snapshot repos within the jfrog artifacory
jf mvn deploy
jf rt bp # (optional, deploy build info, use --dry-run flag to see the build info in console without committing it)
```
There are many other optional parameters which you can use to enrich and configure the build, it can be found in the following links
[https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-RunningMavenBuilds](https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-RunningMavenBuilds)
[https://www.jfrog.com/confluence/display/JFROG/QuickStart+Guide%3A+Maven+and+Gradle](https://www.jfrog.com/confluence/display/JFROG/QuickStart+Guide%3A+Maven+and+Gradle)
[https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-BuildIntegration](https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-BuildIntegration)
| null | CC BY-SA 4.0 | null | 2023-02-09T12:31:07.127 | 2023-02-09T12:31:07.127 | null | null | 9,492,915 | null |
75,398,809 | 2 | null | 75,395,189 | 0 | null | To click on the element with text as you need to induce [WebDriverWait](https://stackoverflow.com/a/59130336/7429447) for the [element_to_be_clickable()](https://stackoverflow.com/a/54194511/7429447) and you can use either of the following [locator strategies](https://stackoverflow.com/a/48056120/7429447):
- Using :```
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div#bktContinue font"))).click()
```
- Using :```
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@id='bktContinue']//font[contains(., 'CONTINUE')]"))).click()
```
- : You have to add the following imports :```
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
```
| null | CC BY-SA 4.0 | null | 2023-02-09T12:45:56.667 | 2023-02-09T12:45:56.667 | null | null | 7,429,447 | null |
75,398,801 | 2 | null | 18,773,367 | 0 | null | Until C++20 [CRTP](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) was the standard workaround to realize mixins in C++. A [mixin](https://en.wikipedia.org/wiki/Mixin) serves the avoidance of code duplication. It is a kind of compile-time polymorphism.
A typical example are iterator support interfaces. Many of the functions are implemented absolutely identically. For example, `C::const_iterator C::cbegin() const` always calls `C::const_iterator C::begin() const`.
> In C++ `struct` is the same as `class`, except members and inheritance are public by default.
```
struct C {
using const_iterator = /* C specific type */;
const_iterator begin() const {
return /* C specific implementation */;
}
const_iterator cbegin() const {
return begin(); // same code in every iterable class
}
};
```
C++ does not yet provide direct support for such default implementations. However, when `cbegin()` is moved to a base class `B`, it has no type information about the derived class `C`.
```
struct B {
// ???: No information about C!
??? cbegin() const {
return ???.begin();
}
};
struct C: B {
using const_iterator = /* C specific type */;
const_iterator begin() const {
return /* C specific implementation */;
}
};
```
`this`
The compiler knows the concrete data type of the object at compile time, until C++20 there was simply no way to get this information.
Since C++23 you can use [explicit this](https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_parameter) ([P0847](https://wg21.link/P0847)) to get it.
```
struct B {
// 1. Compiler can deduce return type from implementation
// 2. Compiler can deduce derived objects type by explicit this
decltype(auto) cbegin(this auto const& self) {
return self.begin();
}
};
struct C: B {
using const_iterator = /* C specific type */;
const_iterator begin() const {
return /* C specific implementation */;
}
};
```
This type of mixin is easy to implement, easy to understand, easy to use, and robust against typos! It is superior to classic CRTP in every respect.
With CRTP, you passed the data type of the derived class as a tempalte argument to the base class. Thus, basically the same implementation was possible, but the syntax is much more difficult to understand.
```
// This was CRTP used until C++20!
template <typename T>
struct B {
// Compiler can deduce return type from implementation
decltype(auto) cbegin() const {
// We trust that T is the actual class of the current object
return static_cast<T const&>(*this).begin();
}
};
struct C: B<C> {
using const_iterator = /* C specific type */;
const_iterator begin() const {
return /* C specific implementation */;
}
};
```
Moreover, a really nasty typo could quickly happen here. I'll modify the example a bit to make the consequences of the mistake more obvious.
```
#include <iostream>
struct C;
struct D;
template <typename T>
struct B {
decltype(auto) cget() const {
return static_cast<T const&>(*this).get();
}
};
struct C: B<C> {
short port = 80;
short get() const {
return port;
}
};
// Copy & Paste BUG: should be `struct D: B<**D**>`
struct D: B<C> {
float pi = 3.14159265359f;
float get() const {
return pi;
}
};
int main () {
D d;
// compiles fine, but calles C::get which interprets D::pi as short
std::cout << "Value: " << d.cget() << '\n';
// prints 'Value: 4059' on my computer
}
```
That is a very dangerous error, because the compiler cannot detect it!
| null | CC BY-SA 4.0 | null | 2023-02-09T12:45:28.970 | 2023-02-09T12:45:28.970 | null | null | 4,821,621 | null |
75,399,408 | 2 | null | 75,396,230 | 0 | null | You could:
1. Create a function to flatten an object;
2. Call it on each entry of the data and including arrays.
3. Build a 2 dimensional array from that, including the headings (keys)
4. Convert that matrix to HTML, converting ISO date strings to a different date format
Here is a snippet:
```
function* flatten(obj) {
for (let [key, value] of Object.entries(obj)) {
if (Object(value) === value) {
for (let [key2, value2] of flatten(value)) {
yield [`${key}.${key2}`, value2];
}
} else yield [key, value];
}
}
// Convert ISO format date to dd/mm/yyyy hh:mm:ss format (UTC)
function format(value) {
return String(value).replace(/(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).*/,
"$3/$2/$1 $4:$5:$6");
}
function makeMatrix(obj) {
const heading = [];
const matrix = [heading];
for (const elem of Object.values(obj).flat()) {
const row = [];
for (const [key, value] of flatten(elem)) {
let col = heading.indexOf(key);
if (col < 0) col = heading.push(key) - 1;
row[col] = value;
}
matrix.push(row);
}
// Fill gaps
return matrix.map(row =>
heading.map((_, i) => row[i] ?? "")
);
}
function toHTML(matrix) {
return `<table>${
matrix.map((row, i) => `<tr>${
row.map(cell => `<t${"dh"[+!i]}>${format(cell) ?? ""}</t${"dh"[+!i]}>`)
.join("")
}</t>`).join("")
}</table>`;
}
// Your data
const response = {"data": [{"type": "articles","id": "1","attributes": {"title": "JSON:API paints my bikeshed!","body": "The shortest article. Ever.","created": "2015-05-22T14:56:29.000Z","updated": "2015-05-22T14:56:28.000Z"},"relationships": {"author": {"data": {"id": "42","type": "people"}}}}],"included": [{"type": "people","id": "42","attributes": {"name": "John","age": 80,"gender": "male"}}]};
const matrix = makeMatrix(response);
const htmlTable = toHTML(matrix);
document.querySelector("div").innerHTML = htmlTable;
```
```
table { border-collapse: collapse }
td, th { border: 1px solid; white-space: nowrap }
```
```
<div></div>
```
| null | CC BY-SA 4.0 | null | 2023-02-09T13:37:40.660 | 2023-02-09T13:37:40.660 | null | null | 5,459,839 | null |
75,399,552 | 2 | null | 75,399,482 | 1 | null | Check this tutorial: [https://mui.com/material-ui/react-grid/](https://mui.com/material-ui/react-grid/)
Should look something like this:
```
<Grid container spacing={2}>
<Grid item xs={6}>
BUTTON
</Grid>
<Grid item xs={6}>
BUTTON
</Grid>
<Grid item xs={12}>
BUTTON
</Grid>
</Grid>
```
Where `xs={value}` defines how big a grid item should be.
So for your case you need two equal columns on top of one column that is the sum of the above columns.
| null | CC BY-SA 4.0 | null | 2023-02-09T13:49:36.940 | 2023-02-09T16:27:14.907 | 2023-02-09T16:27:14.907 | 15,292,421 | 15,292,421 | null |
75,399,633 | 2 | null | 75,399,398 | 0 | null | this came from eslint click `Quick Fix` or run this command:
```
npx eslint --ext=.js,.jsx --fix
```
| null | CC BY-SA 4.0 | null | 2023-02-09T13:56:27.740 | 2023-02-09T13:56:27.740 | null | null | 12,342,919 | null |
75,399,749 | 2 | null | 75,394,222 | 0 | null | You are using regular CSS. Try to use:
```
::ng-deep .mdc-line-ripple::after {
border-bottom-width: 0 !important;
}
```
- [Nesting CSS classes](https://stackoverflow.com/questions/4564916/nesting-css-classes)
| null | CC BY-SA 4.0 | null | 2023-02-09T14:05:04.637 | 2023-02-09T14:05:04.637 | null | null | 19,782,508 | null |
75,399,788 | 2 | null | 75,388,321 | 0 | null | The problem was the image format `QImage::Format_ARGB32_Premultiplied`. The way I modified the image, `QImage::Format_ARGB32` was appropriate. Using that format solved the problem.
| null | CC BY-SA 4.0 | null | 2023-02-09T14:07:20.870 | 2023-02-09T14:07:20.870 | null | null | 347,964 | null |
75,399,851 | 2 | null | 75,399,719 | 0 | null | Try the below XPath expression for email field:
```
//input[contains(@type,'email')]
```
And below one for password:
```
//input[contains(@type,'password')]
```
`driver.find_element()` code would look like below:
```
driver.find_element(By.XPATH,"//input[contains(@type,'email')]").send_keys("your email address here")
driver.find_element(By.XPATH,"//input[contains(@type,'password')]").send_keys("your password here")
```
| null | CC BY-SA 4.0 | null | 2023-02-09T14:12:16.873 | 2023-02-10T00:09:15.107 | 2023-02-10T00:09:15.107 | 7,429,447 | 7,598,774 | null |
75,399,891 | 2 | null | 26,189,404 | 0 | null | Project -> Targets -> Info -> Custom iOS Target Properties
[enter image description here](https://i.stack.imgur.com/p93sK.png)
| null | CC BY-SA 4.0 | null | 2023-02-09T14:15:18.247 | 2023-02-09T14:15:18.247 | null | null | 19,365,040 | null |
75,399,932 | 2 | null | 73,070,301 | 0 | null | I give two options, either `place()` or `pack()`.Actually, both are the same positions at specific coordinates.
Either comment out or comment in line 10 or line 11.
Same code as your:
```
import tkinter as ter
root = ter.Tk()
root.minsize(500,500)
im = ter.PhotoImage(height=1, width=1)
my_button = ter.Button(root, height=1, width=1, image=im, bg="black")
#my_button.pack(side=ter.LEFT, padx=250, pady=250)
my_button.place(x=250, y=250)
root.mainloop()
```
Screenshot:
[](https://i.stack.imgur.com/svlL5.png)
| null | CC BY-SA 4.0 | null | 2023-02-09T14:18:08.440 | 2023-02-09T14:18:08.440 | null | null | 4,136,999 | null |
75,399,987 | 2 | null | 20,199,647 | 0 | null | I got the same problem but with .
I found two versions in my PC.
This one has .
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow
This one has .
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\VsTest
| null | CC BY-SA 4.0 | null | 2023-02-09T14:22:50.327 | 2023-02-09T14:28:02.590 | 2023-02-09T14:28:02.590 | 1,812,394 | 1,812,394 | null |
75,400,167 | 2 | null | 20,915,266 | 0 | null | I found a way to do this - none of the others worked for me. Click Wipe Data as in screenshot below - it's an issue with the emulator.
[](https://i.stack.imgur.com/DOIn3.png)
| null | CC BY-SA 4.0 | null | 2023-02-09T14:38:21.617 | 2023-02-09T14:38:21.617 | null | null | 1,213,321 | null |
75,400,231 | 2 | null | 28,714,646 | 0 | null | In your android studio settings, go to Experimental and unvalidate the "Enable new logcat" and restart your android studio, it will work.
| null | CC BY-SA 4.0 | null | 2023-02-09T14:43:37.660 | 2023-02-09T14:43:37.660 | null | null | 7,350,424 | null |
75,400,296 | 2 | null | 75,376,775 | 0 | null | Try switching to API mode 1 (ATAP=1). With ATAP set to 2, the XBee "escapes" certain values with 0x7D.
Here's Digi's documentation on [escaped API mode](https://www.digi.com/resources/documentation/Digidocs/90001942-13/concepts/c_api_escaped_operating_mode.htm?TocPath=XBee%20API%20mode%7COperating%20mode%20configuration%7C_____1):
In your example, the escaped values are:
```
0x7D 0x31 -> 0x11
0x7D 0x33 -> 0x13
0x7D 0x5E -> 0x7E
0x7D 0x5D -> 0x7D
```
So the packet came from 00 13 A2 00 41 C1 7E 38, and had the correct payload of BB BE DD 7D 3F.
I have yet to run into an application that needs API mode 2. Switch to ATAP=1, make sure your software knows it's running in "unescaped" mode, and it should resolve your issue.
| null | CC BY-SA 4.0 | null | 2023-02-09T14:48:04.040 | 2023-02-09T14:48:04.040 | null | null | 266,392 | null |
75,401,004 | 2 | null | 75,400,849 | 0 | null | The last five minutes must be select with a BETWEEN.
Also testing you should add
```
SELECT created_at, Now() FROM menfesses WHERE created_at BETWEEN NOW() - INTERVAL 5 MINUTE AND NOW()
```
So that have a chance to debug it correctly
Between would only give you the correct data, as your test server could have dates later then now
# Edit
a fiddle demonstrates my point [https://dbfiddle.uk/c5Jlko65](https://dbfiddle.uk/c5Jlko65)
You maybe off on the system you have
| null | CC BY-SA 4.0 | null | 2023-02-09T15:43:20.960 | 2023-02-09T15:51:54.733 | 2023-02-09T15:51:54.733 | 5,193,536 | 5,193,536 | null |
75,401,069 | 2 | null | 75,400,849 | 0 | null | Probably your server time that's not what you think it is.
This work with a 5 min laps.
[SQL Fiddle](http://sqlfiddle.com/#!9/3711f2/1)
:
```
CREATE TABLE t1
(`c_date` datetime)
;
INSERT INTO t1
(`c_date`)
VALUES
(NOW() - INTERVAL 30 MINUTE),
(NOW() - INTERVAL 2 MINUTE),
(NOW() - INTERVAL 1 MINUTE)
;
```
:
```
SELECT *,NOW() FROM t1 WHERE c_date >= NOW() - INTERVAL 5 MINUTE
```
[Results](http://sqlfiddle.com/#!9/3711f2/1/0):
```
| c_date | NOW() |
|----------------------|----------------------|
| 2023-02-09T15:44:05Z | 2023-02-09T15:46:20Z |
| 2023-02-09T15:45:05Z | 2023-02-09T15:46:20Z |
```
| null | CC BY-SA 4.0 | null | 2023-02-09T15:47:40.563 | 2023-02-09T15:47:40.563 | null | null | 5,546,267 | null |
75,401,276 | 2 | null | 75,401,219 | 0 | null | Based on that screenshot of a (Jupyter) notebook session, you're probably not running all of the cells in order.
You will need to run the first cell, the one that assigns the name `ordinal_encoder`, before attempting to run the latter cells that use that name.
The same stands for `label_X_train`, which is defined in the first cell and only used in the second.
In other words: click "Run All".
| null | CC BY-SA 4.0 | null | 2023-02-09T16:05:45.237 | 2023-02-09T16:05:45.237 | null | null | 51,685 | null |
75,401,415 | 2 | null | 75,398,462 | -1 | null | Well, HOW do you share ANY code in your existing application, or code from "other" applications?
Why of course, you have/put that code in a class.
I mean in your project now, how do you use/enjoy a bunch of helper code and routines?
You wind up with a class, and then in code create a instance of that class.
So, say I have a class that holds some information about a hotel?
Then you add a class to your project, and then simple use that class in code.
So, say this class:
```
Public Class Hotel
Public HotelName As String
Public City As String
Public HotelDescripiton As String
Public FirstName As String
Public Lastname As String
Public ReadOnly Property FullName As String
Get
Return FirstName & " " & Lastname
End Get
End Property
End Class
```
Then in code, you can use that "code"
eg:
```
Dim OneHotel As New Hotel
OneHotel.HotelName = "Super 8 Hotel"
OneHotel.FirstName = "John"
OneHotel.Lastname = "Smith"
Debug.Print(OneHotel.FullName)
```
Output:
```
John Smith
```
Same goes for a console application. If you want share that code, then move the console code you want to share to a class.
Say I have this console application. When I run it, it will display all my drives on the computer.
So, from command prompt I have this:
[](https://i.stack.imgur.com/b6XI1.png)
So, now let's say I want to use above in my web site - to display/list all the hard drives.
So, the code for above console application is this:
```
Sub Main()
Dim cMyCode As New clsSharedCode
Dim sDriveList As List(Of String)
sDriveList = cMyCode.GetDrives
For Each s As String In sDriveList
Console.WriteLine(s)
Next
End Sub
```
But, the "working" code for that console been moved to a class called clsSharedCode.
That is this:
```
Imports System.IO
Public Class clsSharedCode
Public Function GetDrives() As List(Of String)
Dim DriveList As New List(Of String)
Dim allDrives As DriveInfo() = DriveInfo.GetDrives
For Each d As DriveInfo In allDrives
Dim s As String
s = $"Drive:{d.Name} Volume:{d.VolumeLabel} Type:{d.DriveType} Ready:{d.IsReady}"
DriveList.Add(s)
Next
Return DriveList
End Function
End Class
```
OK, so now let's use above in our web site. We simple set a reference to vbconsole.exe.
So, now this web page markup:
```
<h3>Drives on computer</h3>
<asp:ListBox ID="ListBox1" runat="server" Height="223px" Width="423px">
</asp:ListBox>
```
code behind
```
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim cConsoleCode As New VBConsole.clsSharedCode
Dim sDriveList As New List(Of String)
sDriveList = cConsoleCode.GetDrives
For Each sDrive As String In sDriveList
ListBox1.Items.Add(sDrive)
Next
End If
End Sub
```
And then we get this:
[](https://i.stack.imgur.com/aQAvL.png)
So, to "share" code? How this works EVEN with a simple plain-Jane console application is quite much the same as you "always" done this.
This does mean/suggest that the working code in your console application should be moved out to a shared code class that BOTH the console application, and now your web application can use and enjoy.
But, be a web site, or even a simple console application?
The why and how of sharing the code is much is the same in .net. You share code by using a object approach, and this is quite much the WHOLE foundation as to how .net code works - including that of sharing code between systems and applications.
So, in my web application, I simple set a reference to vbconsole.exe, and now I am free to use + consume any code in that console application. However, as noted, like you ALWAYS done to share code? You will as a general rule move that code out to a class, and then any other application is free to consume + use that code by using the public class code you have in that application. So, that MySharedCode class in the console application can now be used by any other .net application, include that asp.net web site.
So, .net is "primarily" an object-based system, and this is the main pillar and foundation of how you re-use and share .net code. You share such code by creating class(s) with that code, so then your existing application (the console application) can use those class(s), and as above shows, by a simple reference to the vbconsole.exe application, the web site can also use + enjoy + consume that code also.
So, because a class forces you to separate out the UI parts from the code parts, then even adopting this approach in a simple console application means that such code can be used + consumed by any type of application. You can write another console application, and reference our above console application and use that code.
But, we can also create a windows desktop program, and again reference the vbconsole.exe application. And so can our web-based application.
And even MORE amazing? You can consume the above class in c#, or vb.net, and again it doesn't matter!
| null | CC BY-SA 4.0 | null | 2023-02-09T16:16:03.083 | 2023-02-21T22:29:55.997 | 2023-02-21T22:29:55.997 | 472,495 | 10,527 | null |
75,401,474 | 2 | null | 27,950,902 | 0 | null | You can also achieve the same effect by using `position: relative` on the parent element as long as the parent element isn't the full width of the page.
For example, if you have
```
<div class="wrapper">
<p> Test Test Test Test Test </p>
</div>
```
In your CSS you can put
```
.wrapper {
position: relative;
max-width: 700px; // set this to width you want your content to be
margin: 0 auto;
}
```
And you will get the same effect. The background of the selected text will only be as width as the `.wrapper` element.
| null | CC BY-SA 4.0 | null | 2023-02-09T16:20:31.500 | 2023-02-09T16:20:31.500 | null | null | 2,409,329 | null |
75,401,660 | 2 | null | 75,401,151 | 0 | null | You can use [:nth-child()](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child) selectors to locate rows and columns in the table:
```
const
currency = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }),
simpleInterest = (p, t, r) => p + (p * (r * t)),
compoundInterest = (p, t, r, n) => p * ((1 + (r / n)) ** (n * t));
const
p = parseInt(document
.querySelector('table tbody tr:nth-child(1) td:nth-child(2)')
.innerText
.replace(/^\$/, ''), 10),
t = parseInt(document
.querySelector('table tbody tr:nth-child(3) td:nth-child(2)')
.innerText
.replace(/\s*years$/, ''), 10),
r = parseInt(document
.querySelector('table tbody tr:nth-child(2) td:nth-child(2)')
.innerText
.replace(/%$/, ''), 10) * 0.01,
n = 1; // number times interest applied per time period
document
.querySelector('table tfoot tr:nth-child(1) td:nth-child(2)')
.innerText = `${currency.format(simpleInterest(p, t, r))}`;
document
.querySelector('table tfoot tr:nth-child(2) td:nth-child(2)')
.innerText = `${currency.format(compoundInterest(p, t, r, n))}`;
```
```
table, th, td { border: thin solid black; }
```
```
<table>
<thead>
<tr><th>Parameter</th><th>Value</th></tr>
</thead>
<tbody>
<tr><td>Principal</td><td>$3000</td></tr>
<tr><td>Annual Interest Rate</td><td>6%</td></tr>
<tr><td>Period</td><td>5 years</td></tr>
</tbody>
<tfoot>
<tr><td>Simple Interest</td><td></td></tr>
<tr><td>Compound Interest</td><td></td></tr>
</tfoot>
</table>
```
Alternatively, you can use the [Table API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement#instance_properties):
```
const
currency = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }),
simpleInterest = (p, t, r) => p + (p * (r * t)),
compoundInterest = (p, t, r, n) => p * ((1 + (r / n)) ** (n * t)),
table = document.querySelector('table');
const
p = parseInt(table.tBodies[0].rows[0].cells[1].innerText.replace(/^\$/, ''), 10),
t = parseInt(table.tBodies[0].rows[2].cells[1].innerText.replace(/\s*years$/, ''), 10),
r = parseInt(table.tBodies[0].rows[1].cells[1].innerText.replace(/%$/, ''), 10) * 0.01,
n = 1; // number times interest applied per time period
table.tFoot.rows[0].cells[1].innerText = `${currency.format(simpleInterest(p, t, r))}`;
table.tFoot.rows[1].cells[1].innerText = `${currency.format(compoundInterest(p, t, r, n))}`;
```
```
table, th, td { border: thin solid black; }
```
```
<table>
<thead>
<tr><th>Parameter</th><th>Value</th></tr>
</thead>
<tbody>
<tr><td>Principal</td><td>$3000</td></tr>
<tr><td>Annual Interest Rate</td><td>6%</td></tr>
<tr><td>Period</td><td>5 years</td></tr>
</tbody>
<tfoot>
<tr><td>Simple Interest</td><td></td></tr>
<tr><td>Compound Interest</td><td></td></tr>
</tfoot>
</table>
```
| null | CC BY-SA 4.0 | null | 2023-02-09T16:33:59.387 | 2023-02-09T16:40:50.683 | 2023-02-09T16:40:50.683 | 1,762,224 | 1,762,224 | null |
75,401,779 | 2 | null | 75,399,430 | 0 | null | You're misusing those CORS headers, both on the client side and on the server side. You should familiarise better with [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) and with the API of [Express.js's CORS middleware](https://expressjs.com/en/resources/middleware/cors.html).
## Client side
The `Access-Control-Allow-Origin` header is a header; including it in a request makes no sense.
```
async function loginUser(credentials) {
return fetch('https://slugga-api.onrender.com/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'true' // incorrect
},
body: JSON.stringify(credentials)
})
.then(data => data.json())
}
```
## Server side
The `headers` property of your CORS config corresponds to headers that you wish to allow, but what you've listed are headers.
```
app.use(cors({
origin: "https://slug-panel.onrender.com",
headers: {
"Access-Control-Allow-Origin": "https://slug-panel.onrender.com", // incorrect
"Access-Control-Allow-Credentials": true // incorrect
},
}));
```
Instead, you most likely want something like
```
app.use(cors({
origin: "https://slug-panel.onrender.com",
headers: ["Content-Type"],
credentials: true,
}));
```
| null | CC BY-SA 4.0 | null | 2023-02-09T16:43:06.347 | 2023-02-09T16:43:06.347 | null | null | 2,541,573 | null |
75,401,942 | 2 | null | 75,401,288 | 1 | null | @peinearydevelopment is right, you have a typo in the word ngOnInit. You also have to implement the OnInit interface in the AppComponent to trigger the ngOnInit method when the application starts.
```
import { Component, OnInit } from '@angular/core';
import { FaceSnap } from './facesnap.models';
@Component({
selector: 'app-root', // Grace a ceci, on peut utiliser notre component coe une balise
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
mySnap1!: FaceSnap; //On cree une variable de type FaceSnap
mySnap2!: FaceSnap;
mySnap3!: FaceSnap;
ngOnInit() {
this.mySnap1 = {
title:"Senes",
description:"Mon meilleur Ami Ennemi",
createDate:new Date(),
snaps: 256,
imageUrl: "https://cdn.pixabay.com/photo/2015/05/31/16/03/teddy-bear-792273_1280.jpg",
location: "Berlin"
};
this.mySnap2 = {
title: "Blueno",
description: "Le max",
createDate: new Date(),
snaps: 2254,
imageUrl: "https://cdn.pixabay.com/photo/2015/05/31/16/03/teddy-bear-792273_1280.jpg",
location: "München",
};
this.mySnap3 = {
title: "Linda",
description: "Best",
createDate: new Date(),
snaps: 93,
imageUrl: "https://cdn.pixabay.com/photo/2015/05/31/16/03/teddy-bear-792273_1280.jpg",
};
}
}
```
| null | CC BY-SA 4.0 | null | 2023-02-09T16:56:29.160 | 2023-02-09T16:56:29.160 | null | null | 12,252,417 | null |
75,402,420 | 2 | null | 62,509,987 | 0 | null | You can use .listRowInsets() for your section and use a negative value for the bottom.
```
.listRowInsets(EdgeInsets(top: 0,leading: 0,bottom: -20,trailing: 0))
```
| null | CC BY-SA 4.0 | null | 2023-02-09T17:37:53.150 | 2023-02-09T17:37:53.150 | null | null | 11,758,610 | null |
75,402,450 | 2 | null | 75,401,836 | 0 | null | ```
let dateFields = document.querySelectorAll('#iFlightTable tr td:nth-child(4)');
dateFields.forEach( field => {
field.innerText = field.innerText.split(/\s/)[0];
});
```
```
<table border="0" cellpadding="0" id="iFlightTable" class="cellpadding3 styled-table">
<tbody>
<tr class="flightData1" id="AS 2224_2023-02-09T21:17:00_Anchorage_row">
<td id="Alaska Air"> Alaska</td>
<td> 2224</td>
<td> Anchorage</td>
<td id="1676006220000"> 9:17P 02-09-23</td>
<td> <font class="default"> On Time </font> </td> <!-- -->
<td id="AS 2224_2023-02-09T21:17:00_bags"> </td>
<td id="AS 2224_2023-02-09T21:17:00_gate">2A</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr class="flightData2" id="AS 657_2023-02-09T16:35:00_Las Vegas_row">
<td id="Alaska Air"> Alaska</td>
<td> 657</td>
<td> Las Vegas</td>
<td id="1675989300000"> 4:35P 02-09-23</td>
<td> <font class="default"> On Time </font> </td> <!-- -->
<td id="AS 657_2023-02-09T16:35:00_bags"> </td>
<td id="AS 657_2023-02-09T16:35:00_gate">1</td>
<td> </td>
<td> </td>
<td> </td>
</tr> </tbody>
```
| null | CC BY-SA 4.0 | null | 2023-02-09T17:40:38.150 | 2023-02-11T07:17:26.820 | 2023-02-11T07:17:26.820 | 21,182,129 | 21,182,129 | null |
75,403,261 | 2 | null | 74,739,713 | 0 | null | I had a similar issue. `renderButton()` didn't work because I couldn't style the iframe it produced, so I removed it and used a custom button div.
What worked for me was doing an @click on my button div for a "showGooglePrompt" function that looked like this:
```
showGooglePrompt() {
window.google.accounts.id.prompt((notification) => {
if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
// clear g_state cookie if the pop-up has already been closed
document.cookie = `g_state=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT`;
window.google.accounts.id.prompt()
}
});
},
```
I also ran `window.google.accounts.id.initialize()` on page load.
| null | CC BY-SA 4.0 | null | 2023-02-09T19:01:30.637 | 2023-02-09T19:17:15.357 | 2023-02-09T19:17:15.357 | 11,222,940 | 11,222,940 | null |
75,403,738 | 2 | null | 75,403,582 | 0 | null | Seems like you have provided a very big value to the `top` property of `.error_text` class. That's why it's going way out of the window and you can't see it. Try changing the value to `top: 0` or something smaller.
| null | CC BY-SA 4.0 | null | 2023-02-09T19:49:58.317 | 2023-02-09T19:49:58.317 | null | null | 14,938,169 | null |
75,403,857 | 2 | null | 75,403,684 | 2 | null | You have to sort your values by index (yearOfRelease):
```
import matplotlib.pyplot as plt
sr = pandasDF.loc[pandasDF['yearOfRelease'] >= '1990', 'yearOfRelease'].astype(int)
ax = (sr.value_counts().sort_index()
.plot.bar(title='number of movies by year of release',
xlabel='yearOfRelease', ylabel='numOfMovies',
rot=-90))
ax.xaxis.set_major_locator(ticker.MultipleLocator(2))
ax.yaxis.set_major_locator(ticker.MultipleLocator(500))
plt.tight_layout()
plt.show()
```
Output:
[](https://i.stack.imgur.com/AqSzH.png)
| null | CC BY-SA 4.0 | null | 2023-02-09T20:02:03.937 | 2023-02-09T21:00:34.190 | 2023-02-09T21:00:34.190 | 15,239,951 | 15,239,951 | null |
75,403,977 | 2 | null | 75,403,704 | 0 | null | As [Paulw11](https://stackoverflow.com/users/3418066/paulw11) mentioned in his comment, the problem was that I was constantly setting `showingZonePickerView` on `true` when the sheet was dismissed and the view reappeared.
| null | CC BY-SA 4.0 | null | 2023-02-09T20:15:47.753 | 2023-02-09T20:15:47.753 | null | null | 21,182,618 | null |
75,404,172 | 2 | null | 75,404,126 | 0 | null | Do you have a Program.cs file within your Asp Net app? That is typically where .NET looks to find everything to start running.
| null | CC BY-SA 4.0 | null | 2023-02-09T20:36:22.793 | 2023-02-09T20:36:22.793 | null | null | 13,287,181 | null |
75,404,205 | 2 | null | 74,997,071 | 0 | null | After compiling the files into files, wherever you have syntax, Node.js looks for `.js` files to resolve them. So it needs to be explicitly given a module name with `.js` extension in .
You may need to read [this doc](https://nodejs.org/api/esm.html#esm_import_specifiers) on how the mechanism works in Node.js.
To fix this issue, you have multiple choices():
1. change moduleResolution to nodeNext and add .js extension whenever you would importing modules in typescript:
```
import { EventBus } from "./modules/eventbus/eventbus.js";
import { EventHandler } from "./modules/eventbus/eventhandler.js";
import { EventType } from "./modules/eventbus/eventtype.js";
...
```
You don't need to be worried about it, typescript is well smart. Based on [this comment](https://github.com/microsoft/TypeScript/issues/16577#issuecomment-754941937) from one of typescript contributor:
> .js file extensions are now allowed
---
1. Using rollup package. The rollup package won't manipulate your files. Instead, it bundles your output files.
| null | CC BY-SA 4.0 | null | 2023-02-09T20:39:38.100 | 2023-02-14T07:15:35.487 | 2023-02-14T07:15:35.487 | 10,313,815 | 10,313,815 | null |
75,404,553 | 2 | null | 75,403,111 | 0 | null | It sounds like the AWS CLI is trying to use an that is not in the path.
Put simply, AWS CLI sends its output via a utility that lets you 'page' through the results. In your case, it is trying to use the [more](https://linuxhint.com/linux-more-command-with-examples/) command.
You can tell the AWS CLI to use a paginator by putting this in the `.aws/config` file:
```
[default]
cli_pager=
```
For more details, see: [Using AWS CLI pagination options - Client-side pager - AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html#cli-usage-pagination-clientside)
| null | CC BY-SA 4.0 | null | 2023-02-09T21:24:10.107 | 2023-02-09T21:24:10.107 | null | null | 174,777 | null |
75,404,755 | 2 | null | 75,404,717 | 0 | null | You might correct the encoding of the radical symbol in this line
`print(coefficient, u"\u221A".encode('utf-8'), radicand, sep='')` as follows.
```
import math
square = []
perfect_squares = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225]
num = int(input("Enter a number: "))
for i in perfect_squares:
if num % i == 0:
square.append(i)
coefficient = max(square)
radicand = num // coefficient
coefficient = int(math.sqrt(coefficient))
if num in perfect_squares:
print(int(math.sqrt(num)))
else:
print(coefficient, "\u221A", radicand, sep='')
```
| null | CC BY-SA 4.0 | null | 2023-02-09T21:47:40.017 | 2023-02-09T21:47:40.017 | null | null | 3,943,170 | null |
75,404,895 | 2 | null | 31,132,413 | 0 | null | I ran into this error when I was running one of the [Graph Samples](https://developer.microsoft.com/en-us/graph/gallery/?filterBy=Samples,SDKs&search=) from MS, but in appsettings.json I had updated the tenantId and accidentally left the authTenant as "common" creating a mismatch in where I was trying to authenticate.
| null | CC BY-SA 4.0 | null | 2023-02-09T22:02:24.683 | 2023-02-09T22:02:24.683 | null | null | 3,417,242 | null |
75,405,232 | 2 | null | 75,401,552 | 0 | null | First of all, I think your first tag is wrong. You are talking about , right?
I am not sure to fully understand your question, but if you want to get the code behind a chart, you have to make sure that developers you work with do not use the API.
has two renderers: `canvas` and `svg`. See [Canvas vs. SVG - Best Practices - Handbook - Apache ECharts](https://apache.github.io/echarts-handbook/en/best-practices/canvas-vs-svg/#). If you want to use the , charts should be [initialized](https://echarts.apache.org/en/api.html#echarts.init) like this:
```
let myChart = echarts.init(document.getElementById('main'), null, { renderer: 'svg' });
```
Now, to export your chart to SVG, you can:
- [toolbox.feature.saveAsImage.type](https://echarts.apache.org/en/option.html#toolbox.feature.saveAsImage.type)-
Here is an example ([JSFiddle](https://jsfiddle.net/Badacadabra/gvtz0745/)):
```
let option = {
toolbox: {
feature: {
saveAsImage: {
type: 'svg' // <--- HERE
}
}
},
xAxis: {
type: 'category',
data: ['A', 'B', 'C']
},
yAxis: {
type: 'value'
},
series: [
{
data: [10, 20, 15],
type: 'bar'
}
]
};
let myChart = echarts.init(document.getElementById('main'), null, { renderer: 'svg' });
myChart.setOption(option);
```
```
#main {
width: 350px;
height: 350px;
}
```
```
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<div id="main"></div>
```
| null | CC BY-SA 4.0 | null | 2023-02-09T22:46:46.927 | 2023-02-09T22:46:46.927 | null | null | 6,910,253 | null |
75,405,383 | 2 | null | 75,398,272 | 0 | null | I'd look at disabling VS Code's automatic type acquisition feature for your workspace (or for your user). To disable for your workspace, edit your workspace's `.vscode/settings.json`. To disable for your user, edit your user settings.json (use the `Preferences: Open User Settings (JSON)` command in the command palette).
The specific setting value is:
```
"typescript.disableAutomaticTypeAcquisition": true,
```
That setting's description says:
> Disables [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.
That link it links to says this:
> IntelliSense for JavaScript libraries and frameworks is powered by TypeScript type declaration (typings) files. Type declaration files are written in TypeScript so they can express the data types of parameters and functions, allowing VS Code to provide a rich IntelliSense experience in a performant manner.Many popular libraries ship with typings files so you get IntelliSense for them automatically. For libraries that do not include typings, VS Code's `Automatic Type Acquisition` will automatically install community maintained typings file for you.Automatic type acquisition requires [npmjs](https://www.npmjs.com/), the Node.js package manager, which is included with the Node.js runtime.
`core-js` is one such package that does not come with its own type declaration files (at least- at the time of this writing). You can tell by the blue-outlined icon on [its npm page](https://www.npmjs.com/package/core-js) that has the letters "DT" in it, which stands for "Definitely Types", which is the name of the TypeScript community project that maintains type definition files for JavaScript libraries and other projects that do not provide their own.
If you still want type declarations for IntelliSense for specific package dependencies you use, just explicitly specify the `@types/<package-name>` dependencies in your `devDependencies` field in your package.json file for those specific package dependencies.
| null | CC BY-SA 4.0 | null | 2023-02-09T23:06:33.830 | 2023-02-09T23:16:06.967 | 2023-02-09T23:16:06.967 | 11,107,541 | 11,107,541 | null |
75,405,678 | 2 | null | 47,396,374 | 0 | null | The attribute ([https://graphviz.org/docs/attrs/TBbalance/](https://graphviz.org/docs/attrs/TBbalance/)), (in conjunction with ) should do just what you want.
to bring the terminal nodes to the bottom, and to bring all ancestors to the maximal possible rank.
FYI, has only been available for a year or so.
| null | CC BY-SA 4.0 | null | 2023-02-09T23:58:32.453 | 2023-02-09T23:58:32.453 | null | null | 12,317,235 | null |
75,405,693 | 2 | null | 75,399,943 | 0 | null | One solution is getting the data for all the variables based on the `time`, and sorted by `value`:
```
const thisData = dataReady.map(e => ({
name: e.name,
value: e.values.find(f => f.time === d.time).value
})).sort((a, b) => b.value - a.value);
```
Then, you generate a string which you pass to the `html()` method:
```
dataString = thisData.map(e => `${e.name}: ${e.value}`).join("<br>");
tooltip.html(dataString)
```
Also, it's a better idea doing this on `mouseover` instead of `mousemove`.
Here's your code with those changes:
```
// set the dimensions and margins of the graph
const margin = {
top: 10,
right: 100,
bottom: 30,
left: 30
},
width = 750 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
// append the svg object to the body of the page
const svg = d3
.select(".container")
.append("svg")
.attr("viewBox", `0 0 750 500`)
//.attr("width", width + margin.left + margin.right)
//.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", `translate(${margin.left},${margin.top})`);
//Read the data
d3.csv(
"https://raw.githubusercontent.com/VladGirboan/Point2/main/Test.csv"
).then(function(data) {
// List of groups (here I have one group per column)
const allGroup = ["valueA", "valueB", "valueC", "valueD", "valueE"];
// Reformat the data: we need an array of arrays of {x, y} tuples
const dataReady = allGroup.map(function(grpName) {
// .map allows to do something for each element of the list
return {
name: grpName,
values: data.map(function(d) {
return {
time: d.time,
value: +d[grpName]
};
})
};
});
// I strongly advise to have a look to dataReady with
// console.log(dataReady)
// A color scale: one color for each group
const myColor = d3
.scaleOrdinal()
.domain(["1", "2", "3", "4", "5"])
.range(["#F98600", "#00BA34", "#0085FF", "#8367C7", "#FDB137"]);
// Add X axis --> it is a date format
const x = d3.scaleLinear().domain([2019, 2022]).range([50, width]);
svg
.append("g")
.attr("transform", `translate(0, ${height})`)
.call(d3.axisBottom(x).ticks(4, "").tickPadding(5))
.attr("font-family", "Montserrat")
.attr("color", "#969696");
d3.select("x.axis .tick:first-child").remove();
// Add Y axis
const y = d3.scaleLinear().domain([0, 20]).range([height, 0]);
svg
.append("g")
.call(d3.axisLeft(y))
.attr("font-family", "Montserrat")
.attr("color", "#969696");
// Add the lines
const line = d3
.line()
.x((d) => x(+d.time))
.y((d) => y(+d.value));
svg
.selectAll("myLines")
.data(dataReady)
.join("path")
.attr("d", (d) => line(d.values))
.attr("stroke", (d) => myColor(d.name))
.style("stroke-width", 2)
.style("fill", "none");
// create a tooltip
const tooltip = d3
.select(".container")
.append("div")
.style("position", "absolute")
.style("opacity", 0)
.attr("class", "tooltip")
.style("background-color", "#fafafa");
// Three function that change the tooltip when user hover / move / leave a cell
const mouseover = function(event, d) {
tooltip.style("opacity", 1);
const thisData = dataReady.map(e => ({
name: e.name,
value: e.values.find(f => f.time === d.time).value
})).sort((a, b) => b.value - a.value),
dataString = thisData.map(e => `${e.name}: ${e.value}`).join("<br>");
tooltip.html(dataString)
.style("left", `${event.layerX + 10}px`)
.style("top", `${event.layerY}px`);
};
const mouseleave = function(event, d) {
tooltip.style("opacity", 0);
};
// Add the points
svg
// First we need to enter in a group
.selectAll("myDots")
.data(dataReady)
.join("g")
.style("fill", (d) => myColor(d.name))
// Second we need to enter in the 'values' part of this group
.selectAll("myPoints")
.data((d) => d.values)
.join("circle")
.attr("cx", (d) => x(d.time))
.attr("cy", (d) => y(d.value))
.attr("r", 6)
.attr("stroke", "white")
.style("stroke-width", 0)
.on("mouseover", mouseover)
.on("mouseleave", mouseleave);
// Add a legend at the end of each line
svg
.selectAll("myLabels")
.data(dataReady)
.join("g")
.append("text")
.datum((d) => {
return {
name: d.name,
value: d.values[d.values.length - 1]
};
}) // keep only the last value of each time series
.attr(
"transform",
(d) => `translate(${x(d.value.time)},${y(d.value.value)})`
) // Put the text at the position of the last point
.attr("x", 12) // shift the text a bit more right
.text((d) => d.name)
.style("font-family", "Montserrat")
.style("fill", (d) => myColor(d.name))
.style("font-size", "16");
});
```
```
text {
font-family: "Montserrat";
font-size: 12px;
}
.container {
height: 100%;
display: flex;
align-items: center;
max-width: 750px;
}
.tooltip {
font-family: "Montserrat";
font-size: 12px;
position: absolute;
background-color: #fafafa;
padding: 10px 20px 10px 20px;
border-radius: 5px;
box-shadow: 2px 2px 5px #bbbbbb;
}
```
```
<script src="https://d3js.org/d3.v6.min.js"></script>
<div class="container"></div>
```
PS: I'm not sure if you're asking about grouping the values (what I did) or about making the tooltip showing up when you hover over any empty part of the chart.
| null | CC BY-SA 4.0 | null | 2023-02-10T00:02:48.960 | 2023-02-10T00:02:48.960 | null | null | 5,768,908 | null |
75,405,755 | 2 | null | 60,516,768 | 0 | null | Person Fields are getting parsed with different names from items
Ex: UserName gets changed to UserNameId and UserNameString
That is the reason for 'KeyError' since the items list is not having the item
Use Below code to get the person field values
```
#Python Code
from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.client_context import ClientContext
site_url = "enter sharepoint url"
sp_list = "eneter list name"
ctx = ClientContext(site_url).with_credentials(UserCredential("username","password"))
tasks_list = ctx.web.lists.get_by_title(sp_list)
items = tasks_list.items.get().select(["*", "UserName/Id", "UserName/Title"]).expand(["UserName"]).execute_query()
for item in items: # type:ListItem
print("{0}".format(item.properties.get('UserName').get("Title")))
```
| null | CC BY-SA 4.0 | null | 2023-02-10T00:15:22.820 | 2023-02-10T00:15:22.820 | null | null | 6,928,369 | null |
75,406,114 | 2 | null | 75,391,803 | 0 | null | For those interested:
I had amCharts5 set set up for transpiling in the NuxtConfig file. Removing it resolved the error.
| null | CC BY-SA 4.0 | null | 2023-02-10T01:23:19.110 | 2023-02-10T01:23:19.110 | null | null | 8,443,063 | null |
75,406,101 | 2 | null | 75,406,003 | 0 | null | In your chart options `dataLabels` use the `formatter` to define the display value, e.g.
```
dataLabels: {
formatter: function(val) {
return val.toFixed(2);
}
}
```
Full example with demo chart taken from official docs and added custom label:
```
var options = {
series: [{
name: 'Marine Sprite',
data: [44, 55, 41, 37, 22, 43, 21]
}, {
name: 'Striking Calf',
data: [53, 32, 33, 52, 13, 43, 32]
}, {
name: 'Tank Picture',
data: [12, 17, 11, 9, 15, 11, 20]
}, {
name: 'Bucket Slope',
data: [9, 7, 5, 8, 6, 9, 4]
}, {
name: 'Reborn Kid',
data: [25, 12, 19, 32, 25, 24, 10]
}],
chart: {
type: 'bar',
height: 350,
stacked: true,
stackType: '100%'
},
plotOptions: {
bar: {
horizontal: true,
},
},
stroke: {
width: 1,
colors: ['#fff']
},
title: {
text: '100% Stacked Bar'
},
xaxis: {
categories: [2008, 2009, 2010, 2011, 2012, 2013, 2014],
},
dataLabels: {
formatter: function(val) {
return val.toFixed(2);
}
},
tooltip: {
y: {
formatter: function(val) {
return val + "K"
}
}
},
fill: {
opacity: 1
},
legend: {
position: 'top',
horizontalAlign: 'left',
offsetX: 40
}
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
```
```
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<div id="chart"></div>
```
| null | CC BY-SA 4.0 | null | 2023-02-10T01:20:38.170 | 2023-02-10T01:20:38.170 | null | null | 1,494,989 | null |
75,406,266 | 2 | null | 13,073,045 | 0 | null | You can pass `bbox_inches='tight'` to the `savefig`
```
plt.savefig("image.png", bbox_inches='tight')
```
It will do the magic.
| null | CC BY-SA 4.0 | null | 2023-02-10T02:01:12.020 | 2023-02-10T02:01:12.020 | null | null | 19,959,700 | null |
75,406,281 | 2 | null | 75,404,891 | 0 | null | In the frontend of `React` you cannot update the `.json` file directly. You can import (or fetch) the .json, store it on state, and manipulate the state - however the original .json file will remain in-tact.
If you want to be able to update the .json file, I would ask "why not use a simple datastore?" Look into Firebase / Firestore - very easy and fun to use - the entire store is JSON based and can be manipulated from your React frontend.
Otherwise you are looking into more complicated solutions which involved:
- - `fs``.json`- `.json`
These 3 steps are much much more difficult than just using an actual database / datastore. MySQL, Postgres, Firestore are all options.
| null | CC BY-SA 4.0 | null | 2023-02-10T02:06:09.493 | 2023-02-10T02:06:09.493 | null | null | 904,956 | null |
75,406,294 | 2 | null | 75,404,891 | -1 | null | You can try [this package](https://www.npmjs.com/package/json-server) which you will be able to send HTTP requests to the endpoint and update `data.json`
| null | CC BY-SA 4.0 | null | 2023-02-10T02:09:42.877 | 2023-02-10T02:09:42.877 | null | null | 14,953,535 | null |
75,406,395 | 2 | null | 3,962,558 | 0 | null | I found this methode to get the end of the scroll :
```
let TheBody = document.getElementsByTagName("body"); // I choose the "body" element for my exemple
function OnScrolling(){ // put this on a scrolling EVENT
let ScrollEnd = TheBody[0].scrollHeight - window.innerHeight; // this is the scroll end Pixel
if (ScrollEnd.toFixed() == window.scrollY.toFixed()){
//do stuff
}
}
```
| null | CC BY-SA 4.0 | null | 2023-02-10T02:30:24.017 | 2023-02-10T03:28:27.910 | 2023-02-10T03:28:27.910 | 21,184,250 | 21,184,250 | null |
75,406,399 | 2 | null | 62,300,954 | 0 | null | Hope this can still helpful.
```
AlignedCollectionViewFlowLayout(horizontalAlignment: .justified,
verticalAlignment: .top)
```
| null | CC BY-SA 4.0 | null | 2023-02-10T02:32:13.560 | 2023-02-10T02:32:13.560 | null | null | 1,432,236 | null |
75,406,414 | 2 | null | 75,405,899 | -1 | null | Please have a look at the `withColumn()` function. Can be used in conjunction with `lit()`
[https://spark.apache.org/docs/3.1.3/api/python/reference/api/pyspark.sql.DataFrame.withColumn.html](https://spark.apache.org/docs/3.1.3/api/python/reference/api/pyspark.sql.DataFrame.withColumn.html)
A new column can be added to an existing dataframe using this option.
Sample Example:
```
df.withColumn("Country", lit("USA")).show()
df.withColumn("Country", lit("USA")) \
.withColumn("anotherColumn",lit("anotherValue")) \
.show()
```
Example Source: Google led to [https://azurelib.com/withcolumn-usage-in-databricks-with-examples/](https://azurelib.com/withcolumn-usage-in-databricks-with-examples/)
Hope it helps...
| null | CC BY-SA 4.0 | null | 2023-02-10T02:36:15.560 | 2023-02-10T02:36:15.560 | null | null | 13,280,838 | null |
75,406,425 | 2 | null | 75,399,430 | 0 | null | Fixed the issue by changing the CORS initialization in server.js
```
const app = express();
app.use(cors({
origin: "https://slug-panel.onrender.com"
}
))
app.options('*', cors())
```
| null | CC BY-SA 4.0 | null | 2023-02-10T02:38:53.873 | 2023-02-10T02:38:53.873 | null | null | 9,672,623 | null |
75,406,682 | 2 | null | 75,350,132 | 0 | null | I am dumb. The issue wasn't with the code in my individual recycler view layout code. It was with my activity_main.xml. I set the recycler_view width to "wrap_content" when it should have been "match_parent." Rookie mistake.
| null | CC BY-SA 4.0 | null | 2023-02-10T03:35:40.720 | 2023-02-10T03:35:40.720 | null | null | 21,149,706 | null |
75,406,738 | 2 | null | 62,406,060 | 0 | null | You might have to uninstall your package using pip in case you are already having one, only then will the custom built opencv be accessible to the program.
```
pip3 uninstall opencv-python
```
| null | CC BY-SA 4.0 | null | 2023-02-10T03:46:57.900 | 2023-02-10T03:46:57.900 | null | null | 20,539,513 | null |
75,406,841 | 2 | null | 75,406,522 | 2 | null | The `array-contains` operator can only check for exact matches between items in the array and the value you pass. So in code:
```
.where("Meals", "array-contains", { ID: posilekId, Portions: 12.5 })
```
There is no way to do a partial match.
The common workaround is to add an additional field (e.g. `MealIDs`) that contains just the value you want to filter on:
```
MealIDs: ["ohN....", "..."]
```
With that additional array, you can then filter with:
```
.where("MealIDs", "array-contains", posilekId)
```
| null | CC BY-SA 4.0 | null | 2023-02-10T04:07:11.097 | 2023-02-10T04:07:11.097 | null | null | 209,103 | null |
75,406,969 | 2 | null | 5,213,753 | 0 | null | I tweeked @Patrick Atoon answer and created a razor component to display a current status bar from an Enum. This worked really well.
Razor component page - CaseStatus.razor:
```
<p>Case Status Tracker</p>
<ol class="casestatus">
@foreach (var s in statusBars)
{
<li class="@s.State">
<span class="name">@s.Name</span>
<span class="step"><span class="count"></span></span>
</li>
}
</ol>
<hr />
@code {
//Enum Status Names
private string[] status;
//Current Status - best if parameter
private Status currentStatus;
//List of Names and progress states - done, active, (empty)
private List<statusBar> statusBars { get; set; }
protected override async Task OnInitializedAsync()
{
//Test current status (progress)
currentStatus = Status.Engineering;
statusBars = new List<statusBar>();
status = Enum.GetNames(typeof(Status));
var statusval = Enum.GetValues(typeof(Status)).Cast<int>().ToList();
for(int i=0; i < status.Length; i++){
var value = statusval[i];
string state = "done";
if (((int)currentStatus) == value)
{
state = "active";
} else {
if (((int)currentStatus) < value)
{
state = "";
}
}
statusBars.Add(new statusBar()
{
Name = status[i],
State = state
});
}
}
public class statusBar
{
public string Name { get; set; }
public string State { get; set; }
}
public enum Status
{
Request = 0,
Submitted = 1,
Engineering = 2,
InApproval = 3,
Approved = 4,
Production = 5,
Complete = 6
}
}
```
CaseStatus.razor.css:
```
/* casestatus Tracker v2.1 */
.casestatus {
counter-reset: li;
display: flex;
flex-wrap: nowrap;
justify-content: space-evenly;
width: 100%;
list-style: none;
list-style-image: none;
margin: 20px 0 20px 0;
padding: 0;
}
.casestatus li {
flex-grow: 1;
text-align: center;
position: relative;
}
.casestatus .name {
display: block;
margin-bottom: 1em;
color: white;
opacity: 0.3;
}
.casestatus .step {
color: black;
border: 3px solid silver;
background-color: silver;
border-radius: 50%;
line-height: 2;
width: 2em;
height: 2em;
display: inline-block;
}
.casestatus .step span.count:before {
opacity: 0.3;
content: counter(li);
counter-increment: li
}
.casestatus .active .name,
.casestatus .active .step span {
opacity: 1;
}
.casestatus .step:before {
content: "";
display: block;
background-color: silver;
height: 0.4em;
width: 50%;
position: absolute;
bottom: 0.8em;
left: -0.76em;
}
.casestatus .step:after {
content: "";
display: block;
background-color: silver;
height: 0.4em;
width: 50%;
position: absolute;
bottom: 0.8em;
right: -0.76em;
}
.casestatus li:first-of-type .step:before {
display: none;
}
.casestatus li:last-of-type .step:after {
display: none;
}
.casestatus .done .step,
.casestatus .done .step:before,
.casestatus .done .step:after,
.casestatus .active .step,
.casestatus .done + .active .step:before {
background-color: yellowgreen;
}
.casestatus .done .step,
.casestatus .active .step {
border: 3px solid yellowgreen;
}
```
[](https://i.stack.imgur.com/BE7lM.png)
| null | CC BY-SA 4.0 | null | 2023-02-10T04:32:13.717 | 2023-02-10T04:37:54.160 | 2023-02-10T04:37:54.160 | 2,969,955 | 2,969,955 | null |
75,406,980 | 2 | null | 75,406,869 | 1 | null | The pipe passes its left hand side to the first unnamed argument of the right hand side. So `aes(x = displ) |> ggplot(mpg)` is equivalent to `ggplot(aes(x = displ), mpg)`, which in turn is equivalent to `ggplot(data = aes(x = displ), mapping = mpg)` since that’s the order of `ggplot()`’s arguments.
If you want to get around this, you can explicitly pass `mpg` to the `data` arg:
```
aes(x = displ) |>
ggplot(data = mpg)
```
or explicitly pass your `aes()` call to `mapping` using the pipe placeholder (`_`):
```
aes(x = displ) |>
ggplot(mpg, mapping = _)
```
| null | CC BY-SA 4.0 | null | 2023-02-10T04:34:27.250 | 2023-02-10T04:34:27.250 | null | null | 17,303,805 | null |
75,407,083 | 2 | null | 75,394,081 | 0 | null | If you are using the webview_flutter plugin, you can use the initialScale parameter to set the initial zoom level for the web view.
This will automatically zoom the website to 150% of its original size when it loads in the web view. You can adjust the initialScale value as per your need .
If you want to display only part of the website, you can use the javascriptMode parameter to disable JavaScript in the web view and the userAgent parameter to specify a custom user agent string. This will prevent the website from running any scripts or expanding to fill the full screen.
WebView(
initialScale: 150,
initialUrl: "https://www.example.com",
javascriptMode: JavascriptMode.unrestricted,
userAgent: "The Part you want to restrict",
)
| null | CC BY-SA 4.0 | null | 2023-02-10T04:50:44.640 | 2023-02-10T04:50:44.640 | null | null | 19,145,143 | null |
75,407,283 | 2 | null | 75,273,190 | 0 | null | You can add css to grid cells common class
text-overflow: ellipsis;
| null | CC BY-SA 4.0 | null | 2023-02-10T05:27:37.220 | 2023-02-10T05:27:37.220 | null | null | 10,518,744 | null |
75,407,647 | 2 | null | 75,395,944 | 0 | null | You may use `.NET 6`/`.NET 7`. From .NET 6 the , otherwise the ModelState will be invalid.
To achieve your requirement, is you can remove `<Nullable>enable</Nullable>` from your project file(double-click the project name or right-click the project to choose Edit Project File).
, you can add `?` to allow nullable:
```
public class User
{
public int Id { get; set; }
//other properties....
public string? Email{ get; set; } //change here...
}
```
| null | CC BY-SA 4.0 | null | 2023-02-10T06:33:11.630 | 2023-02-10T06:33:11.630 | null | null | 11,398,810 | null |
75,407,658 | 2 | null | 75,404,126 | 0 | null | > I enabled IIS in 'Turn Windows features on or off'
Here you installed IIS, not IIS express. IIS Express is equivalent to a stripped-down version of IIS, which has almost all the functions of IIS, but it has no visual management interface, and all management operations are performed by modifying configuration files.
Download IIS Express from this [link](https://www.microsoft.com/en-us/download/details.aspx?id=48264) and install on the developer PC.
After installation, the IIS Express configuration files will be available in and the IIS Express executable files will be available in the installation directory. For example: C:\Program Files\IIS Express; Set the environment variable path to "C:\Program Files\IIS Express". (Open advanced system settings -> Environment variables -> System Variables -> Path -> Edit ->New -> add the path C:\Program Files\IIS Express). About Using IIS Express, please refer this [link](https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-from-the-command-line).
> The specified module could not be found.
For more information about the error, run iisexpress.exe with the tracing switch enabled (/trace:error).
Check if there is an IISExpress\config folder in your home folder. This is a common mistake when configuration files/folders are missing. If the directory does not exist, you will need to create the directory; or the directory may already exist and is just corrupted, you will need to delete the config directory and re-run `C:\Program Files (x86)\IIS Express>iisexpress.exe/trace:error`
| null | CC BY-SA 4.0 | null | 2023-02-10T06:34:48.850 | 2023-02-10T06:34:48.850 | null | null | 19,696,445 | null |
75,407,697 | 2 | null | 75,407,271 | 0 | null | I assume you're using `reactjs` and know `useRef`. You can use `useRef` to reference those two submit buttons from different forms. First you need to create a variable
```
const buttonRef = useRef()
```
Now you have to add `ref={buttonRef}` to both of those button tags as an attribute. Lastly, you have to add a function that triggers those button clicks. You can add `onClick` attribute to Create button. You can add this to Create button `onClick={() => buttonRef.currentRef.click()}`.
These steps will let you submit two form. But won't merge two form data into one.
| null | CC BY-SA 4.0 | null | 2023-02-10T06:40:34.493 | 2023-02-10T06:40:34.493 | null | null | 21,127,477 | null |
75,407,706 | 2 | null | 75,407,415 | 0 | null | Try autoscalling based in y ticks. Here I'm adding some logic that just rescales the y-axis based on the data that is in the visible x-region. As I don't have your data I took random data.
```
import numpy as np
import random
ntermsList = np.random.randint(low=0, high=10, size=(555,))
allPmuCycleCountAverages = np.random.randint(low=0, high=10, size=(555,))
allPmuCycleCountStandardDeviations = np.random.randint(low=0, high=10, size=(555,))
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# if using a Jupyter notebook, include:
%matplotlib inline
x = ntermsList
y = allPmuCycleCountAverages
xerr = 0
yerr = allPmuCycleCountStandardDeviations
fig, ax = plt.subplots()
ax.errorbar(x, y, xerr=xerr, yerr=yerr,fmt='-o')
ax.set_xlabel('x-axis')
ax.set_ylabel('y-axis')
ax.set_title('Line plot with error bars')
ax.set_xticks(ntermsList)
ax.set_xticklabels(ntermsList)
ax.set_yticks(allPmuCycleCountAverages)
#plt.setp(ax.get_yticklabels(), rotation=90, horizontalalignment='right')
ax.yaxis.grid(True)
margin =0.1
def get_bottom_top(line):
xd = line.get_xdata()
yd = line.get_ydata()
lo,hi = ax.get_xlim()
y_displayed = yd[((xd>lo) & (xd<hi))]
h = np.max(y_displayed) - np.min(y_displayed)
bot = np.min(y_displayed)-margin*h
top = np.max(y_displayed)+margin*h
return bot,top
lines = ax.get_lines()
bot,top = np.inf, -np.inf
for line in lines:
new_bot, new_top = get_bottom_top(line)
if new_bot < bot: bot = new_bot
if new_top > top: top = new_top
ax.set_ylim(bot,top)
plt.show()
```
Before Rescalling
[](https://i.stack.imgur.com/AuXqB.png)
After rescalling
[](https://i.stack.imgur.com/prJ0F.png)
| null | CC BY-SA 4.0 | null | 2023-02-10T06:42:06.723 | 2023-02-10T06:42:06.723 | null | null | 15,358,800 | null |
75,407,749 | 2 | null | 75,395,988 | 0 | null | Your difficulty here is how this label should be implemented. It is recommended that you use custom tags.
Let's split the control first. The whole control can be regarded as a selected label interface.
There are many small tabs in the selected tab interface, which are composed of one by one.
1. The label control can inherit UserControl and then add a label control to the UserControl interface to simulate the close button. public partial class TagControl : BaseRadiusUserControl
2. Then write a defined close event [Description("Close Event "), Category("Customize ")]
public event EventHandler CloseClick;
3. Click X on the label control to trigger the close event private void close_Click(object sender, EventArgs e)
{
CloseClick?.Invoke(this,e);
}
4. Then write an assignment method to adjust the size of the control when the text value is greater than 2. public void SetText(string text)
{
this.Content = text;
if (text.Length > 1)
{
this.Width = 60 + (text.Length - 1) * 20;
}
}
In this way, the small label control is realized!
| null | CC BY-SA 4.0 | null | 2023-02-10T06:47:23.667 | 2023-02-10T06:47:23.667 | null | null | 20,528,460 | null |
75,408,184 | 2 | null | 8,098,130 | -1 | null | class ViewController: UIViewController {
```
override func viewDidLoad() {
super.viewDidLoad()
//Original image displayed as is
let imageView = UIImageView()
imageView.frame = CGRect(x: 50, y: 50, width: 200, height: 200)
imageView.contentMode = .scaleAspectFit
view.addSubview(imageView)
let myImageName = "image.png"
let myImage = UIImage(named: myImageName)
imageView.image = myImage
//Let's change the image to Gradient Color
let imageView2 = UIImageView()
imageView2.frame = CGRect(x: 300, y: 50, width: 200, height: 200)
imageView2.contentMode = .scaleAspectFit
view.addSubview(imageView2)
let myImageName2 = "apple_logo.png"
let myImage2 = UIImage(named: myImageName2)
imageView2.image = myImage2!.maskWithGradientColor(color: UIColor.red)
}
```
}
extension UIImage {
func maskWithGradientColor(color: UIColor) -> UIImage? {
```
let maskImage = self.cgImage
let width = self.size.width
let height = self.size.height
let bounds = CGRect(x: 0, y: 0, width: width, height: height)
let colorSpace = CGColorSpaceCreateDeviceRGB()
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
let bitmapContext = CGContext(data: nil,
width: Int(width),
height: Int(height),
bitsPerComponent: 8,
bytesPerRow: 0,
space: colorSpace,
bitmapInfo: bitmapInfo.rawValue)
let locations:[CGFloat] = [0.0, 1.0]
let bottom = UIColor(red: 1, green: 0, blue: 0, alpha: 1).cgColor
let top = UIColor(red: 0, green: 1, blue: 0, alpha: 0).cgColor
let colors = [top, bottom] as CFArray
let gradient = CGGradient(colorsSpace: colorSpace, colors: colors, locations: locations)
let startPoint = CGPoint(x: width/2, y: 0)
let endPoint = CGPoint(x: width/2, y: height)
bitmapContext!.clip(to: bounds, mask: maskImage!)
bitmapContext!.drawLinearGradient(gradient!, start: startPoint, end: endPoint, options: CGGradientDrawingOptions(rawValue: UInt32(0)))
if let cImage = bitmapContext!.makeImage() {
let coloredImage = UIImage(cgImage: cImage)
return coloredImage
}
else {
return nil
}
}
```
}
| null | CC BY-SA 4.0 | null | 2023-02-10T07:41:51.847 | 2023-02-16T12:34:01.563 | 2023-02-16T12:34:01.563 | 21,185,512 | 21,185,512 | null |
75,408,335 | 2 | null | 75,356,488 | 0 | null | I found the solution for my problems. it solved by using vpn.
the problem was my wifi provider probably blocking the request on vs code, seems like there's something fishy about the DNS policy. Hope this can help too
| null | CC BY-SA 4.0 | null | 2023-02-10T08:01:01.253 | 2023-02-10T08:06:59.243 | 2023-02-10T08:06:59.243 | 21,154,324 | 21,154,324 | null |
75,408,344 | 2 | null | 75,398,409 | 0 | null | You can install.NET Core Hosting Bundle using the following link:
[Thanks for downloading ASP.NET Core 7.0 Runtime (v7.0.2) - Windows Hosting Bundle Installer!](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-7.0.2-windows-hosting-bundle-installer)
More information you can refer to this link: [The .NET Core Hosting Bundle](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/hosting-bundle?view=aspnetcore-7.0).
| null | CC BY-SA 4.0 | null | 2023-02-10T08:01:21.120 | 2023-02-10T08:01:21.120 | null | null | 13,336,642 | null |
75,408,796 | 2 | null | 73,768,477 | 0 | null | Upgrade streamlit:
```
pip install streamlit --upgrade
```
if still not
1. open powershell.exe
2. copas Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
3. then run
back to IDE
- go to setting- search "terminal windows exec" (vscode)- if pycharm search "terminal" > tools > terminal > shell path- change`C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe`
it's work for me
| null | CC BY-SA 4.0 | null | 2023-02-10T08:51:16.867 | 2023-02-10T08:57:53.797 | 2023-02-10T08:57:53.797 | 21,185,730 | 21,185,730 | null |
75,408,920 | 2 | null | 75,408,805 | 0 | null | I think you can get the time when the sound start by just using:
```
idx_start = np.where(combinedSignal > 1)[0][0]
```
This will return the first index where the magnitude of your signal is greater than 1.
| null | CC BY-SA 4.0 | null | 2023-02-10T09:03:54.970 | 2023-02-10T09:03:54.970 | null | null | 13,891,969 | null |
75,408,987 | 2 | null | 75,408,944 | 0 | null | Simply area your cursor withinside the components bar in which you need to feature the smash and press the ALT+ENTER keys. Hit ENTER again, and you`ll see the textual content wrap on lines. You now have the textual content organized the manner you want it withinside the spreadsheet and withinside the graph.
| null | CC BY-SA 4.0 | null | 2023-02-10T09:11:44.270 | 2023-02-10T09:11:44.270 | null | null | 19,264,198 | null |
75,408,989 | 2 | null | 75,365,694 | 3 | null | This answer is for `plotly 4.10.1`. I have defined two functions:
1. set_legend_names() This edits the names of the htmlwidget created by ggplotly(), before it is passed to plotly.js.
2. set_legend_symbols(). This appends some js to the htmlwidget object to change the symbols after plotly.js has drawn them.
```
plt2 |>
ggplotly(height = 500) |>
layout(xaxis = list(autorange = "reversed")) |>
set_legend_names() |>
set_legend_symbols()
```
[](https://i.stack.imgur.com/tmK2g.png)
Function definitions:
### 1. set_legend_names()
```
set_legend_names <- function(p,
new_legend_names = c(
"Fast", "Slow", "One Year", "Three Month"
)) {
# Update legend names and put in one group
for (i in seq_along(p$x$data)) {
p$x$data[[i]]$name <- new_legend_names[i]
}
p$x$layout$legend$title <- ""
return(p)
}
```
## 2. set_legend_symbols()
```
set_legend_symbols <- function(p,
symbol_nums_change_color = c(3, 4),
new_color_string = "rgb(105, 105, 105)",
symbols_num_change_shape = 3,
symbols_nums_target_shape = 1) {
js_get_legend <- htmltools::HTML(
'let legend = document.querySelector(".scrollbox");
let symbols = legend.getElementsByClassName("legendsymbols");
const re = new RegExp("fill: rgb.+;", "i");\n
'
)
js_symbol_const <- paste0(
'const shape_re = new RegExp(\'d=".*?"\');\n',
"const correct_shape = symbols[",
symbols_nums_target_shape,
"].innerHTML.match(shape_re)[0];\n"
)
# subtract 1 for 0-indexed js
change_symbol_color_code <- lapply(
symbol_nums_change_color - 1,
\(i)
paste0(
"symbols[", i, "].innerHTML = ",
"symbols[", i, "].innerHTML.replace(re,",
' "fill: ', new_color_string, ';");'
)
) |>
paste(collapse = "\n")
# subtract 1 for 0-indexed js
change_symbols_shape_code <- lapply(
symbols_num_change_shape - 1,
\(i)
paste0(
"symbols[", i, "].innerHTML = symbols[",
symbols_nums_target_shape, "].innerHTML.replace(shape_re, correct_shape);"
)
) |>
paste(collapse = "\n")
all_js <- htmltools::HTML(
unlist(c(
js_get_legend,
js_symbol_const,
change_symbols_shape_code,
change_symbol_color_code
))
)
# Add it to the plot
p <- htmlwidgets::prependContent(
p,
htmlwidgets::onStaticRenderComplete(all_js)
)
return(p)
}
```
I've never posted a second answer before but it seems substantially different in `plotly 4.10.1`. I eagerly anticipate the release of `plotly 4.10.2` so I can post a third answer.
| null | CC BY-SA 4.0 | null | 2023-02-10T09:11:58.160 | 2023-02-10T09:48:41.200 | 2023-02-10T09:48:41.200 | 12,545,041 | 12,545,041 | null |
75,409,107 | 2 | null | 75,408,156 | 0 | null | Maybe change your handler like this so you ensure the value is always a string
```
const searchTextChangeHandler = event => {
const textValue = event.target.value || ""
setSearchText(textValue)
setSearchChanged(true)
}
```
| null | CC BY-SA 4.0 | null | 2023-02-10T09:24:56.500 | 2023-02-10T09:24:56.500 | null | null | 1,703,395 | null |
75,409,201 | 2 | null | 75,409,045 | 1 | null | You can do this with [Advanced Google services](https://developers.google.com/apps-script/guides/services/advanced)/[google-sheets-api](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update):
```
//@see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update
Sheets.Spreadsheets.Values.update(
{ values: array },
"SpreadsheetID",
"Sheet1!A3",
{ valueInputOption: "RAW" }
);
```
| null | CC BY-SA 4.0 | null | 2023-02-10T09:34:30.180 | 2023-02-11T04:01:33.930 | 2023-02-11T04:01:33.930 | 8,404,453 | 8,404,453 | null |
75,409,435 | 2 | null | 75,408,616 | 1 | null | `«extend»`and `«select»` are stereotypes which were given a certain meaning in the domain of that model. Usually a profile is used to define the sterotypes and their meaning. So the best is you contact the author of the diagram and ask about it. There is no general answer. It looks a bit like these are meant to be requirements.
The "black arrows" with the lozenge are associations that are given a composite aggregation attribute. The lozenge-side is responsible for the lifetime of the other side. Means it will destroy them when it is destroyed itself.
Fun note about the «class» (as per comment from [Axel Scheithauer](https://stackoverflow.com/users/9430250/axel-scheithauer) from p. 99 of UML 2.5:
> If the default notation is used for a Classifier, a keyword corresponding to the metaclass of the Classifier shall be shown in guillemets above the name. The keywords for each metaclass are listed in Annex C and are specified in the notation for each subclass of Classifier. No keyword is needed to indicate that the metaclass is Class.
So putting that keyword there is like painting "car" on a car to make it a car, obviously.
| null | CC BY-SA 4.0 | null | 2023-02-10T09:55:42.273 | 2023-02-13T09:16:21.797 | 2023-02-13T09:16:21.797 | 3,379,653 | 3,379,653 | null |
75,409,503 | 2 | null | 48,846,530 | 0 | null | When you read in your csv file, try the following for parsing dates:
```
custom_date_parser = lambda x: datetime.strptime(x, "%d/%m/%Y")
data = pd.read_csv('name.csv', date_parser=custom_date_parser, index_col=0)
```
Then plots should use the correct dates on the x-axis.
| null | CC BY-SA 4.0 | null | 2023-02-10T10:00:18.527 | 2023-02-10T10:00:18.527 | null | null | 455,655 | null |
75,409,538 | 2 | null | 75,182,743 | 0 | null | The main issue is that `FindContours` finds contours, and the image background is white.
We use `ThresholdBinaryInv` instead of `ThresholdBinary`.
`ThresholdBinaryInv` applies threshold and invert black and white after applying the threshold (the pattern is going to be white on black instead of black on white).
---
Code sample:
```
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.Util;
using System.Drawing;
namespace Testings
{
public class Program
{
static void Main(string[] args)
{
int threshold = 254;
var image_file_name = @"auxetic_lattice_screen.png";
Mat image = new Mat(image_file_name, Emgu.CV.CvEnum.ImreadModes.Color); //Read input image as BGR
var grayImage = new Image<Gray, System.Byte>(image_file_name); //Read input image as Grayscale
//grayImage = grayImage.ThresholdBinary(new Gray(threshold), new Gray(255));
grayImage = grayImage.ThresholdBinaryInv(new Gray(threshold), new Gray(255)); // Use ThresholdBinaryInv - invert black and white so that the pattern be white
VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();
CvInvoke.FindContours(grayImage, contours, null, RetrType.External, ChainApproxMethod.ChainApproxSimple);
int minWidth = grayImage.Width / 2;
int minHeight = grayImage.Height / 2;
Mat croppedImage = null;
for (int i = 0; i < contours.Size; i++)
{
Rectangle rect = CvInvoke.BoundingRectangle(contours[i]);
if (rect.Width > minWidth && rect.Height > minHeight)
{
croppedImage = new Mat(image.Clone(), rect); //Crop the rectangle
CvInvoke.DrawContours(image, contours, i, new MCvScalar(255, 0, 0), 2);
}
}
//Show images for testing
CvInvoke.Imshow("grayImage", grayImage);
CvInvoke.Imshow("image", image);
CvInvoke.WaitKey();
CvInvoke.Imwrite("output_image.png", image); //Save output for testing
CvInvoke.Imwrite("croppedImage.png", croppedImage); //Save output for testing
}
}
}
```
---
Result:
[](https://i.stack.imgur.com/PnUpV.png)
| null | CC BY-SA 4.0 | null | 2023-02-10T10:03:31.783 | 2023-02-10T10:03:31.783 | null | null | 4,926,757 | null |
75,409,583 | 2 | null | 75,388,382 | 1 | null | Finally, I found the problem. In my case, it was an expired certificate. In order to fix it, it is necessary to go to `Help -> SSL Proxying -> Reset Charles Root Certificate...`. It will generate a new one. Then it is needed to install it and grant trust to it.
I wasn't noticing it because before I was working only with Android and it didn't check if a certificate was expired, unlike iOS.
Because I wasn't been able to find any troubleshooting checklist for similar situations I will mention it here. Hopefully, it will help somebody:
1. Make sure that Enable SSL Proxying is enabled in Proxy -> SSL Proxying Settings...
2. Check that the Exclude list doesn't contain the locations that you are trying to record.
3. Check that Proxy -> Record Settings doesn't have unneeded excludes or includes
4. Check if your target device is connected to the same wifi point as a computer.
5. Check if the wifi proxy on the target device is enabled.
6. Check if the wifi proxy on the target device is working. It is possible to check by entering incorrect proxy IP and trying to access the internet through a browser. If the proxy is working there will be no access to the Internet. (Note: at the time of writing this answer some iPhones with iOS 16 do have not a working proxy. More info here)
7. Check if the proxy is configured with the correct IP and port
8. Check if the target device has Charles's certificate installed
9. Check if the target device trusts Charles's certificate
10. Check if Charles's certificate isn't expired. If it is, go to Help -> SSL Proxying -> Reset Charles Root Certificate... and reinstall the certificate.
11. (for Android) Check if the target app has network_security_config.xml referenced in AndroidManifest.xml
| null | CC BY-SA 4.0 | null | 2023-02-10T10:07:38.467 | 2023-02-10T10:08:44.100 | 2023-02-10T10:08:44.100 | 9,962,869 | 9,962,869 | null |
75,409,617 | 2 | null | 75,370,155 | 0 | null | This is indeed tricky and subtle, and the quizz wording is moreover ambiguous. However there is a difference and the quizz is right.
What you described is a normal N:M relationship with . The correct wording would be:
> An instance of data type A related to many instances of data type B and an instance of data type B related to many instances of data type A.
The key difference in your answer is that there could be some A and and some B that do not participate in the relationship. But this would be the correct answer if the diagram would have used with the relation.
But the quizz diagram uses a . This is not graphical fancyness, but expresses . This means that every A and every B must participate to the relation. In other words, there can be no A that isn’t related to at least a B, and vice-versa. This is why the correct answer is not what you expected.
However the correct answer is ambiguously worded because participating in the relation doesn’t require to necessarily be related to many entities on the other side; one is sufficient. A better wording could therefore be:
> Every instance of data type A is related to instances of data type B, and every instance of data type B is related to instances of data type A.
By the way, ERD doesn’t use “data types” but “entities”. More information on Chen’s ERD notation [here](https://vertabelo.com/blog/chen-erd-notation/).
| null | CC BY-SA 4.0 | null | 2023-02-10T10:10:24.833 | 2023-02-10T10:19:52.110 | 2023-02-10T10:19:52.110 | 3,723,423 | 3,723,423 | null |
75,409,840 | 2 | null | 75,376,913 | 0 | null | You can control how your elements respond to the drag gesture with the following:
```
.gesture(DragGesture(minimumDistance:))
```
For instance:
```
struct ContentView: View {
var body: some View {
VStack {
ScrollView {
VStack {
ForEach(1..<50) { i in
Rectangle()
.fill((i & 1 == 0) ? .blue: .yellow)
.frame(width: 300, height: 50)
.overlay {
Text("\(i)")
}
.gesture(DragGesture(minimumDistance: i & 1 == 0 ? 100 : 0))
}
}.frame(maxWidth: .infinity)
}
}
.frame(width: 300)
}
}
```
will block the scrolling for the yellow elements!
| null | CC BY-SA 4.0 | null | 2023-02-10T10:30:25.743 | 2023-02-10T10:30:25.743 | null | null | 1,463,620 | null |
75,409,965 | 2 | null | 56,516,776 | 0 | null | For me the issue was related to param `testResultsFiles` which was set to default `testResultsFiles: '**/junit*.xml'` so after adding the direct patch to my junit.xml worked fine.
```
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'apps/pfp/junit.xml'
mergeTestResults: false
failTaskOnFailedTests: true
testRunTitle: 'Publish Test Results'
displayName: 'Publish Test Results'
```
| null | CC BY-SA 4.0 | null | 2023-02-10T10:40:58.450 | 2023-02-10T10:40:58.450 | null | null | 1,596,471 | null |
75,410,246 | 2 | null | 75,410,128 | 0 | null | Try to create reusable widget or builder method to minimize the snippet/code-dublication.
```
import 'dart:math';
import 'package:flutter/material.dart';
void main(List<String> args) {
runApp(MaterialApp(
home: gradysu(),
));
}
class gradysu extends StatefulWidget {
const gradysu({super.key});
@override
State<gradysu> createState() => _gradysuState();
}
class _gradysuState extends State<gradysu> {
var _formKey = GlobalKey<FormState>();
var x, y, c, d;
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('Квадрат'),
backgroundColor: Color.fromARGB(255, 252, 252, 252),
automaticallyImplyLeading: true,
),
body: SingleChildScrollView(
child: Container(
height: 800,
width: 639,
/* decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/image/fon2.png"),
fit: BoxFit.cover,
),
),*/
child: Column(
children: [
Container(
color: Colors.brown,
child: Center(
child: const Text(
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.white),
'Расчёт площади квадрата S=:'))),
Row(children: <Widget>[
Container(
padding: const EdgeInsets.all(10.0),
child: const Text('Введите градусы:',
style: TextStyle(color: Color.fromARGB(255, 0, 0, 0))),
),
Expanded(
child: Container(
padding: const EdgeInsets.all(10.0),
child: TextFormField(
keyboardType: TextInputType.number,
validator: (value) {
if (value!.isEmpty) return 'Задайте градусы';
try {
x = double.parse(value);
} catch (h) {
x;
return h.toString();
}
},
),
),
),
]),
const SizedBox(height: 20.0),
Text(
y == null ? '' : ' $y (рад) ',
style: const TextStyle(
fontSize: 20.0, color: Color.fromARGB(255, 0, 0, 0)),
),
const SizedBox(height: 20.0),
ElevatedButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
setState(() {
if (x is double) y = ((x * pi) / 180);
});
}
},
style: ElevatedButton.styleFrom(
foregroundColor: Color.fromARGB(
255, 235, 235, 235), //change background color of button
backgroundColor: Colors.brown, //change text color of button
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
elevation: 5.0,
),
child: const Padding(
padding: EdgeInsets.all(8),
child: Text(
'Вычислить',
style: TextStyle(fontSize: 20),
),
),
),
SizedBox(height: 10.0),
/// second item , you can create a build method for this
Row(children: <Widget>[
Container(
padding: const EdgeInsets.all(10.0),
child: const Text('Введите градусы:',
style: TextStyle(color: Color.fromARGB(255, 0, 0, 0))),
),
Expanded(
child: Container(
padding: const EdgeInsets.all(10.0),
child: TextFormField(
keyboardType: TextInputType.number,
validator: (value) {
if (value!.isEmpty) return 'Задайте градусы';
try {
x = double.parse(value);
} catch (h) {
x;
return h.toString();
}
},
),
),
),
]),
const SizedBox(height: 20.0),
Text(
y == null ? '' : ' $y (рад) ',
style: const TextStyle(
fontSize: 20.0, color: Color.fromARGB(255, 0, 0, 0)),
),
const SizedBox(height: 20.0),
ElevatedButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
setState(() {
if (x is double) y = ((x * pi) / 180);
});
}
},
style: ElevatedButton.styleFrom(
foregroundColor: Color.fromARGB(
255, 235, 235, 235), //change background color of button
backgroundColor: Colors.brown, //change text color of button
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
elevation: 5.0,
),
child: const Padding(
padding: EdgeInsets.all(8),
child: Text(
'Вычислить',
style: TextStyle(fontSize: 20),
),
),
),
SizedBox(height: 10.0),
],
),
),
),
),
);
}
}
```
| null | CC BY-SA 4.0 | null | 2023-02-10T11:05:11.220 | 2023-02-10T11:05:11.220 | null | null | 10,157,127 | null |
75,410,357 | 2 | null | 75,407,827 | 0 | null | It's better after saving the image to higher resolutions.
left:
```
saves(gcf,'*.png')
```
right:
```
print(gcf,'*.png','-dpng','-r600');%*//600 dpi
```

| null | CC BY-SA 4.0 | null | 2023-02-10T11:13:39.933 | 2023-02-10T11:27:24.567 | 2023-02-10T11:27:24.567 | 5,211,833 | 21,178,636 | null |
75,410,372 | 2 | null | 75,383,662 | 0 | null | I got the same error when I tried with your code:
```
public void ConfigureServices(IServiceCollection services)
{
var initialScopes = Configuration.GetValue<string>("DownstreamApi:Scopes")?.Split(' ');
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"))
services.AddAuthentication(options => {
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie(options => {
options.LoginPath = "/Account/Login/";
})
.AddOpenIdConnect(options =>
{
options.ClientId = Configuration["oidc:clientid"];
options.ResponseType = "code";
options.GetClaimsFromUserInfoEndpoint = true;
options.Validate();
}
);
services.AddControllersWithViews(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
});
services.AddRazorPages()
.AddMicrosoftIdentityUI();
}
```
```
System.InvalidOperationException
Message=Provide Authority, MetadataAddress, Configuration, or ConfigurationManager to OpenIdConnectOptions
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.Validate()
```
[](https://i.stack.imgur.com/PZvsG.png)
The cause here is missing configuration of OpenID Connect .As the error states it misses authority, metadata address, configuration in OpenIdConnectOptions.
[](https://i.stack.imgur.com/IzEIJ.png)
To resolve this issue, provide the required information in tht OpenIdConnectOptions .
options.ClientId = Configuration["ClientId"];
options.ClientSecret = Configuration["ClientSecret"];
options.Authority = Configuration["Authority"];
options.ResponseType = OpenIdConnectResponseType.Code;
options.GetClaimsFromUserInfoEndpoint = true;
[](https://i.stack.imgur.com/mm7BO.png)
where client credentials can be fetched from :
```
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Authority": "https://login.microsoftonline.com/tenantid",
//"Domain": "testthetenant365.onmicrosoft.com",
"ClientId": "500xxxx06e",
"TenantId": "fb134080-e4d2-45f4-9562-f3a0c218f3b0",
"ClientSecret": "xxxxxx",
"CallbackPath": "/signin-oidc"
},
```
code:
```
services.AddAuthentication(options => {
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie(options => {
options.LoginPath = "/Account/Login/";
})
.AddOpenIdConnect(options =>
{
options.ClientId = Configuration["AzureAd:ClientId"];
options.ClientSecret = Configuration["AzureAd:ClientSecret"];
options.Authority = Configuration["AzureAd:Authority"];
options.MetadataAddress = "https://login.microsoftonline.com/{tenant}/.well-known/openid-configuration";
options.ResponseType = "code";
options.GetClaimsFromUserInfoEndpoint = true;
options.SaveTokens = true;
options.Validate();
}
);
```
In case of error ,it must be due to Authentication builder configuration missing
Install Microsoft.AspNetCore.Authentication.AzureAD.UI
See [c# - Strong-type OpenIdConnectOptions for aspnet core 2.0 - Stack Overflow](https://stackoverflow.com/questions/45768232/strong-type-openidconnectoptions-for-aspnet-core-2-0)
Add reference to `Microsoft.AspNetCore.Authentication.AzureAD.UI` in *.csproj
You can use below code for built-in mechanisms:
```
public void ConfigureServices(IServiceCollection services)
{
var initialScopes = Configuration.GetValue<string>("DownstreamApi:Scopes")?.Split(' ');
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi(initialScopes)
.AddMicrosoftGraph(Configuration.GetSection("DownstreamApi"))
.AddInMemoryTokenCaches();
services.AddControllersWithViews(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
});
services.AddRazorPages()
.AddMicrosoftIdentityUI();
}
```
[](https://i.stack.imgur.com/2RaD5.png)
| null | CC BY-SA 4.0 | null | 2023-02-10T11:14:49.050 | 2023-02-10T11:14:49.050 | null | null | 15,997,509 | null |
75,410,869 | 2 | null | 75,410,414 | 0 | null | The Universal Link banner is a ‘smart banner’. The ‘smartness’ in-play here is that it condenses in height when the app is installed.
The documentation ([see here](https://developer.apple.com/documentation/webkit/promoting_apps_with_smart_app_banners)) states
> the Smart App Banner intelligently changes its action
The documentation shows the two states of the banner as-well.
| null | CC BY-SA 4.0 | null | 2023-02-10T12:02:12.563 | 2023-02-10T12:02:12.563 | null | null | 4,944,020 | null |
75,410,987 | 2 | null | 75,406,135 | 0 | null | The line of code you have used:
```
cookie_accept = driver.find_element(by=By.LINK_TEXT, value="Sign in")
```
doesn't identify any element within the [HTML DOM](https://www.w3schools.com/js/js_htmldom.asp). Hence `cookie_accept` remains . So you can't invoke click on the NULL object and you see the error:
```
AttributeError: 'NoneType' object has no attribute 'click'
```
---
## Solution
The desired element is a dynamic element, so to click on the element you need to induce [WebDriverWait](https://stackoverflow.com/a/59130336/7429447) for the [element_to_be_clickable()](https://stackoverflow.com/a/54194511/7429447) and you can use either of the following [locator strategies](https://stackoverflow.com/a/48056120/7429447):
- Using :```
driver.get('https://hub.knime.com/')
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button.accept-button.button.primary"))).click()
```
- Using :```
driver.get('https://hub.knime.com/')
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[contains(., 'login or register')]"))).click()
```
- : You have to add the following imports :```
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
```
- Browser snapshot:

| null | CC BY-SA 4.0 | null | 2023-02-10T12:15:03.920 | 2023-02-10T12:22:54.773 | 2023-02-10T12:22:54.773 | 7,429,447 | 7,429,447 | null |
75,411,142 | 2 | null | 75,411,047 | 1 | null | If you add the following attributes to the methods you can specify the output model and the error
```
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(YOUROBJECT))]
[ProducesResponseType(StatusCodes.Status404NotFound)]
```
| null | CC BY-SA 4.0 | null | 2023-02-10T12:29:29.037 | 2023-02-10T12:33:15.187 | 2023-02-10T12:33:15.187 | 35,186 | 35,186 | null |
75,411,155 | 2 | null | 31,379,005 | 1 | null | I had this issue where the time filter was unable to get earlier events. I think this is because the width of the waterfall dragger was obscuring the filter.
An easy workaround is to download the HAR file (see the down arrow) and then open a new tab and then re-upload. Cleared all of those annoying filters and I was able to see those early network calls again.
| null | CC BY-SA 4.0 | null | 2023-02-10T12:30:28.850 | 2023-02-10T12:30:28.850 | null | null | 18,738,462 | null |
75,411,307 | 2 | null | 75,406,242 | 0 | null | You're with your `handleSubmit()` function. Instead of trying to set the state using the state callback (not necessary here) and in the next line trying to access that set state (not possible/reliable), you can simply construct your new user's state, create the user, then set the user state.
```
async function handleSubmit (event) {
try {
event.preventDefault();
const id = Date.now();
const joiningDate = await createJoiningDate();
setUserInfo((prev) => ({ ...prev, id, joiningDate }));
await createUser(userInfo, id, joiningDate);
navigate(`/profile/54`);
} catch (error) {
console.error(error.message);
}
}
```
```
async function handleSubmit (event) {
try {
event.preventDefault();
const id = Date.now();
const joiningDate = await createJoiningDate();
const newUserInfo = { ...userInfo, id, joiningDate };
await createUser(newUserInfo, id, joiningDate);
setUserInfo(newUserInfo);
navigate(`/profile/54`);
} catch (error) {
console.error(error.message);
}
}
```
Since your function is not occurring inside of a callback or useEffect, it should not have stale userInfo props so you can access it normally.
Setting state using the callback (`setUserInfo((prev) => ({ ...prev, id, joiningDate }));`) is a very good strategy when necessary.
| null | CC BY-SA 4.0 | null | 2023-02-10T12:44:06.370 | 2023-02-10T12:44:06.370 | null | null | 904,956 | null |
75,411,890 | 2 | null | 75,411,796 | -1 | null | You can use `MainAxisAlignment.center`
```
RadioListTile(
tileColor: Colors.cyanAccent,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
///use your image
Icon(Icons.flag),
Text(
"Bahrain",
style: TextStyle(
color: Colors.black,
),
),
],
),
```
| null | CC BY-SA 4.0 | null | 2023-02-10T13:37:30.777 | 2023-02-10T13:51:55.983 | 2023-02-10T13:51:55.983 | 10,157,127 | 10,157,127 | null |
75,411,941 | 2 | null | 58,410,187 | 0 | null | To plot the predicted label vs. the actual label I would do the following:
1. Assume these are the names of my parameters
`X_features_main #The X Features`
`y_label_main #The Y Label`
`y_predicted_from_X_features_main #The predicted Y-label from X-features I used`
```
plt.scatter(x=X_features_main, y=y_label_main,color='black') #The X-Features vs. The Real Label
plt.plot(X_features_main, y_predicted_from_X_features_main,color='blue') #The X- Features vs. The predicted label
plt.show()#To show your figures code here
```
| null | CC BY-SA 4.0 | null | 2023-02-10T13:41:16.550 | 2023-02-10T13:41:16.550 | null | null | 17,423,097 | null |
75,412,095 | 2 | null | 75,409,670 | 1 | null | Yes, it is possible to restrict the number of groups a user can be associated with in Django. One way to do this is to override the [save_model()](https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model) method in your custom `UserAdmin` class and perform the check there, so:
```
@admin.register(User)
class UserAdmin(DjangoUserAdmin):
# ... other stuff
# ... other stuff
def save_model(self, request, obj, form, change):
if obj.groups.count() > 1:
self.message_user(request, _('Users can only be associated with one group.'), level=messages.ERROR)
else:
super().save_model(request, obj, form, change)
```
| null | CC BY-SA 4.0 | null | 2023-02-10T13:54:52.240 | 2023-02-10T13:54:52.240 | null | null | 17,562,044 | null |
75,412,438 | 2 | null | 75,412,344 | 0 | null | Use a simple loop:
```
for d, n in zip(df['id'], df['new_name']):
d['name'] = n
```
Updated DataFrame:
```
id new_name
0 {'name': 'Honda'} Honda
1 {'name': 'Toyota'} Toyota
```
| null | CC BY-SA 4.0 | null | 2023-02-10T14:27:29.510 | 2023-02-10T14:27:29.510 | null | null | 16,343,464 | null |
75,412,995 | 2 | null | 75,408,650 | 0 | null | In InterfaceBuilder, select a TextView and go to Attributes Inspector -> Text Layout. Expected behavior comes with 'TextKit2', By default 'TextKit2' is set when the value is set to 'default'.
| null | CC BY-SA 4.0 | null | 2023-02-10T15:23:16.057 | 2023-02-10T15:23:16.057 | null | null | 1,180,728 | null |
75,413,298 | 2 | null | 75,411,438 | 0 | null | `Process` and shell are not supported in iOS, those are macOS APIs.
| null | CC BY-SA 4.0 | null | 2023-02-10T15:48:10.987 | 2023-02-10T15:48:10.987 | null | null | 426,320 | null |
75,413,386 | 2 | null | 75,411,023 | 0 | null | If you put the textblock in a canvas, that will not clip.
```
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock
Margin="5"
Text="{Binding Path=Priority}" />
<Canvas>
<TextBlock
Text="{Binding Path=TaskName}" />
</Canvas>
</StackPanel>
```
[](https://i.stack.imgur.com/H6yiP.png)
| null | CC BY-SA 4.0 | null | 2023-02-10T15:56:14.120 | 2023-02-10T15:56:14.120 | null | null | 426,185 | null |
75,413,533 | 2 | null | 75,413,478 | 0 | null | You can easily avoid it by adding `z-index: 1;` to `table.hidden`
| null | CC BY-SA 4.0 | null | 2023-02-10T16:11:29.917 | 2023-02-10T16:11:29.917 | null | null | 21,094,710 | null |
75,413,651 | 2 | null | 75,361,014 | 0 | null | You can use [gcloud data-catalog tags update](https://cloud.google.com/sdk/gcloud/reference/data-catalog/tags/update) and [gcloud data-catalog tags delete](https://cloud.google.com/sdk/gcloud/reference/data-catalog/tags/delete) commands.
The tricky part here is obtaining values for `--entry-group` and `--entry` parameters - BigQuery entries are automatically ingested to Data Catalog, and have automatically assigned entry group id and entry id. To get these values use [gcloud data-catalog entries lookup](https://cloud.google.com/sdk/gcloud/reference/data-catalog/entries/lookup) command.
| null | CC BY-SA 4.0 | null | 2023-02-10T16:21:30.263 | 2023-02-10T16:21:30.263 | null | null | 19,801,744 | null |
75,413,972 | 2 | null | 75,413,001 | 0 | null | To store files in your public folder you can use the public disk that's included in your application's filesystems configuration file, the default config will store files in `storage/app/public`.
To make these files accessible from the web though (which I'm assuming is what you want) you need to create a symbolic link from `public/storage` to `storage/app/public`.
To do that just run:
```
php artisan storage:link
```
Once you've done this you can use Laravel's `storage` facade to interact with the files in your public folder to save, retrieve and download them.
Store
```
use Illuminate\Support\Facades\Storage;
Storage::put('file.jpg', $contents);
```
Download
```
return Storage::download('file.jpg');
return Storage::download('file.jpg', $name, $headers);
```
Retrieve
```
$contents = Storage::get('file.jpg');
```
If you need to store user uploaded files to your public storage, you can do it like this:
```
$path = $request->file('yourUploadedPdf')->store('yourPdfsFolder');
```
Laravel's `store` method will generate a unique ID for the filename and the extension will be determined by the MIME type of the uploaded file. The store method also returns the path, including the generated filename, so you can store it in your DB if needed.
If you need to specify the filename then you can do this:
```
$path = $request->file('pdf')->storeAs(
'yourPdfsFolder', 'yourPdfFileName'
);
```
Just a note, I'm assuming you'll be having `public` as your default disk, if not, then you'll need to specify the disk you're using in these method / Storage facade calls.
And a further note, when using the public disk, everything - by default - gets stored under `storage/app/public` so anytime you're defining a folder to store your uploaded PDFs under, it'll be `storage/app/public/yourFolder`.
| null | CC BY-SA 4.0 | null | 2023-02-10T16:51:37.517 | 2023-02-10T16:57:27.763 | 2023-02-10T16:57:27.763 | 20,600,516 | 20,600,516 | null |
75,414,169 | 2 | null | 75,413,478 | 1 | null | This is working "as it should", but to get your desired result, use `z-index: 1` on your `position: absolute` element.
I did some more digging into this because I was curious as to why it was happening. There are two important things:
1. elements with position: absolute and a z-index: auto stay in the same stacking context.
2. an element with an opacity less than 1 creates a new stacking context.
I found [this answer](https://stackoverflow.com/a/11742116/20913924) helpful as it goes into more depth about why this happens.
| null | CC BY-SA 4.0 | null | 2023-02-10T17:11:35.123 | 2023-02-10T17:11:35.123 | null | null | 20,913,924 | null |
75,414,380 | 2 | null | 75,088,073 | 0 | null | You shouldn't use the full path in `setSourceAsset`, and since you've already set a prefix for the cache you kust have to write the filename:
```
audioPlayer.setSourceAsset('flip.mp3');
```
| null | CC BY-SA 4.0 | null | 2023-02-10T17:34:11.980 | 2023-02-10T17:34:11.980 | null | null | 789,545 | null |
75,414,406 | 2 | null | 52,890,538 | 0 | null | This forces the call time into 5 minute intervals. Use 'count' and 'group by' on these intervals. Using DateTime as a column name is confusing
```
SELECT DATEADD(MINUTE, CAST(DATEPART(MINUTE, [DateTime] AS INTEGER)%5 * - 1,CAST(FORMAT([DateTime], 'MM/dd/yyyy hh:mm') AS DATETIME)) AS CallInterval, COUNT(*)
FROM Calls
GROUP BY DATEADD(MINUTE, CAST(DATEPART(MINUTE, [DateTime]) AS INTEGER)%5 * - 1,CAST(FORMAT([DateTime], 'MM/dd/yyyy hh:mm') AS DATETIME))
```
| null | CC BY-SA 4.0 | null | 2023-02-10T17:36:10.460 | 2023-02-17T15:12:52.180 | 2023-02-17T15:12:52.180 | 2,029,983 | 9,095,237 | null |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.