Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
⌀ | ParentId
int64 1.68k
75.6M
⌀ | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
⌀ | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
⌀ | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 1
21.3M
⌀ | Tags
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
74,797,630 | 2 | null | 74,796,980 | 1 | null | This is one neat solution using base R functions.
```
library(tidyverse)
mtcars |>
ggplot() +
aes(x = wt, y = mpg) +
geom_point() +
labs(x = expression(atop("Miles/(US) gallon", atop("[Min = 10.4, Max = 33.9]"))))
```

| null | CC BY-SA 4.0 | null | 2022-12-14T11:32:10.003 | 2022-12-14T11:32:10.003 | null | null | 8,295,338 | null |
74,797,722 | 2 | null | 74,764,368 | 7 | null | I had the same problem. In my case it was related to this Spring Tools Suite 4.17.0 issue 925: [OpenRewrite unchecked, but always Language Server Background Job(Loading Rewrite Recipes)](https://github.com/spring-projects/sts4/issues/925) causing the language server to load the OpenRewrite recipes multiple times.
This issue was fixed in STS release 4.17.1 and updating using `Help` -> `Check for Updates` in Eclipse resolved the problem for me.
| null | CC BY-SA 4.0 | null | 2022-12-14T11:39:31.300 | 2023-01-04T08:45:10.317 | 2023-01-04T08:45:10.317 | 240,803 | 240,803 | null |
74,797,958 | 2 | null | 64,069,758 | -1 | null | I downloaded cypress-xpath and updated the config file with requires('cypress-xpath) and then tried and it worked
| null | CC BY-SA 4.0 | null | 2022-12-14T11:59:04.720 | 2022-12-14T11:59:04.720 | null | null | 12,604,976 | null |
74,798,099 | 2 | null | 74,795,638 | 0 | null | Once you applied the List, you can add the Text "Select from dropdown" by copy and paste (as value) to the list cells.
Then you have it as you want, but once you choose a value from the drop down and delete it again, then the cell will remain empty. The text "Select from dropdown" will not display anymore. Solving this, you will need to use VBA programming.
[](https://i.stack.imgur.com/Vx3zA.png)
| null | CC BY-SA 4.0 | null | 2022-12-14T12:10:57.593 | 2022-12-14T12:10:57.593 | null | null | 17,516,899 | null |
74,798,224 | 2 | null | 74,797,764 | 2 | null | If you have Excel 365 you can use the `FILTER`-Formula:
`=FILTER($D$3:$D$19,($F3=$A$3:$A$19)*(G$1>=$B$3:$B$19)*(G$1<=$C$3:$C$19),"")`
"old school":
`=IFNA(INDEX($D$3:$D$19,MATCH(1,($F3=$A$3:$A$19)*(G$1>=$B$3:$B$19)*(G$1<=$C$3:$C$19),0)),"")`
| null | CC BY-SA 4.0 | null | 2022-12-14T12:22:16.277 | 2022-12-14T13:08:56.947 | 2022-12-14T13:08:56.947 | 16,578,424 | 16,578,424 | null |
74,798,399 | 2 | null | 19,102,159 | 0 | null | ```
<RadioButton
android:id="@+id/radio1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:drawableBottom="?android:attr/listChoiceIndicatorSingle"
android:gravity="center_horizontal|bottom"[enter image description here][1]
android:background="@drawable/app_border_0"
android:padding="@dimen/_15sdp"
android:text="@string/no"
android:fontFamily="@font/poppins_medium"
style="@style/AppRadioAppStyle"
android:layout_marginStart="@dimen/_10sdp"/>
```
should be add android:button="@null" in your radiobutton
| null | CC BY-SA 4.0 | null | 2022-12-14T12:35:17.690 | 2022-12-14T12:35:17.690 | null | null | 5,218,045 | null |
74,798,500 | 2 | null | 74,798,191 | 1 | null | Like fdireito says, if you want your data to be plotted in a different location with respect to the x-axis, you need to provide x data.
Documentation on the [plt.plot()](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html) method shows that you can just provide the x data as a optional first argument. By default the method uses the index position of each data point as x argument.
To make the second plot align with the first plot, you need to tell the plot method which x arguments to use. In your case you want x to continue counting from 4, since you plot the first 5 elements of lst on the first line.
This is what your code could look like:
```
import matplotlib.pyplot as plt
lst = [5,10,15,8,9,6,8,12,13,6]
plt.plot(lst[:5])
plt.plot(range(4, 4+len(lst[7:])), lst[7:], color='red') # Range starts at 4 because the first plot ends at index 4.
plt.show()
```
| null | CC BY-SA 4.0 | null | 2022-12-14T12:43:16.250 | 2022-12-15T09:44:53.470 | 2022-12-15T09:44:53.470 | 19,868,685 | 19,868,685 | null |
74,798,920 | 2 | null | 74,798,689 | 0 | null | You can use this formula for a unique list of filtered values:
`=UNIQUE(FILTER(D2:D16,A2:A16=I2))`
You can't use this formula as a data validation source :-(
Therefore you have to put it somewhere (hidden) on the sheet, e.g. into cell `K2`.
And then refer to it as `K2#` in the data validation source.
To show the values in a row instead of column you use:
`=TRANSPOSE(UNIQUE(FILTER(D2:D16,A2:A16=I2)))`
| null | CC BY-SA 4.0 | null | 2022-12-14T13:20:17.630 | 2022-12-15T07:07:33.597 | 2022-12-15T07:07:33.597 | 16,578,424 | 16,578,424 | null |
74,798,983 | 2 | null | 74,798,862 | 0 | null | You have a composite primary key that is composed of two columns but, in your foreign key, you are only referencing one of the columns of the composite primary key and not the entire primary key.
You either need to:
- `purchaseorderid`- `UNIQUE``purchaseorderid`-
Whichever option you choose, you should make sure that it implements the business logic that you are trying to capture in the table; if it does not then you should revisit the database-design and find a design that does capture your business logic.
| null | CC BY-SA 4.0 | null | 2022-12-14T13:25:56.953 | 2022-12-14T14:08:13.247 | 2022-12-14T14:08:13.247 | 1,509,264 | 1,509,264 | null |
74,799,073 | 2 | null | 64,718,269 | 2 | null | You can achieve it. Firstly you need to add four spaces before all those tages and newlines before and after the block. Secondly you can add image differently:
```
<details>
<summary>click to expand</summary>
<IMG src="blob:https://dev.azure.com/..." alt="image.png"/>
</details>
```
| null | CC BY-SA 4.0 | null | 2022-12-14T13:33:53.617 | 2022-12-15T08:13:05.427 | 2022-12-15T08:13:05.427 | 11,592,336 | 11,592,336 | null |
74,799,367 | 2 | null | 74,799,249 | 0 | null | `join` is what you need. And specify `how='outer'` if you dont want to lose any of row.
```
df1.set_index('ID').join(df2.set_index('ID'), how='outer')
```
| null | CC BY-SA 4.0 | null | 2022-12-14T13:56:13.497 | 2022-12-14T13:56:13.497 | null | null | 9,053,066 | null |
74,799,462 | 2 | null | 74,799,249 | 0 | null | IIUC, You can use:
```
dfx=df.groupby('ID').agg(list)
max_list_lenght=len(dfx.max()[0])
final=pd.DataFrame(dfx.apply(lambda x: [x[i][j] if len(x[i]) > j else 0 for j in range(0,max_list_lenght) for i in dfx.columns],axis=1).tolist(), index=dfx.index)
final.columns=['dat' + str(i) for i in range(1,len(final.columns) + 1)]
```
:
```
dat1 dat2 dat3 dat4 dat5 dat6
ID
1 9 3 6 5 7 7
2 5 5 5 6 5 5
3 3 0 5 0 0 0
```
| null | CC BY-SA 4.0 | null | 2022-12-14T14:03:25.003 | 2022-12-15T21:30:52.007 | 2022-12-15T21:30:52.007 | 15,415,267 | 15,415,267 | null |
74,799,488 | 2 | null | 74,797,764 | 0 | null | What about this approach? Use numbers instead of letters and create a secondary dataset where each number is related to a letter. Then VLOOKUP the result there;
[](https://i.stack.imgur.com/1ME66.png)
```
=VLOOKUP(SUMIFS($D$12:$D$17,$B$12:$B$17,"<="&G$10,$C$12:$C$17,">="&G$10,$A$12:$A$17,$F12),$A$2:$B$8,2,FALSE)
```
Not the cleanest one but it works in old versions of Excel...
Notice in cell A2 There is a 0 value associated to a blank value. To avoid the formula returning zeros you must deactivate option:
> [Display or hide zero values](https://support.microsoft.com/en-us/office/display-or-hide-zero-values-3ec7a433-46b8-4516-8085-a00e9e476b03)
| null | CC BY-SA 4.0 | null | 2022-12-14T14:05:26.687 | 2022-12-14T14:05:26.687 | null | null | 9,199,828 | null |
74,799,496 | 2 | null | 74,799,433 | 0 | null | use this code:
```
const Main = (header, navigation) => {
if (navigation !== false) return <Navigation />
return <></>
}
```
| null | CC BY-SA 4.0 | null | 2022-12-14T14:06:05.407 | 2022-12-14T14:06:05.407 | null | null | 12,342,919 | null |
74,799,512 | 2 | null | 74,799,433 | 0 | null | Try this:
```
const Main = (header, navigation) => {
return (
!!navigation ? <Navigation />:<></>
)
}
```
| null | CC BY-SA 4.0 | null | 2022-12-14T14:07:09.830 | 2022-12-16T13:08:18.147 | 2022-12-16T13:08:18.147 | 10,871,073 | 8,375,128 | null |
74,799,587 | 2 | null | 74,782,929 | 0 | null | I agree with @IInspectable that this solution is problematic,
though this is the best I can get at the moment,
and it seems good for me.
For the sake of those trying to get this working, I'm writing down here the solution in my case, with help from @Ike and @ErikA (yet not forgetting @IInspectable 's important comments!):
In Module:
```
#If VBA7 Then
Public Declare PtrSafe Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (Destination As Any, source As Any, ByVal length As LongPtr)
#Else
Public Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (Destination As Any, source As Any, ByVal length As Long)
#End If
...
Sub StoreObjRef(obj As Object)
On Error GoTo HandleErr
#If VBA7 Then
Dim longObj As LongPtr
#Else
Dim longObj As Long
#End If
longObj = ObjPtr(obj)
If longObj <> Nz(dlookupado("objRef", "ribbonRef", , True), 0) Then
Call runsqlstr("DELETE * FROM ribbonRef")
Call runsqlstr("INSERT INTO ribbonRef (objRef) SELECT CStr(" & longObj & ")")
End If
ExitHere:
Exit Sub
Resume
HandleErr:
...
End Sub
Sub RetrieveObjRef()
' Retrieve the object reference
On Error GoTo HandleErr
Dim obj As Object
#If VBA7 Then
Dim longObj As LongPtr
#Else
Dim longObj As Long
#End If
longObj = Nz(dlookupado("objRef", "ribbonRef", , True), 0)
If longObj <> 0 Then
CopyMemory obj, longObj, LenB(longObj)
Set gobjRibbon = obj
Set gobjMainRibbon = obj
End If
ExitHere:
Exit Sub
Resume
HandleErr:
...
End Sub
```
Storing the reference right after setting of reference object:
```
Public Sub OnRibbonLoad(ribbon As IRibbonUI)
...
Set gobjRibbon = ribbon
Set gobjMainRibbon = ribbon
Call StoreObjRef(gobjMainRibbon)
...
```
And finally, use it where I need:
```
If gobjMainRibbon Is Nothing Then Call RetrieveObjRef
```
ribbonRef table:
[](https://i.stack.imgur.com/oKozz.png)
Tested on both MS Access 64 bit and 32 bit versions.
Though be aware to @IInspectable 's comment
> It's not the control behind the IRibbonUI interface that gets reset, but your reference to the interface. It's a COM pointer under the hood, and when that gets dropped it tells the COM server that you are done using the control, and if there aren't any other outstanding references to it, the control is eligible for destruction. The only way for your code to make sure that the control doesn't get destroyed is by keeping a reference to its interface alive.
... So we may have got a reference to the same place in memory, though it could be that that place in memory will be used for something else...
and that might cause app to crash...
...
| null | CC BY-SA 4.0 | null | 2022-12-14T14:12:49.413 | 2022-12-14T14:48:30.037 | 2022-12-14T14:48:30.037 | 15,321,389 | 15,321,389 | null |
74,800,097 | 2 | null | 73,054,002 | 0 | null | Execute flutter pub get for update your libraries
| null | CC BY-SA 4.0 | null | 2022-12-14T14:53:05.823 | 2022-12-14T14:53:05.823 | null | null | 10,693,314 | null |
74,800,168 | 2 | null | 55,037,816 | 0 | null | You can create an Interface that you add to your adapter and a listener for it.
```
public interface OnAdapterItemClicked {
// you can name it what ever you need add pass more parameters
void itemClicked(String text);
}
```
then in your adapter, you initialise it and add the listener on the click event,
```
private OnAdapterItemClicked mListener = null;
...
@Override
public void onBindViewHolder(@NonNull YourAdapter.ViewHolder holder,
int position) {
...
holder.YourBtn.setOnClickListener(....{
mListener.itemClicked("string you need to pass")
});
...
}
...
public void setOnItemClickListener(OnAdapterItemClicked listener) {
this.mListener = listener;
}
```
finally in you activity/fragment you add a listener on the recyclerview
```
rv.setOnItemClickListener(new OnAdapterItemClicked () {
@Override
public void itemClicked(String text) {
Log.d(TAG, "itemClicked: "+text);
}
});
```
| null | CC BY-SA 4.0 | null | 2022-12-14T14:58:25.773 | 2022-12-14T15:05:22.920 | 2022-12-14T15:05:22.920 | 4,438,044 | 4,438,044 | null |
74,800,259 | 2 | null | 74,793,655 | 0 | null | You can't remove those indexes because those are representing keys for each element in the array (because you have more objects in there). If you need to go over the JSON response just use
`foreach($jsonResponse as $key => $response)`
This way, each $response will represent one of the objects you have and the key will contain indexes you want to remove.
You could also try `json_encode(array_values(json_decode($response)))` but I think that foreach will do the trick for you.
| null | CC BY-SA 4.0 | null | 2022-12-14T15:05:03.950 | 2022-12-14T15:05:03.950 | null | null | 20,111,887 | null |
74,800,661 | 2 | null | 74,785,906 | 0 | null | I managed to solve this by just reversing
```
for (int i = arrayList.length-1;i>=0;i--) {
if(arrayTwo[i]%2==0) {
System.out.print(arrayTwo[i] + " ");
```
| null | CC BY-SA 4.0 | null | 2022-12-14T15:36:47.263 | 2022-12-14T15:36:47.263 | null | null | 20,766,735 | null |
74,800,806 | 2 | null | 74,800,648 | 1 | null | You are trying to plot single points as a line, which is not possible (as of course you need at least 2 points). You can easily modify that by using scatter instead of plot. You will also need to define the other coordinate of the point, which is z at index i:
```
for i in range(len(z)):
d_Ls = d_L(z[i], omega_m=omega_m)
plt.scatter(z[i], d_Ls, label = 'z = %.1f' % (z[i]))
```
| null | CC BY-SA 4.0 | null | 2022-12-14T15:47:03.307 | 2022-12-14T15:47:03.307 | null | null | 13,031,996 | null |
74,800,900 | 2 | null | 74,785,409 | 0 | null | [Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/a/285557)
---
However, it is a very specific path to an element, so I would recommend to change your strategy of how to select elements. Ask yourself what is realy needed to make the path specific enough and what could be skipped.
The element is part under a `<h2>` with string `Lists`, that´s parent container is the previous sibling of the one of your element, so you can go with:
```
soup.select_one('h2:-soup-contains-own("Lists")').find_parent('div',{'class':''}).find_next_sibling().a
```
[https://datacentremagazine.com/top10/all](https://datacentremagazine.com/top10/all)
#### Example
```
import requests
from bs4 import BeautifulSoup
url = 'https://datacentremagazine.com/'
soup = BeautifulSoup(requests.get(url).text)
soup.select_one('h2:-soup-contains-own("Lists")').find_parent('div',{'class':''}).find_next_sibling().a
```
#### Output
```
<a class="Card_CardOverlayLink__2VHuB" href="/articles/top-10-data-centre-influencers-to-follow-on-linkedin"></a>
```
| null | CC BY-SA 4.0 | null | 2022-12-14T15:53:37.593 | 2022-12-14T15:53:37.593 | null | null | 14,460,824 | null |
74,801,098 | 2 | null | 8,603,359 | 0 | null | Working with and
I tried the above solution, but sometimes my custom image was not displayed in some cells.
This code works fine for me into the `UITableViewCell` :
```
private lazy var customReorderImgVw: UIImageView = {
let img = UIImage(named: "imgCustomReorder")!
let imgVw = UIImageView(image: img)
imgVw.contentMode = .center
imgVw.frame = CGRect(origin: .zero, size: img.size)
imgVw.alpha = 0
return imgVw
}()
override func setEditing(_ editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated)
if editing {
for subVw in subviews {
if "\(subVw.classForCoder)" == "UITableViewCellReorderControl" {
subVw.subviews.forEach { $0.removeFromSuperview() }
customReorderImgVw.center.y = subVw.center.y
subVw.addSubview(customReorderImgVw)
break
}
}
}
showOrHideCustomReorderView(isToShow: editing)
}
private func showOrHideCustomReorderView(isToShow: Bool) {
let newAlpha: CGFloat = (isToShow ? 1 : 0)
UIView.animate(withDuration: 0.25) {
self.customReorderImgVw.alpha = newAlpha
}
}
```
| null | CC BY-SA 4.0 | null | 2022-12-14T16:08:44.350 | 2022-12-14T16:25:35.323 | 2022-12-14T16:25:35.323 | 4,084,902 | 4,084,902 | null |
74,801,182 | 2 | null | 13,341,603 | 0 | null | Since iOS 15 / Xcode 13, you have to set stackedLayoutAppearance property to change badge color on UITabBarItem. Change just ".blue" with you own color:
```
if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.stackedLayoutAppearance.normal.badgeBackgroundColor = .blue
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = appearance
}
```
Tested on Xcode 14.1 / iOS 16.
| null | CC BY-SA 4.0 | null | 2022-12-14T16:15:25.283 | 2022-12-14T16:15:25.283 | null | null | 1,708,626 | null |
74,802,253 | 2 | null | 67,460,387 | 0 | null | Another possible gotcha: make sure your Run output is visible. You may have to expand the Run output screen from right to left, like so:
[Before](https://i.stack.imgur.com/XF2Qc.png)
[After](https://i.stack.imgur.com/5ctqn.png)
| null | CC BY-SA 4.0 | null | 2022-12-14T17:38:53.287 | 2022-12-14T17:48:09.980 | 2022-12-14T17:48:09.980 | 20,777,836 | 20,777,836 | null |
74,802,899 | 2 | null | 74,791,058 | 23 | null | I ended up creating a tailwind.config.js file in the sanity folder with the following information. It fixed it.
```
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {},
},
plugins: [],
}
```
| null | CC BY-SA 4.0 | null | 2022-12-14T18:42:15.957 | 2023-01-24T18:36:11.187 | 2023-01-24T18:36:11.187 | 17,934,872 | 17,934,872 | null |
74,803,060 | 2 | null | 74,802,923 | 2 | null | You need to return the value from useSelector.
You may try the following
```
useSelector((store) => {
return store.roi.rate;
});
```
| null | CC BY-SA 4.0 | null | 2022-12-14T18:58:41.860 | 2022-12-14T18:58:41.860 | null | null | 6,892,036 | null |
74,803,334 | 2 | null | 21,739,483 | 0 | null | You can also just restart the IDE.
| null | CC BY-SA 4.0 | null | 2022-12-14T19:27:48.713 | 2022-12-14T19:27:48.713 | null | null | 11,156,229 | null |
74,803,441 | 2 | null | 74,803,422 | 0 | null | You will be charged for the number of agents even when they are set to disabled. You need to change the number of agents in the billing section.
```
https://dev.azure.com/{{organization}}/_settings/billing
```
You will be charged to the end of the billing cycle if you lower the number.
| null | CC BY-SA 4.0 | null | 2022-12-14T19:40:34.343 | 2022-12-14T19:54:41.213 | 2022-12-14T19:54:41.213 | 736,079 | 736,079 | null |
74,803,558 | 2 | null | 74,802,015 | 1 | null | As stated in the comments, that is a GroupBox with two RadioButtons in it:
[](https://i.stack.imgur.com/MJXhy.gif)
| null | CC BY-SA 4.0 | null | 2022-12-14T19:55:56.150 | 2022-12-14T19:55:56.150 | null | null | 2,330,053 | null |
74,804,173 | 2 | null | 74,741,443 | 0 | null | [MemoryEvent](https://developers.google.com/android/management/reference/rest/v1/enterprises.devices#memoryevent) returns 3 values per event, `eventType`, `createTime`, and `byteCount`. To get these values, you first need to include the [statusReportingSettings](https://developers.google.com/android/management/reference/rest/v1/enterprises.policies#statusreportingsettings) on your policy and set `memoryInfoEnabled: true`. You can check this [link](https://stackoverflow.com/questions/68625944) for more information with regards to memoryEvents.
| null | CC BY-SA 4.0 | null | 2022-12-14T21:05:24.980 | 2022-12-14T21:05:24.980 | null | null | 12,391,896 | null |
74,804,217 | 2 | null | 74,803,468 | 2 | null | Here is an example of how I use `choroplethrZip` library.
The key point is that the value column must be called value, and the zip code column must be called "region". The zip code data must be character/string values that match the internal function source data.
> A data.frame with a column named "region" and a column named "value". Elements in the "region" column must exactly match how regions are named in the "region" column in ?zip.map.
```
#install_github('arilamstein/[email protected]')
library(choroplethrZip)
water<-structure(list(region = c("32034", "32081", "32082", "32092",
"32097", "32202", "32204", "32205", "32206", "32207", "32208",
"32209", "32210", "32211", "32216", "32217", "32218", "32219",
"32220", "32221", "32222", "32223", "32224", "32225", "32226",
"32233", "32234", "32244", "32246", "32250", "32254", "32256",
"32257", "32258", "32259", "32277"), value = c(284, 368, 337,
338, 280, 247, 247, 260, 227, 253, 220, 244, 209, 309, 298, 270,
256, 282, 267, 216, 156, 240, 283, 304, 242, 254, 180, 188, 301,
301, 267, 334, 240, 240, 310, 258)), row.names = c(NA, -36L),
class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame"))
zip_choropleth(water,
zip_zoom = (water$region),
num_colors = 1,
title = "Jacksonville FL Area Water Hardness by Zip Code",
legend = "PPM")
```
[](https://i.stack.imgur.com/6wAgk.png)
Data Source: [https://www.jea.com/About/Water_Supply/Water_Hardness_Levels/](https://www.jea.com/About/Water_Supply/Water_Hardness_Levels/)
| null | CC BY-SA 4.0 | null | 2022-12-14T21:11:45.650 | 2022-12-19T20:30:42.760 | 2022-12-19T20:30:42.760 | 10,276,092 | 10,276,092 | null |
74,804,242 | 2 | null | 55,555,466 | 0 | null | Another approach, besides that of [tvbc](https://stackoverflow.com/users/13921715/tvbc), is to change the yticks on the plot.
```
import matplotlib.pyplot as plt
import numpy as np
steps = 10
bins = np.arange(0, 101, steps)
data = np.random.random(100000) * 100
plt.hist(data, bins=bins, density=True)
yticks = plt.gca().get_yticks()
plt.yticks(yticks, np.round(yticks * steps, 2))
plt.show()
```
| null | CC BY-SA 4.0 | null | 2022-12-14T21:14:08.287 | 2022-12-14T21:14:08.287 | null | null | 13,616,836 | null |
74,804,573 | 2 | null | 14,910,109 | 0 | null | I was able to get the desired width of the colorbar using a combination of `fraction` and `aspect` parameters: [https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.colorbar.html](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.colorbar.html)
| null | CC BY-SA 4.0 | null | 2022-12-14T21:54:19.153 | 2022-12-14T21:54:19.153 | null | null | 8,162,710 | null |
74,804,591 | 2 | null | 4,787,332 | 0 | null | It is more difficult to remove outliers with grouped data because there is a risk of removing data points that are considered outliers in one group but not in others.
Because no dataset is provided I assume that there is a dependent variable "attractiveness", and two independent variables "age" and "gender". The boxplot shown in the original post above is then created with `boxplot(dat$attractiveness ~ dat$gender + dat$age)`. To remove outliers you can use the following approach:
```
# Create a separate dataset for each group
group_data = split(dat, list(dat$age, dat$gender))
# Remove outliers from each dataset
group_data = lapply(group_data, function(x) {
# Extract outlier values from boxplot
outliers = boxplot.stats(x$attractiveness)$out
# Remove outliers from data
return(subset(x, !x$attractiveness %in% outliers))
})
# Combine datasets into a single dataset
dat = do.call(rbind, group_data)
```
| null | CC BY-SA 4.0 | null | 2022-12-14T21:56:51.463 | 2022-12-14T21:56:51.463 | null | null | 2,061,205 | null |
74,804,916 | 2 | null | 74,804,324 | 0 | null |
I had the pager turned on and I was able to use the `\pset pager` command to turn it off.
[postgresql.org/docs](https://www.postgresql.org/docs/7.4/app-psql.html)
| null | CC BY-SA 4.0 | null | 2022-12-14T22:39:34.567 | 2022-12-19T19:57:42.247 | 2022-12-19T19:57:42.247 | 7,088,171 | 7,088,171 | null |
74,805,115 | 2 | null | 15,713,167 | 0 | null | Had the same issue, the problem was that my folder name had on %20 on it, i think when you have especial characters it won't recognize libraries.
| null | CC BY-SA 4.0 | null | 2022-12-14T23:07:28.240 | 2022-12-14T23:07:28.240 | null | null | 9,160,287 | null |
74,805,290 | 2 | null | 74,804,039 | 1 | null | Your `recursive` function isn't actually recursive, so your code doesn't work. It just produces two-level deep output that happens to look fairly OK-ish (but not quite) on the example test. Try other test cases.
Also, the expected output is a very unusual data structure since it mixes types. This is an antipattern that you should avoid if possible. It also omits the root, which makes the recursive logic a bit awkward to write. I used an extra inner function to strip off the root.
Here's one approach that uses a mixed-type return value and a test to determine how many parents we have. The logic for a given call is as follows:
- - -
```
const buildTreeFromParents = (graph, start) => {
const recurse = start => {
const parents = graph.inboundNeighbors(start);
if (parents.length === 0) {
return start;
}
else if (parents.length === 1) {
return [start, recurse(parents[0])];
}
return [start, parents.map(recurse)];
};
return graph.inboundNeighbors(start).map(recurse);
};
const graph = new graphology.Graph({
multi: false,
allowSelfLoops: false,
type: "directed"
});
graph.addNode(1);
graph.addNode(2);
graph.addNode(3);
graph.addNode(4);
graph.addNode(5);
graph.addNode(6);
graph.addEdge(1, 4, {name: "a"});
graph.addEdge(2, 5, {name: "b"});
graph.addEdge(3, 5, {name: "c"});
graph.addEdge(4, 6, {name: "d"});
graph.addEdge(5, 6, {name: "e"});
console.log(buildTreeFromParents(graph, 6));
```
```
<script src="https://cdnjs.cloudflare.com/ajax/libs/graphology/0.21.0/graphology.umd.min.js"></script>
```
Try to avoid global variables when writing functions, which should be purely self-contained to avoid bugs and confusing state modification and dependencies.
---
Based on the comments, here's the code that addresses a couple of the awkward issues mentioned above. It's still a mixed-type structure, but at least the root is included and the parent nesting makes more sense as no special condition is taken when there's only one parent.
```
const buildTreeFromParents = (graph, start) => {
const parents = graph.inboundNeighbors(start);
if (parents.length === 0) {
return start;
}
return [start, parents.map(e => buildTreeFromParents(graph, e))];
};
const graph = new graphology.Graph({
multi: false,
allowSelfLoops: false,
type: "directed"
});
graph.addNode(1);
graph.addNode(2);
graph.addNode(3);
graph.addNode(4);
graph.addNode(5);
graph.addNode(6);
graph.addEdge(1, 4, {name: "a"});
graph.addEdge(2, 5, {name: "b"});
graph.addEdge(3, 5, {name: "c"});
graph.addEdge(4, 6, {name: "d"});
graph.addEdge(5, 6, {name: "e"});
console.log(buildTreeFromParents(graph, 6));
```
```
<script src="https://cdnjs.cloudflare.com/ajax/libs/graphology/0.21.0/graphology.umd.min.js"></script>
```
| null | CC BY-SA 4.0 | null | 2022-12-14T23:30:42.843 | 2022-12-15T19:09:41.277 | 2022-12-15T19:09:41.277 | 6,243,352 | 6,243,352 | null |
74,805,381 | 2 | null | 74,798,312 | 0 | null | The most common reason for this is that your Flask app is listening on localhost only, which is the default, and so is not reachable from outside the machine it's running on.
To fix this, make the server externally visible, by using:
```
app.run(host='0.0.0.0')
```
| null | CC BY-SA 4.0 | null | 2022-12-14T23:44:19.513 | 2022-12-14T23:44:19.513 | null | null | 271,415 | null |
74,805,613 | 2 | null | 36,473,479 | 0 | null | In Windows, there is a User's Path variable and a System's Path variable. Jenkins uses the System's Path Variable by default. And you have to restart the service after updating the path.
[](https://i.stack.imgur.com/Hk4cA.png)
| null | CC BY-SA 4.0 | null | 2022-12-15T00:21:08.533 | 2022-12-15T00:21:08.533 | null | null | 6,513,698 | null |
74,805,822 | 2 | null | 74,778,643 | -1 | null | Looks like you're importing your icon incorrectly.
Instead of
`import { FaPlay } from "react-icons/Fa";`
try
`import { FaPlay } from "react-icons/fa";`
Notice the lowercase `fa` on the second one. I found this by looking at the react-icons documentation here: [https://react-icons.github.io/react-icons/icons?name=fa](https://react-icons.github.io/react-icons/icons?name=fa)
Hope this helps!
| null | CC BY-SA 4.0 | null | 2022-12-15T01:02:03.090 | 2022-12-15T01:02:03.090 | null | null | 10,844,766 | null |
74,805,972 | 2 | null | 13,746,404 | 0 | null | Change the cell format to text.
e.g. Cells(1,1).NumberFormat = "@"
| null | CC BY-SA 4.0 | null | 2022-12-15T01:34:09.447 | 2022-12-15T01:34:09.447 | null | null | 11,945,180 | null |
74,806,009 | 2 | null | 74,805,885 | 1 | null | Make it `position: absolute` and stick it to the right with `right: -30px` of the parent li have `position: relative`, so no matter how long the text, it always stay at the end.
```
.breadcrumb-container {
background: blue;
font-family: var(--font-family-semibold);
}
ul {
padding: 0;
margin-block-start: 0em;
margin-block-end: 0em;
margin-inline-start: 0px;
margin-inline-end: 0px;
padding-inline-start: 0px;
li {
list-style: none;
display: inline-block;
text-transform: uppercase;
padding: 10px 20px;
a {
text-decoration: none;
color: white;
font-size: 14px;
line-height: 17px;
font-family: var(--font-family-semibold);
}
}
}
ul.tabs>li {
float: right;
padding-right: 60px;
padding-top: 11px;
padding-left: 40px;
height: 56px;
background: darkblue;
box-shadow: 0 10px 20px rgba(0, 0, 0, .5);
max-width: 222px;
box-sizing: border-box;
border: 1px solid #10172E;
position: relative;
}
ul.tabs>li>a {
display: inline-block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
text-decoration: none;
color: $alis-white;
}
li:after {
content: '';
position: absolute;
width: 0;
height: 0;
bottom: -1px;
right: -30px;
border-right: 30px solid transparent;
border-bottom: 56px solid green;
}
```
```
<div class="breadcrumb-container">
<ul class="tabs">
<li class="tab"><mat-icon>search</mat-icon></li>
<li class="tab1"><a href="javascript:void(0)">Different size Tab</a></li>
<li class="tab2"><a href="javascript:void(0)">Tab 2</a></li>
</ul>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-12-15T01:42:39.000 | 2022-12-15T01:42:39.000 | null | null | 5,096,440 | null |
74,806,333 | 2 | null | 74,737,298 | 0 | null | You need to download and install [Monogame 3.7](https://community.monogame.net/t/monogame-3-7-1/11173).
There was no "corruption" of the source files, only the project and .sln files.
Everything you wrote still exists in the source .cs files, simply copy the .cs files from your old project to the new one.
| null | CC BY-SA 4.0 | null | 2022-12-15T02:54:13.873 | 2022-12-15T02:54:13.873 | null | null | null | null |
74,806,376 | 2 | null | 22,974,172 | 0 | null | For Mac, select what you want and then you can use --> cmd+ctrl+g
| null | CC BY-SA 4.0 | null | 2022-12-15T03:00:50.233 | 2022-12-15T03:00:50.233 | null | null | 2,893,585 | null |
74,806,506 | 2 | null | 74,805,620 | 0 | null | You have to use the correct offset, in this case `d3.offsetWiggle`:
```
const stackedData = d3.stack().offset(d3.stackOffsetWiggle)
```
In this solution I'm flattening the stacked data and getting the extent, which I'll pass to the `y` scale:
```
const flatData = stackedData.flat(2);
y.domain(d3.extent(flatData));
```
Finally, I'm just moving the `x` axis to the middle of the `y` range. Also, I'm hardcoding the stack keys, but making the sequence programatically is trivial, as well as some other details you'll have to adjust.
Here's the result:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Stacked Bar</title>
</head>
<body>
<div class="container">
<div id="chart"></div>
</div>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script>
const width = 860,
height = 400,
margin = {
top: 40,
right: 30,
bottom: 20,
left: 20
};
const svg = d3
.select("#chart")
.append("svg")
.attr("viewBox", [0, 0, width, height]);
const csv = `Time,team1,team2,middle
0,5,2,70
1,10,13,89
2,4,15,110
3,6,16,145
4,12,2,167
5,42,3,111
6,6,4,108
7,7,5,92
8,8,34,140
9,12,89,190
10,22,90,398
11,42,91,459
12,60,23,256
13,69,13,253
14,43,11,188
15,42,7,167
16,21,9,124
17,16,12,156
18,7,14,167
19,12,13,188`;
const data = d3.csvParse(csv);
let x = d3
.scaleBand(
data.map((d) => d.Time), [margin.left, width - margin.right]
)
.padding([0.2]);
let y = d3.scaleLinear().range([height - margin.bottom, margin.top]);
svg.append("g").attr("transform", `translate(${margin.left},0)`);
// .call(d3.axisLeft(y).tickSize(-width + margin.left + margin.right));
//protein,carbs,fiber
const subgroups = ["team1", "middle", "team2"];
const color = d3.scaleOrdinal(subgroups, [
"#377eb8",
"#4daf4a",
"#e41a1c"
]);
const stackedData = d3.stack().offset(d3.stackOffsetWiggle).order(d3.stackOrderNone).keys(subgroups)(data);
const flatData = stackedData.flat(2);
y.domain(d3.extent(flatData));
svg
.append("g")
.selectAll("g")
.data(stackedData)
.join("g")
.attr("fill", (d) => color(d.key))
.selectAll("rect")
.data((d) => d)
.join("rect")
.attr("x", (d) => x(d.data.Time))
.attr("y", (d) => y(d[1]))
.attr("height", (d) => y(d[0]) - y(d[1]))
.attr("width", x.bandwidth());
svg
.append("g")
.attr("transform", `translate(0,${margin.top + (height - margin.bottom)/2})`)
.call(d3.axisBottom(x));
let legendGroup = svg
.selectAll(".legend-group")
.data(subgroups)
.join("g")
.attr("class", "legend-group");
legendGroup
.append("circle")
.attr("cx", (d, i) => 10 + i * 75)
.attr("cy", 10)
.attr("r", 3)
.attr("fill", (d, i) => color(i));
legendGroup
.append("text")
.attr("x", (d, i) => 20 + i * 75)
.attr("y", 15)
.text((d, i) => subgroups[i]);
</script>
</body>
</html>
```
| null | CC BY-SA 4.0 | null | 2022-12-15T03:24:49.270 | 2022-12-29T03:24:35.127 | 2022-12-29T03:24:35.127 | 5,768,908 | 5,768,908 | null |
74,807,105 | 2 | null | 37,169,153 | 0 | null | I was facing the similar issue, the size of my request body was also huge so along with updating content-type as application/json, i gave content encoding as utf-8 and it worked perfectly fine.
[](https://i.stack.imgur.com/MUZR3.png)
| null | CC BY-SA 4.0 | null | 2022-12-15T05:21:06.830 | 2022-12-15T05:21:06.830 | null | null | 8,744,591 | null |
74,807,319 | 2 | null | 74,807,114 | 0 | null | for that you have to make custom and give click event to parent layout button(try this code it will work for you)
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/value_40"
android:background="@color/text1">
<TextView
android:id="@+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:textColor="@color/white"
android:layout_centerInParent="true"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cross"
android:layout_toRightOf="@+id/tv1"
android:layout_centerVertical="true"
android:layout_marginStart="5dp"/>
</RelativeLayout>
</LinearLayout>
```
| null | CC BY-SA 4.0 | null | 2022-12-15T05:53:16.753 | 2022-12-15T05:58:58.910 | 2022-12-15T05:58:58.910 | 13,387,235 | 13,387,235 | null |
74,807,323 | 2 | null | 74,807,298 | 0 | null | ```
contentPadding: EdgeInsets.all(0.0),
isDense: true,
```
add the above lines in your `TextFormField`
| null | CC BY-SA 4.0 | null | 2022-12-15T05:53:37.313 | 2022-12-15T06:25:19.170 | 2022-12-15T06:25:19.170 | 5,197,712 | 8,480,069 | null |
74,807,414 | 2 | null | 74,805,740 | 1 | null | While I am not sure how this problem was solved, it’s seems restarting my machine finally gave me the desired outcome.
| null | CC BY-SA 4.0 | null | 2022-12-15T06:05:07.967 | 2022-12-18T14:08:21.523 | 2022-12-18T14:08:21.523 | 8,708,364 | 8,088,657 | null |
74,807,679 | 2 | null | 74,807,644 | 1 | null | in your html:
```
<div id="footer">some elements here</div>
```
and in your css:
```
#footer {
position: fixed;
width: 100%;
bottom: 0;
}
```
| null | CC BY-SA 4.0 | null | 2022-12-15T06:42:06.323 | 2022-12-15T06:42:06.323 | null | null | 743,086 | null |
74,807,689 | 2 | null | 74,803,422 | 0 | null | Jessehouwing is right. You will be charged for the parallel job based on the days you used it during the billing cycle. You could arrange your `Paid Parallel jobs` number in billing page dynamically based on your daily workload.
According to this document for [Purchasing Parallel Jobs](https://learn.microsoft.com/en-us/azure/devops/pipelines/licensing/concurrent-jobs?view=azure-devops&tabs=ms-hosted), you will be charged by `Paid jobs` number in pic below. Disabling the agent machine from agent pool could not stop it from being charged. `When you disable the agent`, you are just prevent the parallel job from being used, the only method to stop being charged for parallel job is cutting off the `Paid parallel jobs` in billing page.
[](https://i.stack.imgur.com/fP9W0.png)
If you have concern on the expense of parallel jobs. You could check the [Service Pricing](https://azure.microsoft.com/en-us/pricing/details/devops/azure-devops-services/) for your parallel jobs allocation.
[](https://i.stack.imgur.com/qgzub.png)
| null | CC BY-SA 4.0 | null | 2022-12-15T06:43:27.503 | 2022-12-15T07:13:06.117 | 2022-12-15T07:13:06.117 | 18,361,074 | 18,361,074 | null |
74,807,710 | 2 | null | 74,807,624 | 1 | null | The first few lines of your _AllNotesScreenState class are why there's a yellow square; that's what you're telling it to build.
```
class _AllNotesScreenState extends State<AllNotesScreen> {
// this build function here is what is drawing to the screen
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child:
Container(
height: 200,
width: 100,
color: Colors.yellow,
),
),
);
}
```
Maybe it's just how you've pasted it in, but it appears as though you have a build function defined within the didChangeDependencies function. If you took it out of there, it would then make it apparent that you have two `build` functions defined for the class.
I'm assuming it's the second one that you want building.
```
@override
void didChangeDependencies() {
super.didChangeDependencies();
Future _loadViewMode() async {
final prefs = await SharedPreferences.getInstance();
if (!prefs.containsKey('view-mode')) return;
setState(() {
_viewMode = prefs.getString('view-mode') ?? ViewMode.staggeredGrid.name;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
...
```
| null | CC BY-SA 4.0 | null | 2022-12-15T06:46:05.517 | 2022-12-15T06:46:05.517 | null | null | 2,927,226 | null |
74,807,739 | 2 | null | 74,807,059 | 0 | null | You need to use `aes` to map your variable `y` to the height of the text:
```
myplot <- ggplot(data = dfx, aes(x=treat)) +
geom_bar(aes(y = persons, fill = eaten), stat = 'identity', position = 'dodge') +
geom_text(data = dfx[dfx$eaten == "Yes", ], aes(y = persons, label = risk))
myplot
```
[](https://i.stack.imgur.com/QLcQ4.png)
There is a slightly cleaner way to use a subset of your main dataset within an individual geom but I can't remember it right now and Google is letting me down!
Your previous code only worked at all by chance because `persons` existed in the parent environment as well as the data frame `dfx`.
| null | CC BY-SA 4.0 | null | 2022-12-15T06:49:33.750 | 2022-12-15T06:49:33.750 | null | null | 12,176,280 | null |
74,808,149 | 2 | null | 74,191,324 | 11 | null |
## Rationale
To expand on the existing answers, the [release notes for Material Components for Android 1.7.0](https://github.com/material-components/material-components-android/releases/tag/1.7.0) mentions that they have updated the minimum requirements for your project (emphasis mine):
>
### New minimum requirements for your app's project:
- [Android Gradle Plugin (AGP) version 7.2.0](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle)- [Gradle version 7.3.3](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle)- [Java 8 (version 1.8)](https://developer.android.com/studio/write/java8-support#supported_features)- [Android Studio Chipmunk, version 2021.2.1](https://developer.android.com/studio/releases/gradle-plugin#agp-studio-compatibility)
This is also mentioned in their [(updated)](https://github.com/material-components/material-components-android/commit/cdc781dde60cc1cf04e0e538f0e5a823f10d5554) [Getting Started guide](https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md#5-gradle-agp-and-android-studio) (again, emphasis mine):
>
### 5. Gradle, AGP, and Android Studio
When using MDC-Android version `1.7.0-alpha02` and above, you will need to make sure your project is built with the following minimum requirements, `macro`:- [Gradle version 7.3.3](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle)- [Android Gradle Plugin (AGP) version 7.2.0](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle)- [Android Studio Chipmunk, version 2021.2.1](https://developer.android.com/studio/releases/gradle-plugin#android_gradle_plugin_and_android_studio_compatibility)
## Updating the Android Gradle Plugin
You can update the Android Gradle plugin as follows:
### Gradle plugins DSL
The plugin declaration can be found in the top-level `build.gradle`/`build.gradle.kts` file:
```
plugins {
// Or "com.android.library"
id("com.android.application") version "7.2.2" apply false
}
```
### Buildscript classpath
Update the AGP `classpath` dependency (usually in the top-level `build.gradle`/`build.gradle.kts` file):
```
classpath("com.android.tools.build:gradle:7.2.2")
```
| null | CC BY-SA 4.0 | null | 2022-12-15T07:33:44.617 | 2022-12-15T07:41:13.180 | 2022-12-15T07:41:13.180 | 6,782,707 | 6,782,707 | null |
74,808,441 | 2 | null | 74,808,189 | 0 | null | One option would be to do this in two steps using `pivot_longer` first, then do a `pivot_wider`:
```
library(tidyr)
library(dplyr)
df %>%
rename(code1 = code) %>%
pivot_longer(-code1,
names_to = c("name", ".value"),
names_pattern = "^(.)(.*)$"
) %>%
select(-name) %>%
pivot_wider(
names_from = code,
values_from = c(saved, cost),
names_glue = c("{code}_{.value}")
) %>%
rename(code = code1)
#> # A tibble: 8 × 11
#> code el_saved e1_sa…¹ e2_sa…² e3_sa…³ ng_sa…⁴ el_cost e1_cost e2_cost e3_cost
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 A1 10 10 10 NA NA 20 20 20 NA
#> 2 A2 10 NA 10 10 NA 20 NA 20 20
#> 3 A3 NA 10 10 NA 10 NA 30 30 NA
#> 4 A4 10 10 10 NA NA 25 25 25 NA
#> 5 B1 NA NA 10 10 10 NA NA 34 34
#> 6 B2 10 NA 10 10 NA 25 NA 25 25
#> 7 B3 10 NA 10 10 NA 30 NA 30 30
#> 8 B4 10 10 NA 10 NA 20 20 NA 20
#> # … with 1 more variable: ng_cost <dbl>, and abbreviated variable names
#> # ¹e1_saved, ²e2_saved, ³e3_saved, ⁴ng_saved
```
| null | CC BY-SA 4.0 | null | 2022-12-15T08:01:07.217 | 2022-12-15T08:24:26.207 | 2022-12-15T08:24:26.207 | 12,993,861 | 12,993,861 | null |
74,808,532 | 2 | null | 45,309,447 | 0 | null | The `arr.sort()` method sorts the elements of an array in place and returns the array. By default, it sorts the elements alphabetically, so if the array contains numbers, they will not be sorted in numerical order.
On the other hand, the `arr.sort((a, b) => a - b)` method uses a callback function to specify how the array should be sorted. The callback function compares the two elements `a` and `b` and returns a negative number if a should be sorted before `b`, a positive number if `b` should be sorted before `a`, and zero if the elements are equal. In this case, the callback function subtracts `b` from `a`, which results in a sorting order that is numerical in ascending order.
So, if you want to sort an array of numbers in ascending order, you should use `arr.sort((a, b) => a - b)`, whereas if you want to sort an array of strings alphabetically, you can use `arr.sort()`:
```
function median(numbers) {
const sorted = Array.from(numbers).sort((a, b) => a - b);
const middle = Math.floor(sorted.length / 2);
if (sorted.length % 2 === 0) {
return (sorted[middle - 1] + sorted[middle]) / 2;
}
return sorted[middle];
}
```
| null | CC BY-SA 4.0 | null | 2022-12-15T08:10:59.797 | 2022-12-18T10:22:38.327 | 2022-12-18T10:22:38.327 | 17,195,992 | 15,913,029 | null |
74,808,544 | 2 | null | 73,522,146 | 0 | null | [use monaco-editor as an npm package](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package)
Starting from version v4.4.0 it's possible to use monaco-editor as an npm package; import it from node_modules and include monaco sources into your bundle (instead of using CDN). To make it work you can do the following:
```
import { loader } from "@monaco-editor/react";
import * as monaco from "monaco-editor";
loader.config({ monaco });
```
| null | CC BY-SA 4.0 | null | 2022-12-15T08:12:16.803 | 2022-12-15T08:12:16.803 | null | null | 14,039,878 | null |
74,808,800 | 2 | null | 74,808,549 | 3 | null | It is restoring the filter context.
```
'Product Category'[Category] = "Audio"
```
is internally rewritten as
```
ALL( 'Product Category'[Category]) = "Audio"
```
which destroys the filter context and gives you the same value for every row. VALUES() then restores the filter on Category.
| null | CC BY-SA 4.0 | null | 2022-12-15T08:38:19.330 | 2022-12-15T08:50:19.203 | 2022-12-15T08:50:19.203 | 18,345,037 | 18,345,037 | null |
74,808,849 | 2 | null | 74,808,711 | 0 | null | Change source to this:
```
source: "qrc:/Images/empty.png"
```
| null | CC BY-SA 4.0 | null | 2022-12-15T08:43:13.980 | 2022-12-15T08:43:13.980 | null | null | 20,623,573 | null |
74,808,884 | 2 | null | 11,151,945 | 0 | null | There are two pitfalls when implement unix domain socket using NDK.
1. Tha abstract name: The Android “LocalServerSocket(String name)” the document suggest that
> Creates a new server socket listening at specified name.
This name is the Linux's abstract namespace for Unix domain sockets. You can checkout the current opened unix socket by using the command:
```
cat /proc/net/unix
```
> $ cat /proc/net/unix
0000000000000000: 00000002 00000000 00010000 0001 01 8451293 @stetho_com.xxxx:channel_devtools_remote
You can see that the abstract name is start with a "@". So you need to have to do some convert operation before connecting to the LocalServerSocket.
1. When you use connect method in c, you should watch out for the address length. It is the size of the address is the offset of the start of the filename, plus its length (not including the terminating null byte).
```
/* Bind a name to the socket. */
name.sun_family = AF_LOCAL;
strncpy (name.sun_path, filename, sizeof (name.sun_path));
name.sun_path[sizeof (name.sun_path) - 1] = '\0';
/* The size of the address is
the offset of the start of the filename,
plus its length (not including the terminating null byte).
Alternatively you can just do:
size = SUN_LEN (&name);
*/
size = (offsetof (struct sockaddr_un, sun_path)
+ strlen (name.sun_path));
```
You can checkout the full example [here](https://www.gnu.org/software/libc/manual/html_node/Local-Socket-Example.html)
| null | CC BY-SA 4.0 | null | 2022-12-15T08:45:44.300 | 2022-12-15T08:45:44.300 | null | null | 2,930,568 | null |
74,809,662 | 2 | null | 74,798,992 | 0 | null | There's no method called `loadExtensionAsync` in the viewer API. You can use the [loadExtension](https://aps.autodesk.com/en/docs/viewer/v7/reference/Viewing/Viewer3D/#loadextension-extensionid-options) method which is also asynchronous (so you can `await` it), or [getExtension](https://aps.autodesk.com/en/docs/viewer/v7/reference/Viewing/Viewer3D/#getextension-extensionid-callback) if the extension was already loaded before.
Also, please note that we have recently updated our DataViz demo, [https://aps-iot-extensions-demo.autodesk.io](https://aps-iot-extensions-demo.autodesk.io), and you can find its source code here: [https://github.com/autodesk-platform-services/aps-iot-extensions-demo](https://github.com/autodesk-platform-services/aps-iot-extensions-demo).
| null | CC BY-SA 4.0 | null | 2022-12-15T09:53:19.150 | 2022-12-15T09:53:19.150 | null | null | 1,759,915 | null |
74,809,688 | 2 | null | 74,798,992 | 0 | null | According to the [Viewer Documentation](https://aps.autodesk.com/en/docs/viewer/v7/reference/Viewing/GuiViewer3D/), `viewer.loadExtensionAsync()` does not exist. You must use `viewer.loadExtension(extensionId)`.
As the return type is a , this function is so you should the result like that :
```
const dataVizExt = await viewer.loadExtension("Autodesk.DataVisualization");
```
Another way of doing this, is adding the "Autodesk.DataVisualization" extension in the options of the Viewer when creating the Viewer instance :
```
const config = {
extensions : [
"Autodesk.DataVisualization"
]
};
let viewer = new Autodesk.Viewing.Viewer3D(document.getElementById('forgeviewer'), config);
```
Then you should be able to get the extension like that :
```
const dataVizExt = await viewer.getExtensionAsync("Autodesk.DataVisualization");
```
or
```
var dataVizExt;
viewer.getExtension("Autodesk.DataVisualization", (ext)=>{
dataVizExt = ext;
});
```
| null | CC BY-SA 4.0 | null | 2022-12-15T09:55:15.830 | 2022-12-15T09:55:15.830 | null | null | 9,365,707 | null |
74,809,719 | 2 | null | 74,809,403 | 0 | null | i think you are missing this one. run this command and then `flutter clean && flutter pub && flutter run`
```
sudo apt install curl file git unzip xz-utils zip libglu1-mesa clang cmake \
ninja-build pkg-config libgtk-3-dev
```
if you still facing issue you have to folow these steps [here](https://www.how2shout.com/linux/2-ways-to-install-flutter-on-ubuntu-20-04-18-04-21-04-linux/) to reinstall flutter on `Ubuntu` `20.04 |18.04 | 21.04` `Linux`
| null | CC BY-SA 4.0 | null | 2022-12-15T09:57:35.030 | 2022-12-15T09:57:35.030 | null | null | 16,561,638 | null |
74,809,752 | 2 | null | 74,733,735 | 1 | null | I managed to find the solution, but no idea why. I found a comment somewhere (I believe : [pip: module installed as editable not found](https://stackoverflow.com/q/70148382/20716078)) that there is an issue in how some files are created when installing as editable.
More specifically, when installing as editable, two files are created :
> - -
both in the environment
> Miniconda3\envs\DLL_ETL\Lib\site-packages
When comparing two environments I have, I noticed that the .pth created in the one that broke was not formatted similarly, the .py didn't even exist. More specifically
[](https://i.stack.imgur.com/2CPJ9.jpg)
[](https://i.stack.imgur.com/ShPlG.jpg)
When creating the files manually, everything seems to work fine. I haven't tried to update since. Likely it's an issue with setuptools if I understand correctly.
| null | CC BY-SA 4.0 | null | 2022-12-15T10:00:32.177 | 2022-12-15T10:00:32.177 | null | null | 20,716,078 | null |
74,810,041 | 2 | null | 59,966,532 | 0 | null | There are multiple ways to reduce the margins of you `Chip`
```
Chip(
... your other props
visualDensity: VisualDensity.compact
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap
padding: EdgeInsets.zero, // Use this or labelPadding but not both
labelPadding: EdgeInsets.symmetric(horizontal: 4),
labelStyle: TextStyle(fontSize: 12) // You can reduce the font size for a smaller chip
)
```
| null | CC BY-SA 4.0 | null | 2022-12-15T10:23:57.917 | 2022-12-15T10:23:57.917 | null | null | 5,090,196 | null |
74,810,460 | 2 | null | 71,683,210 | 0 | null | On Windows you might have a problems with the default encoder; try it with a custom encoder:
[https://github.com/lexik/LexikJWTAuthenticationBundle/blob/v2.16.0/Resources/doc/5-encoder-service.rst](https://github.com/lexik/LexikJWTAuthenticationBundle/blob/v2.16.0/Resources/doc/5-encoder-service.rst)
| null | CC BY-SA 4.0 | null | 2022-12-15T10:59:40.683 | 2022-12-18T16:34:06.710 | 2022-12-18T16:34:06.710 | 355,754 | 20,783,675 | null |
74,810,521 | 2 | null | 74,810,152 | 2 | null | As already pointed in the comments
You probably want to move the turtle at thee end of the polygon, so the ends won't be connected
-
Looks like you need to calculate the radius offset and move in/out from the center if you want them all concentric. Currently you're always starting the first/last vertex at the same point.
-
After having a quick look in the [turtle methods](https://docs.python.org/3/library/turtle.html#turtle-methods)
I came up with this
```
import turtle
import math
tr = turtle.Turtle()
r0 = 20
tr.lt(150)
for x in range(3,13):
points = [
(r0 * (x-1) * math.cos(k*2*math.pi/x),
r0 * (x-1) * math.sin(k*2*math.pi/x))
for k in range(1,x+1)
]
tr.penup() # avoid creating a line connecting two polygons
tr.goto(*points[-1])
tr.pendown() # draw one polygon
for tx, ty in points:
tr.goto(tx,ty);
turtle.done()
```
[](https://i.stack.imgur.com/SBe6e.png)
PS.: I have never heard about this module before, and it was a surprise to see that it was installed in my machine.
| null | CC BY-SA 4.0 | null | 2022-12-15T11:04:30.720 | 2022-12-15T11:35:39.020 | 2022-12-15T11:35:39.020 | 12,750,353 | 12,750,353 | null |
74,810,771 | 2 | null | 74,809,130 | 0 | null | Not sure it's due to Magical Layout, unless they have implemented a special treatment for ints.
Anyway, the solution is to customize the "theme" yourself:
open the theme customization panel (e.g. by clicking the Theme icon).
Now two trees are displayed on the left, representing (top) the signature hierarchy and (bottom) all relations in your model: click there on `socketId` and then, at the top of the left panel, tick "Show as attribute" and untick "Show as arc", then apply your new theme by clicking Apply (top right), then click Close to close theme customization.
| null | CC BY-SA 4.0 | null | 2022-12-15T11:25:10.710 | 2022-12-15T11:25:10.710 | null | null | 4,459,114 | null |
74,810,933 | 2 | null | 54,798,696 | 1 | null | I know I'm a bit late to the party but for anyone else looking, you can enable case sensitivity, so if you want to return a column with camel casing for example
```
SET enable_case_sensitive_identifier TO true;
```
Then in your query wrap what you want to return the column as in double quotes
```
SELECT column AS "thisName"
```
Or as per OP's example
```
SELECT a.event_date AS "Event Date"
```
[https://docs.aws.amazon.com/redshift/latest/dg/r_enable_case_sensitive_identifier.html](https://docs.aws.amazon.com/redshift/latest/dg/r_enable_case_sensitive_identifier.html)
Edit: To have this behaviour as default for the cluster you will need to create/update a parameter group in Configurations => Workload Management. You can't change the settings for the default parameter group. Note, you will need to reboot the cluster after applying the parameter group for the changes to take effect.
| null | CC BY-SA 4.0 | null | 2022-12-15T11:38:43.813 | 2022-12-16T13:19:29.280 | 2022-12-16T13:19:29.280 | 11,370,349 | 11,370,349 | null |
74,810,957 | 2 | null | 29,593,251 | 0 | null | For all the people who are having issues converting .trx files generated on new Visual Studio versions above 2015. I have created a new release to fix the unhandled exception (System.ArgumentOutOfRangeException) and transform .trx files generated up to Visual Studio 2022:
The link to the release: [https://github.com/gorkalertxundi/trxer/releases/tag/vsstudio-2022](https://github.com/gorkalertxundi/trxer/releases/tag/vsstudio-2022)
| null | CC BY-SA 4.0 | null | 2022-12-15T11:40:47.247 | 2022-12-15T11:40:47.247 | null | null | 14,836,478 | null |
74,811,186 | 2 | null | 74,810,669 | 0 | null | You need to link the pseudo decorator with the div to apply the style.
It means the vertical thumb is from the body or HTML tag. And the horizontal thumb is for an inner div.
```
#bars-chart-container::-webkit-scrollbar {
width: 7px;
}
#bars-chart-container
::-webkit-scrollbar-thumb:horizontal {
border-radius: 8px;
background-color: rgba(92, 92, 92, 0.5);
}
```
This probably won't prevent the vertical thumb of the inner div will disappear, but so far I see in your images, you don't need to show that. And I don't see that could be in another way.
| null | CC BY-SA 4.0 | null | 2022-12-15T12:01:10.900 | 2022-12-20T14:41:32.393 | 2022-12-20T14:41:32.393 | 10,906,012 | 10,906,012 | null |
74,811,389 | 2 | null | 74,592,723 | 0 | null | You can define the variables by using code below
```
class M(tf.Module):
def __call__(self, x):
self.v = tf.Variable(x)
return self.v
```
Thank You.
| null | CC BY-SA 4.0 | null | 2022-12-15T12:17:59.373 | 2022-12-15T12:17:59.373 | null | null | 14,290,244 | null |
74,811,474 | 2 | null | 74,810,446 | 0 | null | Please check the doc to get access token - [https://learn.microsoft.com/en-us/graph/auth-v2-user](https://learn.microsoft.com/en-us/graph/auth-v2-user)
Hope this help
| null | CC BY-SA 4.0 | null | 2022-12-15T12:24:11.083 | 2022-12-15T12:24:11.083 | null | null | 18,106,676 | null |
74,811,821 | 2 | null | 68,342,427 | 3 | null | Just in case anyone gets this error for the same reason I did. I had built an image locally and Docker was complaining the image could not be found. It seems the error was happening because I built the image locally, but specified a different platform for `docker run` (I had copied the command from somewhere else). Example:
```
docker build -t my-image .
docker run ... --platform=linux/amd64 my-image
```
`linux/amd64` is not my current platform. So I removed this argument and it worked.
| null | CC BY-SA 4.0 | null | 2022-12-15T12:50:29.223 | 2022-12-15T12:50:29.223 | null | null | 4,734,782 | null |
74,812,072 | 2 | null | 23,193,614 | 1 | null | If your proxy config is fine, sometimes the problem can be a deprecated package-lock.json file, therefore it redirects to a non-existing artifactory, npm registry.
Try to delete the package-lock.json and try npm i again.
| null | CC BY-SA 4.0 | null | 2022-12-15T13:10:44.933 | 2022-12-15T13:10:44.933 | null | null | 11,851,132 | null |
74,812,227 | 2 | null | 74,811,851 | 0 | null | Hi [enesson](https://stackoverflow.com/users/11125111/enesson),
Be careful because you haven't read the names of the variables as its first line, that is, the `header` parameter. So, you will have to adapt the second line of this code to your data.
As you can see here, I used the `separate` function according to [this post](https://stackoverflow.com/questions/7069076/split-column-at-delimiter-in-data-frame). It may be useful for you!
```
library(tidyr)
df <- read.csv("your_data.csv", header = TRUE, sep = ";")
df1 <- separate(data = df, col = KUZEY, into = c("lat_degrees", "lat_minutes", "lat_seconds"), sep = ":")
df2 <- separate(data = df1, col = DOGU, into = c("lon_degrees", "lon_minutes", "lon_seconds"), sep = ":")
```
I hope this helps you
| null | CC BY-SA 4.0 | null | 2022-12-15T13:22:20.673 | 2022-12-15T13:22:20.673 | null | null | 20,649,000 | null |
74,812,282 | 2 | null | 74,812,221 | 0 | null | That seems correct. If you print something like `data.first.username`, you should get the name of the first User.
just means, that this is an Object of Type User.
| null | CC BY-SA 4.0 | null | 2022-12-15T13:27:22.573 | 2022-12-15T13:40:29.337 | 2022-12-15T13:40:29.337 | 10,157,127 | 20,775,522 | null |
74,812,523 | 2 | null | 74,810,669 | 0 | null | Here's an example on how to style horizontal scrollbar only:
[https://codepen.io/lmmm/pen/abKeEJw](https://codepen.io/lmmm/pen/abKeEJw)
You can use the element which you want to style, and use your rules as you want:
```
<div id="horizontal">
horizontal text that overflows
</div>
```
```
#horizontal::-webkit-scrollbar {
width: 7px;
}
#horizontal::-webkit-scrollbar-thumb:horizontal {
border-radius: 15px;
background-color: tomato;
}
```
| null | CC BY-SA 4.0 | null | 2022-12-15T13:45:10.403 | 2022-12-15T13:45:10.403 | null | null | 6,813,732 | null |
74,812,608 | 2 | null | 74,802,736 | 0 | null | This is a feature that the UI doesn't support, so you have to use the Advanced Editor.
But you can simply pass additional Tables to Python.Execute, eg
```
MainTable = ...,
RunPythonscript = Python.Execute(pythonScript,[dataset=MainTable, otherTable=OtherTable]),
```
And they will be available as additional pandas DataFrames in your script.
| null | CC BY-SA 4.0 | null | 2022-12-15T13:50:14.927 | 2022-12-15T13:50:14.927 | null | null | 7,297,700 | null |
74,812,682 | 2 | null | 74,804,827 | 2 | null | Another convenient model (exponential function) :
[](https://i.stack.imgur.com/acrPt.gif)
Method of fitting from [https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales](https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales)
| null | CC BY-SA 4.0 | null | 2022-12-15T13:55:52.737 | 2022-12-15T13:55:52.737 | null | null | 6,819,132 | null |
74,812,892 | 2 | null | 4,998,762 | 0 | null | For us the problem was that we had to use the standard Openjdk version not the alpine one. I assure you that all the other fixes don't work.
| null | CC BY-SA 4.0 | null | 2022-12-15T14:12:02.497 | 2022-12-15T14:12:02.497 | null | null | 8,881,946 | null |
74,813,318 | 2 | null | 74,812,863 | 0 | null | ok so (after you removed the duplicates) you would need to use `GroupBy` to aggregate the items with the same integer and sort them according to their occurence:
```
var groupedResult = non_community1
.GroupBy( s => int.Parse(Regex.Match(s, @"\d+").Value))
.OrderByDescending(k => k.Count()).ToList();
```
Now you need to go through each group and collect them in the final list.
> and I want to add "null" between the numbers that write 3 or more consecutive numbers.
For this you can check how many items are in each group if you have more than 2 items then add the `null` item.
```
List<string> finalList = new List<string>();
for ( int i = 0; i < groupedResult.Count; i++ )
{
finalList.AddRange(groupedResult[i]);
if(groupedResult[i].Count() > 2)
{
finalList.Add(null);
}
}
Console.WriteLine(string.Join(Environment.NewLine, finalList));
```
and you should have your [desired result](https://dotnetfiddle.net/N4oRl4)
| null | CC BY-SA 4.0 | null | 2022-12-15T14:46:21.463 | 2022-12-15T14:46:21.463 | null | null | 5,174,469 | null |
74,813,565 | 2 | null | 74,813,298 | 0 | null | As others already noted, a minimal dataset and a how the result looks like helps a lot.
From what I understood, the code below might give you some idea to move forward:
```
library(data.table)
w_n <- c(2,2,2,3,3,3)
phone <- c("s", "t", "r","ah", "z", "ah")
dt <- data.table(w_n, phone)
output <- dt[, paste0(phone |> unique(), collapse = "-")
, .(w_n)]
```
Else, if you want to append the result within your dataset, you might try:
```
dt[, output := paste0(phone |> unique(), collapse = "-")
, .(w_n)]
```
| null | CC BY-SA 4.0 | null | 2022-12-15T15:04:55.940 | 2022-12-15T15:04:55.940 | null | null | 9,262,044 | null |
74,813,700 | 2 | null | 30,413,843 | 1 | null | `Shapely` [library](https://pypi.org/project/shapely/) makes it quick.
Assuming you have points of contour and line:
```
from shapely.geometry import Polygon, LineString
poly = Polygon([(5,5), (10,10), (10,0)])
a = LineString([(0, 0), (8, 8)])
print(a.intersects(poly))
```
There are options to speed up the code. Not checked.
| null | CC BY-SA 4.0 | null | 2022-12-15T15:14:24.950 | 2022-12-15T15:14:24.950 | null | null | 10,184,783 | null |
74,813,748 | 2 | null | 14,487,322 | 1 | null | Shouldn´t this be an more efficient approach? (Don't iterating over the whole picture, just the desired square)
```
List<int> indices = new List<int>();
xmin = m1 - r;
xmax = m1 + r;
ymin = m2 - r;
ymax = m2 + r;
for (int x = xmin; x < xmax ; x++)
{
for (int y = ymin; y < ymax; y++)
{
double dx = x - m1;
double dy = y - m2;
double distanceSquared = dx * dx + dy * dy;
if (distanceSquared <= radiusSquared)
{
indices.Add(x + y * width);
}
}
}
```
| null | CC BY-SA 4.0 | null | 2022-12-15T15:18:31.237 | 2022-12-15T15:19:54.413 | 2022-12-15T15:19:54.413 | 20,785,757 | 20,785,757 | null |
74,813,944 | 2 | null | 74,812,767 | 1 | null | snx_wavelengths is JSON, right? And also you provided it as a picture and not text :( the data looks like (id, snx_wavelengths) - I believe you meant id saying index (not a good idea to use a keyword, would require identifier doublequotes):
```
1,[1,2,3,4]
2,[373,232,435,84]
```
If that is right:
```
select id, (stats_agg(v::float)).skewness
from myMeasures,
lateral json_array_elements_text(snx_wavelengths) v
group by id;
```
[DBFiddle demo](https://dbfiddle.uk/9m7Z9ERv)
BTW, you don't need "with data" in the original sample if you don't want to use and could replace with a subquery. ie:
```
select (stats_agg(n)).* from (select unnest(array[16,22,33,24,15])) data(n)
union all
select (stats_agg(n)).* from (select unnest(array[416,622,833,224,215])) data(n);
```
EDIT: And if you needed other stats too:
```
select id, "count","min","max","mean","variance","skewness","kurtosis"
from myMeasures,
lateral (select (stats_agg(v::float)).* from json_array_elements_text(snx_wavelengths) v) foo
group by id,"count","min","max","mean","variance","skewness","kurtosis";
```
[DBFiddle demo](https://dbfiddle.uk/oi13TGOm)
| null | CC BY-SA 4.0 | null | 2022-12-15T15:31:15.660 | 2022-12-15T15:43:43.580 | 2022-12-15T15:43:43.580 | 894,977 | 894,977 | null |
74,814,327 | 2 | null | 74,601,310 | 0 | null | One way to do this could be :
```
//div[text()="Top Gainers"]/ancestor::div[2]//div[@class][./img]/div[@title]/@title
```
or
```
//div[text()="Top Gainers"]/ancestor::div[2]//div[@class][./img]/div[@title]/text()
```
Output : 10 items
URL used : [https://www.binance.com/en/markets/overview/topmovers](https://www.binance.com/en/markets/overview/topmovers)
| null | CC BY-SA 4.0 | null | 2022-12-15T15:58:50.180 | 2022-12-15T15:58:50.180 | null | null | 9,978,746 | null |
74,814,503 | 2 | null | 74,808,549 | 0 | null | That behaviour is because, `VALUES( 'Product Category'[Category])` With filter as `'Product Category'[Category] = "Audio"` is resulting only in table with "Audio" in the category field and when your CALCULATE measure is trying to calculate the values for other categories like cameras,cellphones etc (which are not present) in the table, Hence they are shown as blank.
| null | CC BY-SA 4.0 | null | 2022-12-15T16:13:01.423 | 2022-12-15T16:13:01.423 | null | null | 6,465,044 | null |
74,814,501 | 2 | null | 74,813,057 | 0 | null | ```
var abc = await AsyncStorage.getItem('ProductData');
```
add await as it is promise that all
so whole code will look like this
```
onPress={async () => {
press = item.id;
// console.warn(press);
ars = options;
dd = JSON.stringify(ars);
cc = JSON.parse(dd);
for (var i = 0; i < cc.length; i++) {
if (cc[i].id == press) {
// console.warn(cc[i]);
var productData = cc[i];
var stri = JSON.stringify(cc[i]);
AsyncStorage.setItem('ProductData', stri);
var abc =await AsyncStorage.getItem('ProductData');
console.warn(stri);
console.warn(abc);
}
}
}}>
```
add async to function and add await
| null | CC BY-SA 4.0 | null | 2022-12-15T16:12:53.613 | 2022-12-15T16:12:53.613 | null | null | 14,399,359 | null |
74,814,936 | 2 | null | 74,813,981 | 1 | null | My initial thoughts are that you're tracking the state of the check for each checkbox independently in each card. If that's the case, then it can't possibly know if others are being checked, because each individual card has its own `checkedState`.
There are a few approaches you can use to fix it, but I think the easiest one for you is to handle the checkedState logic inside the parent component using a function that you later pass into the props for each Card. Then you can directly pass that prop as the onChange handler for each checkbox.
Then I would move the "Solicitar Orçamento" button to be in the parent component.
Parent:
```
function PopupOrcamentoSimultaneo({ setOpenPopup }) {
// Other code
let testID = profissionalID.idProfissional;
let cardsProfissionais = profissionais;
let listaCardsProfissionais = [];
const found = cardsProfissionais.find((obj) => obj.idProfissional == testID);
const foundSegmento = found?.segmento;
const [checkedState, setCheckedState] = useState({});
const handleOnChange = (e) => {
setCheckedState((p) => ({ ...p, [e.target.name]: e.target.checked }));
};
for (let i = 0; i < cardsProfissionais.length; i++) {
if (cardsProfissionais[i].segmento == foundSegmento) {
listaCardsProfissionais.push(
<Card key={i} dadosProfissionais={cardsProfissionais[i]} handleOnChange={handleOnChange} />
);
if (listaCardsProfissionais.length == 4) {
break;
}
}
}
// ... other code
return (
<div className="popup">
<div className="popup__container">
<div className="close-container" onClick={() => setOpenPopup(false)}>
<i className="fa-solid fa-xmark"></i>
</div>
<h2 className="popup__titulo">
Profissionais desse segmento recomendados para você.
</h2>
<div className="cards__profissionais">{listaCardsProfissionais}</div>
<div className="input-box">
<label for="input" className="input-label">
Escreva sua mensagem
</label>
<div>
<input
type="text"
id="input"
className="input-text"
placeholder="Olá! Vamos nos casar e gostaríamos de mais informações sobre seu serviço."
value={value}
onChange={changeValue}
/>
<i className="fa-solid fa-pencil"></i>
</div>
<button type="submit" className="botao-orcamento">
Solicitar Orçamento (
{Object.keys(checkedState).filter((i) => checkedState[i]).length})
</button>
</div>
</div>
</div>
);
}
```
Child
```
function Card(props) {
// Other code
return (
<>
// Other Code
<div className="checkbox">
<label className="checkbox-label">
Orçamento
<input
/* Other props */
onChange={props.handleOnChange}
/>
<span className="checkmark"></span>
</label>
</div>
</div>
</div>
</>
);
}
```
You might need to mess around with your CSS a bit to get it looking right, but this should correct your logic.
| null | CC BY-SA 4.0 | null | 2022-12-15T16:48:31.010 | 2022-12-15T16:48:31.010 | null | null | 6,237,381 | null |
74,815,242 | 2 | null | 74,814,259 | 1 | null | What you're asking for is called . I'll demonstrate using `mtcars` as the data, `cyl` as the grouping variable (your `room_type`, I suspect), and other columns with `NA` values.
```
mt <- mtcars
set.seed(42)
mt$disp[sample(32,10)] <- NA
mt$hp[sample(32,10)] <- NA
head(mt)
# mpg cyl disp hp drat wt qsec vs am gear carb
# Mazda RX4 21.0 6 NA 110 3.90 2.620 16.46 0 1 4 4
# Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
# Datsun 710 22.8 4 108 NA 3.85 2.320 18.61 1 1 4 1
# Hornet 4 Drive 21.4 6 NA NA 3.08 3.215 19.44 1 0 3 1
# Hornet Sportabout 18.7 8 NA NA 3.15 3.440 17.02 0 0 3 2
# Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
```
From here:
# dplyr
```
library(dplyr)
set.seed(42)
mt %>%
group_by(cyl) %>%
mutate(across(c(disp, hp), ~ coalesce(., sample(na.omit(.), size=n(), replace=TRUE)))) %>%
ungroup()
# # A tibble: 32 × 11
# mpg cyl disp hp drat wt qsec vs am gear carb
# <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
# 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4
# 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4
# 3 22.8 4 108 91 3.85 2.32 18.6 1 1 4 1
# 4 21.4 6 145 110 3.08 3.22 19.4 1 0 3 1
# 5 18.7 8 301 180 3.15 3.44 17.0 0 0 3 2
# 6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1
# 7 14.3 8 301 245 3.21 3.57 15.8 0 0 3 4
# 8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2
# 9 22.8 4 141. 52 3.92 3.15 22.9 1 0 4 2
# 10 19.2 6 225 123 3.92 3.44 18.3 1 0 4 4
# # … with 22 more rows
```
# data.table
```
library(data.table)
cols <- c("disp", "hp")
set.seed(42)
as.data.table(mt)[, c(cols) := lapply(.SD, \(z) fcoalesce(z, sample(na.omit(z), size=.N, replace=TRUE))), .SDcols = cols][] |>
head()
>
# mpg cyl disp hp drat wt qsec vs am gear carb
# <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
# 1: 21.0 6 79.0 110 3.90 2.620 16.46 0 1 4 4
# 2: 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
# 3: 22.8 4 108.0 113 3.85 2.320 18.61 1 1 4 1
# 4: 21.4 6 460.0 97 3.08 3.215 19.44 1 0 3 1
# 5: 18.7 8 146.7 62 3.15 3.440 17.02 0 0 3 2
# 6: 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
```
# base R
```
set.seed(42)
mt[cols] <- lapply(mt[cols], \(z) ave(z, mt$cyl, FUN = \(z) ifelse(is.na(z), sample(na.omit(z), size=length(z), replace=TRUE), z)))
head(mt)
# mpg cyl disp hp drat wt qsec vs am gear carb
# Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
# Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
# Datsun 710 22.8 4 108 91 3.85 2.320 18.61 1 1 4 1
# Hornet 4 Drive 21.4 6 145 110 3.08 3.215 19.44 1 0 3 1
# Hornet Sportabout 18.7 8 301 180 3.15 3.440 17.02 0 0 3 2
# Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
```
---
Note: while I set the random seed for imputation in each dialect, there is no expectation that the order of columns and fixes will be the same between the dialects. For this reason we see that the replacement for the `NA` values is not the same between the dialects of code; the seed is provided for basic reproducibility, not identical results.
| null | CC BY-SA 4.0 | null | 2022-12-15T17:13:18.210 | 2022-12-15T17:13:18.210 | null | null | 3,358,272 | null |
74,815,963 | 2 | null | 24,769,379 | 1 | null | I know this is an old post, but for the sake of posterity, I'm posting my issue/fix (as it wasn't mentioned above) for anyone else who may run into it.
```
[HttpGet]
[Route("writebacks/{clientguid}/")]
public List<WritebackInfo> GetWritebacks(string clientiguid) {
return null;
}
```
This was my method that wasn't working, even though other methods on the same controller were (eliminating reference versions, or other project level resolutions).
Note the spelling mistake in the parameter in the actual argument list.
> `clientiguid` instead of `clientguid`
Fixed that, and it worked. Obviously a mistake, but not so obvious it was, from the error message, not at first read anyway.
Live and learn.
| null | CC BY-SA 4.0 | null | 2022-12-15T18:24:25.393 | 2022-12-15T18:24:25.393 | null | null | 80,209 | null |
74,816,086 | 2 | null | 74,810,620 | 0 | null | I am not sure if plotly explicitly allows you to do what you want – I believe the multiindex is interpreted by plotly as numerical x-coordinates, and that the multiindex is displayed over it so plotly doesn't really "understand" the multiindex numbering system you have.
One possibility I can suggest is an ugly hack – you first need to `pip install -U kaleido` and then can retrieve the default xaxis range that plotly is using with:
```
x_min, x_max = fig.full_figure_for_development().layout.xaxis.range
```
`x_min` and `x_max` turn out to be equal to `-0.3213166144200627` and `5.321316614420063`, respectively. Then you can find the spacing between each tick with:
```
tick_spacing = (x_max - x_min) / 6
```
I've hardcoded division by 6, but you can make this solution less brittle by dividing by the number of unique multi-indices you have in your data.
And then add or subtract multiples of this `tick_spacing` to x_min and x_max. For example:
```
fig.update_xaxes(range=[x_min + tick_spacing, x_max - tick_spacing])
```
[](https://i.stack.imgur.com/tQlf9.png)
| null | CC BY-SA 4.0 | null | 2022-12-15T18:37:27.303 | 2022-12-15T18:37:27.303 | null | null | 5,327,068 | null |
74,816,203 | 2 | null | 74,808,711 | 0 | null | You have 2 options. The first option would include to create a *.qrc file which contains all the assets and the assets/images are part of the project folder in some way.
```
<RCC>
<qresource prefix="/">
<file>images/infinity.svg</file>
<file>images/lockOff.svg</file>
<file>images/search.svg</file>
</qresource>
</RCC>
```
In this case you can use "relative" paths and also define your own names for files via aliases. Have a look at the [documentation](https://doc.qt.io/qt-6/resources.html#prefixes).
```
Image {
source: "qrc:/images/infinity.svg"
}
```
To make that work the build system needs to process the resource file. Have a look [here](https://doc.qt.io/qt-6/resources.html#cmake). For CMake you need to set `CMAKE_AUTORCC` to `true` and add the *.qrc file to `qt_add_executable()`
The second option would be to use the absolute path prefixed with `file://`. Sometimes you need to use `Qt.resolveUrl()` ([documentation](https://doc.qt.io/qt-6/qml-qtqml-qt.html#resolvedUrl-method)) to make it work.
```
Image {
source: "file://<absolute path to image>/images/infinity.svg"
}
```
I can't really explain why `qrc:/...` is working and `:/...` is not. It might be because the `source` property of `Image` is a `url` and the [documentation](https://doc.qt.io/qt-6/resources.html#runtime-api) says the following:
> You can also reference the Qt resource system through a QUrl. Use the
qrc scheme in this case.
| null | CC BY-SA 4.0 | null | 2022-12-15T18:49:21.267 | 2022-12-15T18:49:21.267 | null | null | 525,038 | null |
74,816,478 | 2 | null | 74,815,418 | 2 | null | Look in your `DongphuocDbContext` to see if a `View_XeQuaTramReport` collection is already defined there. If so, the following may do what you need:
```
DateTime start = ...
DateTime end = ...
var Result = _context.View_XeQuaTramReport
.Where(item => item.NgayCa >= start && item.NgayCa <= end) // Date arithmetic, not text
.GroupBy(item => new {item.Loaive, item.Loaixe, item.Phi}) // Multi-value key
.Select(grp => new {
Loaive = grp.Key.Loaive,
Loaixe = grp.Key.Loaixe,
Tongxe = grp.Count(),
Tongphi = grp.Sum(item => item.Phi),
Phi = grp.Key.Phi
})
.ToList();
```
A side note regarding your original query: You should never do date comparisons by converting the dates to text (as in `Convert(varchar(10),NgayCa,111)`). Instead, learn how to parameterize your queries, passing `start` and `end` in as proper `DATE/DATETIME/DATETIME2` types and perform direct date-to-date comparisons. This is critical for database efficiency, because if you had an index on NgayCa (you likely should), this index would become useless if you do string comparisons instead of date comparisons.
| null | CC BY-SA 4.0 | null | 2022-12-15T19:15:34.503 | 2022-12-16T07:42:10.553 | 2022-12-16T07:42:10.553 | 134,204 | 12,637,193 | null |
74,816,750 | 2 | null | 74,815,583 | 1 | null | Your style:
```
with wTable as (
SELECT nameID, name, concat(group_concat( Titleid order by nameID), ",") gc -- Additional coma at the end will ensure you no errors when you will have less than 4 values per nameID
FROM Person
inner join KnownForTitles using (nameid)
group by nameID, name
)
select nameID, name,
substring_index(gc, ",", 1) KnownForTitles1,
replace(substring_index(gc, ",", 2), concat(substring_index(gc, ",", 1), ","), "") KnownForTitles2,
replace(substring_index(gc, ",", 3), concat(substring_index(gc, ",", 2), ","), "") KnownForTitles3,
replace(substring_index(gc, ",", 4), concat(substring_index(gc, ",", 3), ","), "") KnownForTitles4
from wTable;
```
However, this one looks like cleaner:
```
with wTable as (
SELECT nameID, name, Titleid,
ROW_NUMBER() OVER(PARTITION BY nameID, name order by Titleid) AS rn
FROM Person
inner join KnownForTitles using (nameid)
)
select nameID, name,
min(case when rn = 1 then Titleid end) as KnownForTitles1,
min(case when rn = 2 then Titleid end) as KnownForTitles2,
min(case when rn = 3 then Titleid end) as KnownForTitles3,
min(case when rn = 4 then Titleid end) as KnownForTitles4
from wTable
group by nameID, name;
```
| null | CC BY-SA 4.0 | null | 2022-12-15T19:42:05.487 | 2022-12-15T19:54:31.140 | 2022-12-15T19:54:31.140 | 20,786,240 | 20,786,240 | null |
74,816,776 | 2 | null | 10,501,488 | 1 | null | Using clip path this can be done .
```
let precision = 64;
let radius = 50;
let c = [...Array(precision)].map((_, i) => {
let a = -i/(precision-1)*Math.PI*2;
let x = Math.cos(a)*radius + 100;
let y = Math.sin(a)*radius + 50;
return `${x}% ${y}%`
})
document.querySelector('.circleContainer').style.clipPath =
`polygon(100% 50%, 100% 100%, 0 100%, 0 0, 100% 0, 100% 50%, ${c.join(',')})`;
```
```
.container{
display: flex;
position: relative;
width: 200px;
}
.left{
background: blue;
width: 100px;
height: 100px;
border-top-left-radius: 50%;
border-bottom-left-radius: 50%;
}
.circleContainer {
background: blue;
width: 100px;
height: 100px;
}
.innerCircle{
width: 80px;
height: 80px;
border-radius: 50%;
background: orange;
position: absolute;
top: 10px;
right: -40px;
}
```
```
<div class='container'>
<div class='left'></div>
<div class='circleContainer'></div>
<div class='innerCircle'></div>
</div>
```
Using an approah which I found [here](https://stackoverflow.com/a/63739677/18299343)
| null | CC BY-SA 4.0 | null | 2022-12-15T19:44:30.730 | 2022-12-15T19:44:30.730 | null | null | 18,299,343 | null |
74,816,883 | 2 | null | 74,816,792 | 0 | null | Wouldn't you consider this more a google ads problem than a webmaster problem? Your take to approach google is the best one imo.
Google ads should not count a person twice if the click on the same add twice in a row within a certain time period (from the same ip address) and this should be your argument with google. This logic is simple enough so that google ads should have it in order to ensure fair business even from google's perspective.
If you succeed with this, your competitor will think he is successful while doing you no harm.
Trying to block those ip addresses can again be bypassed by your competitor with the next version of his clickbomb trick.
| null | CC BY-SA 4.0 | null | 2022-12-15T19:56:19.903 | 2022-12-15T19:58:05.583 | 2022-12-15T19:58:05.583 | 20,743,102 | 20,743,102 | null |
74,817,138 | 2 | null | 74,810,152 | 1 | null | A simple-minded solution using `circle()` to do our work for us:
```
import turtle
from math import pi
for sides in range(3, 13):
radius = 40 * sides / pi
turtle.penup()
turtle.sety(-radius)
turtle.pendown()
turtle.circle(radius, steps=sides)
turtle.hideturtle()
turtle.done()
```
[](https://i.stack.imgur.com/HYZr8.png)
| null | CC BY-SA 4.0 | null | 2022-12-15T20:21:46.717 | 2022-12-15T20:21:46.717 | null | null | 5,771,269 | 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.