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,308,433 | 2 | null | 74,307,971 | 0 | null | There are (at least) a couple of ways you could try.
1. Have 2 sheets in your workbook, one is for user-entered data, and the other is for formatted display of data. The formatted display sheet is protected so cannot be amended by the user - it picks up the data from the user-entered sheet which is not protected but formatting is less important. So the user cannot interfere with the formatting or layout of the protected sheet. This approach may require quite a bit of code to ensure validation and management of data between the input sheet and the display sheet, for example if you expect the user to insert rows etc., but if your requirement is simple then it's quite acheiveable.
2. Allow the user to paste with formatting but then reset the formatting after the paste has been done. I have found a good approach is to use your own custom styles, where the style can define all aspects of the appearance of the cells. The user can paste data into the sheet, then when finished have a macro trigger to run code that cleans up all the formatting by setting the styles of the different areas of your sheet to the appropriate custom styles. This approach is very effective, specially if you might want to alter the styles later - you may be able just to change the style definition and don't have to change the code. You can make this easier if you have a separate sheet on which all your custom styles are listed with their names and example values in cells which are formatted with that named style. The custom styles sheet can be hidden/protected to avoid users making changes.
| null | CC BY-SA 4.0 | null | 2022-11-03T19:12:37.730 | 2022-11-03T19:12:37.730 | null | null | 1,992,793 | null |
74,308,546 | 2 | null | 74,308,475 | 0 | null | ```
Stack(
children: [
Positioned(
left: 10,
top: 10,
child: Image.asset('assets/logo.png'),
),
//Your other widget
],
),
```
Stack could be one of the options to achieve that, however you can use Appbar as well to achieve the same.
THe code for the elevated Button
```
SizedBox(
width: double.maxFinite,
child: ElevatedButton(
child: Text('Button'),
onPressed: null,
style: ButtonStyle(
side: MaterialStateProperty.all(
BorderSide(
width: 2, color: Colors.white)),
backgroundColor:
MaterialStateProperty.all(
Colors.transparent),
padding: MaterialStateProperty.all(
EdgeInsets.all(12)),
textStyle: MaterialStateProperty.all(
TextStyle(fontSize: 30))),
),
),
```
| null | CC BY-SA 4.0 | null | 2022-11-03T19:22:27.260 | 2022-11-04T22:35:33.507 | 2022-11-04T22:35:33.507 | 11,423,386 | 11,423,386 | null |
74,308,648 | 2 | null | 16,755,142 | 0 | null | Somehow in Windows you just need to call any shell command first, rather call the `system` function. Just in start of your main method put `system("");`, and don't forget to include `stdlib.h`.
I noticed this when I looked at some of my old programs that also used ANSI codes to understand why they work, but my new code is not
| null | CC BY-SA 4.0 | null | 2022-11-03T19:33:00.110 | 2022-11-03T21:30:26.493 | 2022-11-03T21:30:26.493 | 15,393,323 | 15,393,323 | null |
74,309,266 | 2 | null | 74,309,117 | 0 | null | If I understand you correctly, to put it simply, you need something like the following;
Assuming your dataframe is called "df":
```
for i in range(df.shape[0]):
conv_stores = yelp_api.search_query(categories= 'convenience stores', df['latitude'].iloc[i], df['longitude'].iloc[i], limit=50)
print (conv_stores)
```
And a better version would be using a lambda function and adding the results as a new column to your original dataframe;
```
df['conv_stores'] = df.apply(lambda x: yelp_api.search_query(categories= 'convenience stores', x['latitude'], x['longitude'], limit=50), axis=1)
```
| null | CC BY-SA 4.0 | null | 2022-11-03T20:37:06.160 | 2022-11-03T20:37:06.160 | null | null | 15,083,206 | null |
74,309,282 | 2 | null | 74,309,061 | 2 | null | Based on [a comment above](https://stackoverflow.com/questions/74309061/searching-for-key-in-a-dictionary-when-the-key-is-an-object-c-sharp?noredirect=1#comment131189481_74309061):
> it does not override the Equals and GetHashCode methods
Then this assertion is false:
> keys which already exist
Two objects are not the same just because their properties have the same values. Much in the same way that two people are not the same person just because they have the same name.
In the absence of any logic indicating otherwise, the comparison for "sameness" for objects is . So unless the two references point to the same object in memory, they are not the same object.
You can provide custom comparison logic by overriding `Equals` and `GetHashCode` in your class. The `Dictionary<>` would then be able to use your logic to determine if two objects are "the same".
In this case I think maybe `GetHashCode` is the only one that's of the two, but it's always a good idea to override both any time you want to implement "sameness". You might also implement `IComparable`, override `ToString`, etc.
---
A quick example to demonstrate, this should write the first `Count` to the console but throw an exception for the second `Dictionary<>` saying:
> System.ArgumentException: An item with the same key has already been added.
```
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
// adds a second record
var notSameDict = new Dictionary<NotSame, int>();
notSameDict.Add(new NotSame { Foo = "test" }, 1);
notSameDict.Add(new NotSame { Foo = "test" }, 2);
Console.WriteLine(notSameDict.Count);
// does not add a second record
var sameDict = new Dictionary<Same, int>();
sameDict.Add(new Same { Foo = "test" }, 1);
sameDict.Add(new Same { Foo = "test" }, 2);
Console.WriteLine(sameDict.Count);
}
}
public class NotSame
{
public string Foo { get; set; }
}
public class Same
{
public string Foo { get; set; }
public override bool Equals(object obj)
{
return Foo.Equals((obj as Same).Foo);
}
public override int GetHashCode()
{
return Foo.GetHashCode();
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-03T20:38:50.380 | 2022-11-03T20:46:00.207 | 2022-11-03T20:46:00.207 | 328,193 | 328,193 | null |
74,310,025 | 2 | null | 68,670,408 | 0 | null | i couldn't find an option to resend a pin too.
The solution was to login to my adsense account [https://www.google.com/adsense/](https://www.google.com/adsense/) which is linked to admob then go to Payments > Verification check > Resend PIN
| null | CC BY-SA 4.0 | null | 2022-11-03T22:01:06.647 | 2022-11-03T22:01:06.647 | null | null | 12,478,074 | null |
74,310,639 | 2 | null | 74,301,955 | 3 | null | Using Skia4Delphi library:
```
uses
System.UITypes, Skia;
procedure TForm1.FormCreate(Sender: TObject);
var
LImage: ISkImage;
LSurface: ISkSurface;
LPaint: ISkPaint;
begin
LImage := TSkImage.MakeFromEncodedFile('..\..\delphi.png');
LPaint := TSkPaint.Create;
LPaint.ColorFilter := TSkColorFilter.MakeHighContrast(TSkHighContrastConfig.Create(True, TSkContrastInvertStyle.NoInvert, 0));
LSurface := TSkSurface.MakeRaster(LImage.Width, LImage.Height);
LSurface.Canvas.Clear(TAlphaColors.Null);
LSurface.Canvas.DrawImage(LImage, 0, 0, LPaint);
LSurface.MakeImageSnapshot.EncodeToFile('..\..\delphi-grayscale.png');
end;
```
| null | CC BY-SA 4.0 | null | 2022-11-03T23:35:17.087 | 2022-11-03T23:35:17.087 | null | null | 2,614,619 | null |
74,310,867 | 2 | null | 25,344,661 | 0 | null | The other difference is, `mysql` npm module still doesn't support `caching_sha2_password` authentication introduced in MySQL 8, while `mysql2` npm module does.
This is why i migrated to mysql2.
| null | CC BY-SA 4.0 | null | 2022-11-04T00:18:07.253 | 2022-11-04T00:18:07.253 | null | null | 2,280,798 | null |
74,311,059 | 2 | null | 74,135,239 | 0 | null | I had the same issue before. In the unity editor, I can see my models normally. But the models were not shown in Hololens, or only by one eye. The reason was that the models use the standard shader of Unity. After I applied the Mixed Reality Toolkit/ Standard Shaders, every model was shown.
| null | CC BY-SA 4.0 | null | 2022-11-04T00:58:33.113 | 2022-11-04T00:58:33.113 | null | null | 14,238,689 | null |
74,311,468 | 2 | null | 18,811,431 | 0 | null | I made this function which could be used as follows to return the value you want.
Usage example:
GetTableValue(yourTableName, "ID", 3, "header4")
```
Function GetTableValue( _
ByRef table As ListObject, _
ByVal columnNameForKeyValue As String, _
ByVal keyValue As Variant, _
ByVal columNameForReturnValue As String _
) As Variant
Dim rowIndex As LongPtr
Dim columnIndex As LongPtr
On Error GoTo ErrorHandling
rowIndex = Application.Match(keyValue,
table.ListColumns(columnNameForKeyValue).DataBodyRange, 0)
columnIndex = table.ListColumns(columNameForReturnValue).Index
GetTableValue = table.DataBodyRange.Cells(rowIndex, columnIndex).value
Exit Function
ErrorHandling:
GetTableValue = "Error: Review inputs"
End Function
```
| null | CC BY-SA 4.0 | null | 2022-11-04T02:12:37.317 | 2022-11-04T02:12:37.317 | null | null | 19,628,371 | null |
74,311,640 | 2 | null | 67,927,982 | 1 | null | This problem is still there.
I disabled C/C++ themes.
After that I am able to see Python imports in color
[](https://i.stack.imgur.com/gaJdb.png)
| null | CC BY-SA 4.0 | null | 2022-11-04T02:47:02.033 | 2022-11-04T02:47:02.033 | null | null | 14,608,336 | null |
74,312,661 | 2 | null | 16,284,219 | 0 | null | One thing you can do is to disable the seekbar, Like kotlin
val pro = popupContent.findViewById(R.id.penoptionsizeslider)
//now disable it here
pro.setEnabled(false)
| null | CC BY-SA 4.0 | null | 2022-11-04T05:39:21.410 | 2022-11-04T05:47:49.283 | 2022-11-04T05:47:49.283 | 16,304,396 | 16,304,396 | null |
74,312,866 | 2 | null | 4,829,043 | 1 | null | You can remove the read only from a folder using this piece of code:
```
import os, stat
from stat import *
import shutil
import fnmatch
file_name = r'<file path>'
os.chmod(file_name, stat.S_IWRITE)
os.remove(file_name)
```
| null | CC BY-SA 4.0 | null | 2022-11-04T06:12:45.763 | 2022-11-04T06:15:19.660 | 2022-11-04T06:15:19.660 | 9,240,404 | 9,240,404 | null |
74,313,223 | 2 | null | 74,308,842 | 2 | null | > If my user inputs username "Admin" which is available in my DB, I want to get the pass that is in that node which is "Admin123" and later I will check if the pass from DB matches the pass which is entered by the user to log him in the app.
To be able to solve this problem, first, you have to perform a query that gets all the users where the value of the `username` field matches what the user types in the `userinputname` EditText. If the query returns at least a record, then you have to check the value of the `pass` field against the value `userinputpass` EditText. If there is a match, you can go ahead with the authentication, otherwise display a message, or do whatever you want.
```
DatabaseReference db = FirebaseDatabase.getInstance().getReference();
DatabaseReference usersRef = db.child("users");
Query queryByUserName = usersRef.orderByChild("username").equalTo(userinputname);
queryByUserName.get().addOnCompleteListener(new OnCompleteListener<DataSnapshot>() {
@Override
public void onComplete(@NonNull Task<DataSnapshot> task) {
if (task.isSuccessful()) {
for (DataSnapshot userSnapshot : task.getResult().getChildren()) {
String pass = userSnapshot.child("pass").getValue(String.class);
if(pass.equals(userinputpass)) {
Log.d("TAG", "Username and password are correct.");
} else {
Log.d("TAG", "The password is incorrect");
}
}
} else {
Log.d("TAG", task.getException().getMessage()); //Never ignore potential errors!
}
}
});
```
In the solution above, I have used [Query#get()](https://firebase.google.com/docs/reference/android/com/google/firebase/database/Query#get()) and not [Query()#addListenerForSingleValueEvent()](https://firebase.google.com/docs/reference/android/com/google/firebase/database/Query#addListenerForSingleValueEvent(com.google.firebase.database.ValueEventListener)). Why? Is because of [this](https://stackoverflow.com/questions/65653735/firebase-query-get-vs-addlistenerforsinglevalueevent-for-single-data-read).
While the above solution will work, please note that you should store the user credentials in the way you do. Never! Storing passwords in cleartext is one of the worst security risks you can inflict on your users. So for avoiding that, I highly recommend you implement [Firebase Authentication](https://firebase.google.com/docs/auth).
Since you're using Java, I recommend you read the following article:
- [How to create a clean Firebase authentication using MVVM?](https://medium.com/firebase-tips-tricks/how-to-create-a-clean-firebase-authentication-using-mvvm-37f9b8eb7336)
If you consider at some point in time learning Kotlin, which I personally recommend, then please also check the following resources:
- [How to handle Firebase Authentication in clean architecture using Jetpack Compose?](https://medium.com/firebase-tips-tricks/how-to-handle-firebase-authentication-in-clean-architecture-using-jetpack-compose-e9929c0e31f8)
And:
- [How to authenticate to Firebase using Google One Tap in Jetpack Compose?](https://medium.com/firebase-developers/how-to-authenticate-to-firebase-using-google-one-tap-in-jetpack-compose-60b30e621d0d)
The above query requires an index. So in order to make it work, please add the following rules inside your Firebase console:
```
{
"rules": {
"users": {
".indexOn": "username"
}
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-04T06:55:43.940 | 2022-11-04T17:18:34.027 | 2022-11-04T17:18:34.027 | 5,246,885 | 5,246,885 | null |
74,313,358 | 2 | null | 74,313,285 | 1 | null | I discovered the issue here. My URL was not actually correct, not because of some typo, but because the format had changed. So, doing this worked:
```
[](https://github.com/xefino/goutils/actions)
```
| null | CC BY-SA 4.0 | null | 2022-11-04T07:10:12.273 | 2022-11-04T07:10:12.273 | null | null | 3,121,975 | null |
74,313,541 | 2 | null | 58,375,458 | 1 | null | The solution for this will be, saving an image using , this worked for me, when I was doing image compression. while saving a compressed image file using CV2 it increased the compressed image size more than the original image size. solved this issue for me
example: `imageio.imwrite("image_name.jpg", cv2_image)`
The increase in file size while saving with jpg is that it decompresses the image file
| null | CC BY-SA 4.0 | null | 2022-11-04T07:30:49.013 | 2022-11-15T08:19:20.270 | 2022-11-15T08:19:20.270 | 18,462,241 | 18,462,241 | null |
74,313,598 | 2 | null | 22,433,005 | 0 | null | Change your Storage Engine to: `innoDB` and then click save.[](https://i.stack.imgur.com/hQBiD.png)
| null | CC BY-SA 4.0 | null | 2022-11-04T07:36:12.963 | 2022-11-07T16:30:03.273 | 2022-11-07T16:30:03.273 | 8,864,226 | 20,230,098 | null |
74,313,604 | 2 | null | 74,244,322 | 0 | null | You can set the row which listview is in to [absolute heights](https://learn.microsoft.com/en-us/dotnet/maui/user-interface/layouts/grid#simplify-row-and-column-definitions).
Here is the code:
```
<ScrollView>
<Grid RowDefinitions="auto,auto,200,auto,auto,auto,auto">
<Image Grid.Row="0"
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />
<Label Grid.Row="1"
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<ListView Grid.Row="2">
<ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
<x:String>sss</x:String>
</x:Array>
</ListView.ItemsSource>
</ListView>
<Label Grid.Row="3"
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />
<Button Grid.Row="4"
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />
<Image Grid.Row="5"
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />
<Label Grid.Row="6"
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
</Grid>
</ScrollView>
```
| null | CC BY-SA 4.0 | null | 2022-11-04T07:37:12.337 | 2022-11-04T07:37:12.337 | null | null | 19,902,734 | null |
74,313,822 | 2 | null | 24,981,784 | 2 | null | For PGAdmin installation of extensions:
1. Right click on the database name listed under the server cascade list, you will see an option "Create Script" - click on it.
2. This opens up a script with some information on creation/alteration of the DB. Clear this script and then paste the following lines: CREATE EXTENSION postgis;
3. Look at the icons at the top - you will see a RUN icon/button - looks like a "play" icon. Click on it.
4. Look at the Log output, it should have successfully run the command and installed the extension.
| null | CC BY-SA 4.0 | null | 2022-11-04T08:01:08.863 | 2022-11-04T08:01:08.863 | null | null | 4,403,947 | null |
74,314,122 | 2 | null | 74,314,062 | 0 | null | ```
=IF(D2>89,"A",IF(D2>79,"B",IF(D2>69,"C",IF(D2>59,"D","F"))))
```
If the Test Score (in cell D2) is greater than 89, then the student gets an A
If the Test Score is greater than 79, then the student gets a B
If the Test Score is greater than 69, then the student gets a C
If the Test Score is greater than 59, then the student gets a D
Otherwise the student gets an F
Source:[https://support.microsoft.com/en-us/office/if-function-nested-formulas-and-avoiding-pitfalls-0b22ff44-f149-44ba-aeb5-4ef99da241c8](https://support.microsoft.com/en-us/office/if-function-nested-formulas-and-avoiding-pitfalls-0b22ff44-f149-44ba-aeb5-4ef99da241c8)
| null | CC BY-SA 4.0 | null | 2022-11-04T08:28:26.080 | 2022-11-04T08:28:26.080 | null | null | 15,430,667 | null |
74,314,626 | 2 | null | 31,046,966 | 1 | null | The question is quite old, but unfortunately still relevant.
The simplest solution is to replace all whitespaces with ` `.
But be carfull with line lengths.
| null | CC BY-SA 4.0 | null | 2022-11-04T09:16:07.210 | 2022-11-04T09:16:07.210 | null | null | 16,342,602 | null |
74,314,642 | 2 | null | 74,314,107 | 1 | null | This is because of your code that doesn't take care of [lambda execution environment](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtime-environment.html).
As mentioned in the comment above, between two lambda invocation, you are not releasing the connection to the DB. It is like doing two times in a row `mongoose.connect()`
I suggest to do something like this:
```
let cachedClient = null;
async function connectDB() {
if (cachedClient) {
return cachedClient;
}
// Connect to our MongoDB database hosted on MongoDB Atlas
const client = await mongoose.connect(MONGO_DB_URL);
cachedClient = client;
return client;
}
```
This will reuse the same client across multiple lambda invocation (within the same execution environment). When a new lambda execution environment is created, `cachedClient` will be null and a new client will be created.
Hope it clarifies.
| null | CC BY-SA 4.0 | null | 2022-11-04T09:17:04.780 | 2022-11-04T09:17:04.780 | null | null | 19,408,037 | null |
74,314,944 | 2 | null | 74,314,062 | 0 | null | `IFS` checks for multiple conditions and returns the value of the first found TRUE. In your case no TRUE is found (G5 is not greater than D6) and returns N/A
| null | CC BY-SA 4.0 | null | 2022-11-04T09:40:58.263 | 2022-11-04T09:40:58.263 | null | null | 12,634,230 | null |
74,315,473 | 2 | null | 74,314,062 | 0 | null | In your case, G5 is `6000` and D6 is `7000`.
So all conditions are `FALSE` in your `IFS()` formula and it returns `#N/A`.
To provide a value if all your conditions are `FALSE`, you can enter `TRUE` as a final condition, followed by a value.
```
=IFS(AND(G5>0, D6>0, G5>D6), G5-D6, AND(G5>0, D6<=0), E6+G5, AND(G5<=0, D6<=0, E6<F5), E6-F5, TRUE, 0)
```
| null | CC BY-SA 4.0 | null | 2022-11-04T10:23:01.940 | 2022-11-04T10:45:06.130 | 2022-11-04T10:45:06.130 | 20,396,112 | 20,396,112 | null |
74,315,602 | 2 | null | 74,307,838 | 2 | null | Frame change: you don't need to use a nested loop if you use `findgroups` to identify the unique groupings by Ticker and EarningsDate, then just do a single loop over these.
First, a minimal example data set:
```
% Set up some example data
T = table();
rng(0);
T.Ticker = repelem( ["AAPL"; "AMGN"], 6, 1 );
T.EarningsDate = repelem( datetime(2022, randi(12,4,1), randi(28,4,1)), 3, 1 );
T.Date = T.EarningsDate + repmat( [-1;0;1], 4, 1 );
T.Return = rand(height(T),1)-0.5;
T.ExpectedReturn = T.Return .* rand(height(T),1)*2;
```
Then a simple loop, see comments for details:
```
% Get groups for each unique combination of Ticker and EarningsDate
grp = findgroups( T.Ticker, T.EarningsDate );
% Loop over the groups and get the product for each one
T.ret(:) = NaN;
for igrp = 1:max(grp)
idx = (grp == igrp); % Rows which match this group
% Assign all group rows a "ret" value equal to their "Return" product
T.ret( idx ) = prod( T.Return(idx) );
end
```
| null | CC BY-SA 4.0 | null | 2022-11-04T10:33:05.027 | 2022-11-04T10:33:05.027 | null | null | 3,978,545 | null |
74,315,838 | 2 | null | 16,753,939 | 0 | null | A simple cold boot from device manager menu solved this for my emulator.[](https://i.stack.imgur.com/Yl7gu.png)
| null | CC BY-SA 4.0 | null | 2022-11-04T10:49:43.983 | 2022-11-04T10:49:43.983 | null | null | 9,930,050 | null |
74,315,893 | 2 | null | 63,092,309 | 2 | null | You need to prepend `https://` to your URL. For example,
❌ `api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key}`
✅ `https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key}`
The API call on the OpenWeather occasionally excludes `https://` from their API call URLs on their website. However when making an API call in your JS code, you cannot omit this because otherwise your code will convert your URL to a relative path.
| null | CC BY-SA 4.0 | null | 2022-11-04T10:53:42.867 | 2022-11-04T11:07:36.570 | 2022-11-04T11:07:36.570 | 17,627,866 | 17,627,866 | null |
74,315,944 | 2 | null | 74,315,309 | 0 | null | Make sure that you have installed `spacy` and the models in the same environement.
Check with `pip list` and `pip3 list` and install the `en-core-web-sm` accordingly.
| null | CC BY-SA 4.0 | null | 2022-11-04T10:57:37.660 | 2022-11-04T11:04:00.403 | 2022-11-04T11:04:00.403 | 13,130,448 | 13,130,448 | null |
74,316,417 | 2 | null | 19,073,683 | 0 | null | Just created a package for problems like this: [textalloc](https://github.com/ckjellson/textalloc)
The following example shows how you might use it in this case. With a few parameter tweaks you can generate a plot like this in a fraction of a second:
```
import textalloc as ta
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
x_lines = [np.array([0.0, 0.03192317, 0.04101177, 0.26085659, 0.40261173, 0.42142198, 0.87160195, 1.00349979]) + np.random.normal(0,0.03,(8,)) for _ in range(4)]
y_lines = [np.array([0. , 0.2, 0.2, 0.4, 0.8, 0.6, 1. , 1. ]) + np.random.normal(0,0.03,(8,)) for _ in range(4)]
text_lists = [['0', '25', '50', '75', '100', '125', '150', '250'] for _ in range(4)]
texts = []
for tl in text_lists:
texts += tl
fig,ax = plt.subplots(dpi=100)
for x_line,y_line,text_list in zip(x_lines,y_lines,text_lists):
ax.plot(x_line,y_line,color="black",linewidth=0.5)
ta.allocate_text(fig,ax,np.hstack(x_lines),np.hstack(y_lines),
texts,
x_lines=x_lines, y_lines=y_lines,
max_distance=0.1,
min_distance=0.025,
margin=0.0,
linewidth=0.5,
nbr_candidates=400)
plt.show()
```
[](https://i.stack.imgur.com/JYOs2.png)
| null | CC BY-SA 4.0 | null | 2022-11-04T11:36:16.997 | 2022-11-04T11:36:16.997 | null | null | 16,879,899 | null |
74,316,810 | 2 | null | 21,103,622 | 0 | null | You can do it easily with grid:
```
display: grid;
grid-template-columns: auto auto;
justify-content: space-between;
```
| null | CC BY-SA 4.0 | null | 2022-11-04T12:05:37.397 | 2022-11-04T12:05:37.397 | null | null | 4,804,896 | null |
74,317,297 | 2 | null | 14,938,541 | 1 | null | Just created another quick solution that is also very fast: [textalloc](https://github.com/ckjellson/textalloc)
In this case you could do something like this:
```
import textalloc as ta
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(2022)
N = 30
scatter_data = np.random.rand(N, 3)*10
fig, ax = plt.subplots()
ax.scatter(scatter_data[:, 0], scatter_data[:, 1], c=scatter_data[:, 2], s=scatter_data[:, 2] * 50, zorder=10,alpha=0.5)
labels = ['ano-{}'.format(i) for i in range(N)]
text_list = labels = ['ano-{}'.format(i) for i in range(N)]
ta.allocate_text(fig,ax,scatter_data[:, 0],scatter_data[:, 1],
text_list,
x_scatter=scatter_data[:, 0], y_scatter=scatter_data[:, 1],
max_distance=0.2,
min_distance=0.04,
margin=0.039,
linewidth=0.5,
nbr_candidates=400)
plt.show()
```
[](https://i.stack.imgur.com/jKY77.png)
| null | CC BY-SA 4.0 | null | 2022-11-04T12:47:19.583 | 2022-11-04T12:47:19.583 | null | null | 16,879,899 | null |
74,317,805 | 2 | null | 74,317,772 | 0 | null | A simple option is
```
where extract(year from sysdate) - extract(year from hire_date) >= 15
```
If table isn't too large, performance won't suffer because of possible index on `hire_date` column. If it does, say so.
| null | CC BY-SA 4.0 | null | 2022-11-04T13:28:51.670 | 2022-11-04T13:28:51.670 | null | null | 9,097,906 | null |
74,317,949 | 2 | null | 74,317,859 | 2 | null | try to add `?` to your User param and try again
```
Customuser? _customuser(User? user) {
return user != null ? Customuser(uid: user.uid) : null;
}
```
| null | CC BY-SA 4.0 | null | 2022-11-04T13:39:33.263 | 2022-11-04T13:39:33.263 | null | null | 16,146,701 | null |
74,317,984 | 2 | null | 74,317,469 | 7 | null | There is a problem getting ggtern to work with gganimate (see [this](https://stackoverflow.com/questions/67015151/animate-a-ternary-plot) unanswered stack overflow question).
Of course, it remains possible to create a ggplot animation the old-fashioned way: write a bunch of png files and stitch them together into a png file using `magick`:
```
library(tidyverse)
library(gganimate)
library(ggtern)
library(magick)
data = tibble(x=runif(400), y = runif(400),
z = runif(400), time = rep(seq(1:20), 20))
for(i in 1:20) {
p <- ggtern(data[data$time == i, ], aes(x, y, z)) +
geom_point() +
theme_rgbw() +
stat_density_tern(geom = 'polygon',
aes(fill = ..level.., alpha = ..level..), bdl = 0.001) +
scale_fill_gradient(low = "blue",high = "red") +
guides(color = "none", fill = "none", alpha = "none")
ggsave(paste0('ggtern', i, '.png'), p)
}
list.files(pattern = 'ggtern\\d+\\.png', full.names = TRUE) %>%
image_read() %>%
image_join() %>%
image_animate(fps=4) %>%
image_write("ggtern.gif")
```
Now we have the following file:
[](https://i.stack.imgur.com/tMag2.gif)
| null | CC BY-SA 4.0 | null | 2022-11-04T13:42:36.637 | 2022-11-04T13:49:31.363 | 2022-11-04T13:49:31.363 | 12,500,315 | 12,500,315 | null |
74,318,206 | 2 | null | 74,314,189 | 0 | null | Your code loads data from:
```
FirebaseFirestore.instance
.collection('chats/MTIH4O2WFPWDvCso107p/messages')
```
But if we look at the screenshot, that `MTIH4O2WFPWDvCso107p` document name is actually the `messages` collection, and before that is another ID. So if you want to just load that document you need:
```
FirebaseFirestore.instance
.doc('chats/j701pWfp.../messages/MTIH4O2WFPWDvCso107p')
```
With `j701pWfp...` being the complete ID of the document under `chats`.
If you want to load all messages, that'd be:
```
FirebaseFirestore.instance
.collection('chats/j701pWfp.../messages')
```
| null | CC BY-SA 4.0 | null | 2022-11-04T13:58:26.733 | 2022-11-05T14:16:46.570 | 2022-11-05T14:16:46.570 | 209,103 | 209,103 | null |
74,318,377 | 2 | null | 24,830,610 | 1 | null | I was getting error 401 deploying to Nexus 3 using M2Eclipse and I was able to figure out the root cause.
The problem is that M2Eclipse tries to deploy artifacts in parallel which is not permitted by Nexus. You can find more details in [this post](https://stackoverflow.com/a/74318208/4316647).
As a workaround you can deploy with a command line maven installation.
| null | CC BY-SA 4.0 | null | 2022-11-04T14:10:50.213 | 2022-11-04T14:10:50.213 | null | null | 4,316,647 | null |
74,318,777 | 2 | null | 57,099,318 | 0 | null | Check the errors in View->logs> statements.
I had the same issue and found that the user doesn't have permission on temp tablespace.
| null | CC BY-SA 4.0 | null | 2022-11-04T14:41:53.933 | 2022-11-04T14:41:53.933 | null | null | 20,418,530 | null |
74,318,964 | 2 | null | 42,546,110 | 0 | null | In my case I solved the problem checking for empty spaces e.g.
`mvn... -Dconfigfile=[unwanted empty space]C:\SOME-DIRECTORY`
Additionally pay attention on `/` and `\`. This depends on your OS.
| null | CC BY-SA 4.0 | null | 2022-11-04T14:56:30.603 | 2022-11-09T15:34:58.713 | 2022-11-09T15:34:58.713 | 3,963,478 | 13,388,278 | null |
74,319,114 | 2 | null | 72,066,640 | 0 | null | We had the same issue when upgrading to Angular 14.2 and ng-bootstrap 13.0 (angular/material integrated). It's also mentioned on their [GitHub](https://github.com/ng-bootstrap/ng-bootstrap/issues/4406).
Currently, we solved it by overriding the modal class in our style with a higher z-index then 1050.
| null | CC BY-SA 4.0 | null | 2022-11-04T15:07:48.447 | 2022-11-04T15:07:48.447 | null | null | 2,823,537 | null |
74,319,362 | 2 | null | 74,316,269 | 0 | null |
# Single Selection
By changing the outer quotations marks from "single" to "double" (`cy.get("")`), using "single" quotations marks for the id definition (`[id='']`) and escaping the inner "double" quotations marks (`\"index\"`) cypress can detect the correct element:
```
cy.get("[id='{\"index\":0,\"type\":\"dynamic-dropdown\"}']").should('exist')
```
# Selector Approach
Another solution is based on cypress [Selector](https://docs.cypress.io/api/commands/get#Selector) and looks like this:
```
cy.get('[id*=index][id*=type][id*=dynamic-dropdown]')
```
It will match multiple elements, which include the words "index", "type" and "dynamic-dropdown" but without any order.
So, ids like the following would also match:
```
<div id="index-type-dynamic-dropdown"></div>
<div id="dynamic-dropdown-type-index"></div>
```
| null | CC BY-SA 4.0 | null | 2022-11-04T15:27:33.867 | 2022-11-08T10:20:43.290 | 2022-11-08T10:20:43.290 | 9,620,269 | 9,620,269 | null |
74,319,453 | 2 | null | 74,319,350 | 1 | null | You can use `REGEXP_LIKE`:
```
SELECT DISTINCT
income_level
FROM customers
WHERE REGEXP_LIKE( income_level, '^\d{3},\d{3}\s*-\s*\d{3},\d{3}$' )
```
| null | CC BY-SA 4.0 | null | 2022-11-04T15:35:32.613 | 2022-11-04T15:35:32.613 | null | null | 1,509,264 | null |
74,319,500 | 2 | null | 51,200,289 | 0 | null | The accepted answer did not work for me. I managed to move all my labels over by one through the following code. This allowed the first label to match with the first bar on my plot.
```
tick_labels = ['[0, 20)', '[20, 40)', '[40, 60)', '[60, 80)', '[80, 100)', '=100']
x_max = int(max(plt.xticks()[0]))
plt.xticks(range(1, x_max), tick_labels)
```
| null | CC BY-SA 4.0 | null | 2022-11-04T15:38:30.987 | 2022-11-04T15:38:30.987 | null | null | 8,941,248 | null |
74,319,505 | 2 | null | 13,778,034 | 0 | null | After 10 years this is still an issue for the current version(15.0) of Microsoft SQL Server Express.
After a bit of investigation I discovered, there is an issue with permission inside the registry. The process sqlservr.exe cannot create entries in `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL15E.LOCALDB\MSSQLServer`.
On my computer this process is running under my account, so I opened regedit and gave myself `Full Control` permission to this key. And it worked like a charm. I hope this will help you as well.
| null | CC BY-SA 4.0 | null | 2022-11-04T15:39:12.907 | 2022-11-04T15:39:12.907 | null | null | 1,293,951 | null |
74,321,453 | 2 | null | 74,320,897 | 0 | null | I'm not sure exactly what you mean by "random curve". You seem to just be trying to plot the regression line. In this case, you can just use `abline`
```
reg <- lm(b~a,data = df)
plot(df$a, df$b, xlab = "a", ylab = "b")
abline(reg, col="red")
```
[](https://i.stack.imgur.com/5jcN2.png)
Or if you really wanted to use `curve()`, the `x` variable is special and needs to be able to change. So it would be
```
curve(reg$coefficients[1] + x*reg$coefficients[2], add=TRUE, col="red")
```
| null | CC BY-SA 4.0 | null | 2022-11-04T18:23:49.370 | 2022-11-04T18:23:49.370 | null | null | 2,372,064 | null |
74,321,466 | 2 | null | 2,266,721 | 1 | null | I used random string from characters like below
```
public static string RandomString(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&?%$@";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[Random.Next(s.Length)]).ToArray());
}
```
| null | CC BY-SA 4.0 | null | 2022-11-04T18:25:09.633 | 2022-11-04T18:25:09.633 | null | null | 8,428,614 | null |
74,322,114 | 2 | null | 74,321,669 | -1 | null | If your code is working and is doing its job you can always ignore the error by adding this at the top. I would not recommend it in a very large scale project.
```
from pandas.core.common import SettingWithCopyWarning
warnings.simplefilter(action="ignore", category=SettingWithCopyWarning)
```
| null | CC BY-SA 4.0 | null | 2022-11-04T19:31:27.777 | 2022-11-04T19:31:27.777 | null | null | 20,224,248 | null |
74,322,278 | 2 | null | 74,316,269 | 1 | null | If you have a look at the element
```
cy.get('.dash-dropdown')
.then($el => console.log('attributes', $el[0].attributes))
```
you see a NameNodeMap with three items
```
0. id
1. index":0,"type":"dynamic-dropdown"}"
2. class
```
so (at least in chrome) the browser has split the id because of the internal double quotes. The `id` value is `{`, the remainder becomes an attribute key with no value.
You can apply a filter based on this pattern
```
cy.get('.dash-dropdown')
.filter((index, el) => {
const id = el.getAttribute('id')
return id === '{' && el.hasAttribute('index":0,"type":"dynamic-dropdown"}"')
})
.should('have.length', 1)
.and('have.text', 'one') // passes
```
Tested with
```
<body>
<div id="{"index":0,"type":"dynamic-dropdown"}" class="dash-dropdown">one</div>
<div id="index-type-dynamic-dropdown" class="dash-dropdown">two</div>
<div id="dynamic-dropdown-type-index" class="dash-dropdown">three</div>
</body>
```
| null | CC BY-SA 4.0 | null | 2022-11-04T19:48:55.080 | 2022-11-04T19:48:55.080 | null | null | 16,997,707 | null |
74,322,761 | 2 | null | 74,319,350 | 1 | null | Presuming that values in that column - that contain the `-` character - look like `250,000 - 299,999` (i.e. have numbers, not letters or any other characters, while there's always one space between numbers), you could even try with
```
select distinct income_level
from customers
where income_level like '%-%'
and length(income_level) = 17
```
| null | CC BY-SA 4.0 | null | 2022-11-04T20:43:36.280 | 2022-11-04T20:43:36.280 | null | null | 9,097,906 | null |
74,322,783 | 2 | null | 74,322,588 | 1 | null | This works for me:
```
with open("sample.txt", "r", encoding="utf8") as f:
for line in f:
separate_words = line.split(" ")
new_line = " ".join(separate_words[1:])
print(new_line, end="")
```
Output:
```
$ python test.py
iPhone 14
Galaxy S22
Redmi 9
Doe
```
| null | CC BY-SA 4.0 | null | 2022-11-04T20:45:36.087 | 2022-11-04T20:45:36.087 | null | null | 2,484,591 | null |
74,322,955 | 2 | null | 28,139,344 | 2 | null | In general, it is a non-trivial problem, and there are many different approaches.
One that I have liked, since it is fast and produces decent results, is the quasi-random number generator from this article: "[The Unreasonable Effectiveness of Quasirandom Sequences](http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/)"
Other approaches are generally iterative, where the more iterations you do, the better results. You could look up "Mitchell's Best Candidate", for one. Another is "Poisson Disc Sampling".
There are innumerable variations on the different algorithms depending on what you want — some applications demand certain frequencies of noise, for instance. But if you just want something that "looks okay", I think the quasirandom one is a good starting point.
Another cheap and easy one is a "jittered grid", where you evenly space the points on your plane, then randomly adjust each one a small amount.
| null | CC BY-SA 4.0 | null | 2022-11-04T21:05:46.850 | 2022-11-04T21:05:46.850 | null | null | 567,650 | null |
74,323,951 | 2 | null | 74,323,831 | 1 | null | You can assign the content of a .txt file to a variable using this code:
```
words_to_guess = open("words.txt")
```
Just make sure that the file "words.txt" is in the same directory as the .py file (or if you're compiling it to a .exe, the same directory as the .exe file)
I would also like to point out that based on the screenshot you provided, it looks like you're trying to get a random word from the .txt file. Once you've done the above code, I would recommend adding this code below it as well:
```
words_to_guess = words_to_guess.split()
```
This will take the content of "words_to_guess" and split every word into a list that can be further accessed. You can then call:
```
word = random.choice(words_to_guess)
```
And it will select a random element from the array into the "word" variable, hence providing you a random word from the .txt file.
Just note that in the split() function, a word is determined by the spaces in between, so if you have a word like "Halloween Pumpkin" or "American Flag", the split() function would make each individual word an element, so it would be transferred into ["Halloween", "Pumpkin"] or ["American", "Flag"].
That's all!
| null | CC BY-SA 4.0 | null | 2022-11-04T23:30:13.540 | 2022-11-04T23:30:13.540 | null | null | 14,525,084 | null |
74,324,073 | 2 | null | 74,321,522 | 1 | null | You can try css flex. If it doesn't work as expected, increase the selector weight or make the properties as important.
```
figure.wp-block-image {
display: flex;
flex-direction: row;
align-content: center;
align-items: center;
}
```
| null | CC BY-SA 4.0 | null | 2022-11-04T23:58:52.583 | 2022-11-04T23:58:52.583 | null | null | 14,912,225 | null |
74,324,176 | 2 | null | 74,316,959 | 1 | null | First of all, it is necessarily ambiguous to provide two different function arguments with the same name in the same function. Therefore using `...` is probably not the best way to do this. Possible solutions can be found in [this](https://stackoverflow.com/questions/4124900/is-there-a-way-to-use-two-statements-in-a-function-in-r) thread.
In the example, the argument `color` is getting passed from `...` to `aes()` and `geom_point()` because they both take a `color` argument. The reason the first example works is because supplying `color = "blue"` in both places doesn't throw an error.
```
library(ggplot2)
ggplot(mtcars, aes(disp, mpg)) +
geom_point(aes(color = "blue"), color = "blue")
```

[reprex v2.0.2](https://reprex.tidyverse.org)
Finally, with a small tweak to the original function, it would be possible to make it flexible to provide `color` to either part of the function, but the approach probably wouldn't extend past this narrow use case much so probably not much help.
```
library(ggplot2)
f <- function(...) {
ggplot(mtcars, aes(disp, mpg)) +
geom_point(...)
}
f(color = "blue")
```

```
f(aes(color = factor(cyl)))
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-11-05T00:23:22.363 | 2022-11-05T00:23:22.363 | null | null | 13,210,554 | null |
74,324,539 | 2 | null | 74,324,457 | 0 | null | would this work for you?
```
setTags(trimmedInput.split(","));
```
you must first remove the last comma
| null | CC BY-SA 4.0 | null | 2022-11-05T01:58:52.377 | 2022-11-05T01:58:52.377 | null | null | 5,767,156 | null |
74,324,706 | 2 | null | 74,324,168 | 1 | null |
You can initiate a button prefab or pre-existing game object with button component.
Use GetComponent() method to get the button component. Then use button.Onclick.AddListener(YourButtonClickMethod) to add the button-clicked method you want.
You can get the code example from the link below (the onClick part) :
[https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.UI.Button.html](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.UI.Button.html)
| null | CC BY-SA 4.0 | null | 2022-11-05T02:41:32.407 | 2022-11-05T04:33:07.703 | 2022-11-05T04:33:07.703 | 10,259,001 | 10,259,001 | null |
74,325,089 | 2 | null | 67,659,678 | 0 | null | I had a similar issue with ModalRoute this worked for me, adding `?` at the end
```
final route = ModalRoute.of(context)!.settings.arguments?;
```
| null | CC BY-SA 4.0 | null | 2022-11-05T04:25:53.790 | 2022-11-11T04:52:41.293 | 2022-11-11T04:52:41.293 | 19,946,402 | 19,946,402 | null |
74,325,375 | 2 | null | 74,325,306 | 1 | null | As you can see in the Problems section you are missing an identifier. In C, functions must have an identifier (a name) after the return type.
Line 2 should be:
```
int main()
```
If you want to learn more visit [https://www.programiz.com/c-programming/examples/print-sentence](https://www.programiz.com/c-programming/examples/print-sentence)
| null | CC BY-SA 4.0 | null | 2022-11-05T05:35:08.090 | 2022-11-05T05:35:08.090 | null | null | 20,423,158 | null |
74,325,397 | 2 | null | 74,325,139 | 0 | null | I prepared a example in codepen:
[https://codepen.io/isaksonn/pen/eYKzarW](https://codepen.io/isaksonn/pen/eYKzarW)
```
section.container .card{display:flex;flex-direction:column;justify-content:space-between;height:600px;width:200px;border:1px solid gray;padding:10px}section.container .card .card-img{display:block;background-color:gray;width:100%;height:200px}section.container .card .card-content{height:100%;display:flex;flex-direction:column;justify-content:space-between}
```
```
<section class="container">
<div class="card">
<div class="card-img card-1"></div>
<div class="card-content">
<!--If you want align the title and text on the top and only the buttons down you have to wrap the firsts in a div, otherwise the text is centered vertically (as second card)-->
<div class="divAdded">
<h2 class="card-header">Bayanihan E-Konsulta</h2>
<p class="card-text">The Bayanihan e-Konsulta – a teleconsultation program aimed at assisting both COVID-19 and non-COVID-19 patients which was initially launched to fill the gaps in the government’s pandemic response.</p>
</div>
<button class="card-btn">Read more<span>→</span></button>
</div>
</div>
<div class="card">
<div class="card-img card-2"></div>
<div class="card-content">
<h2 class="card-header">Swab Cab</h2>
<p class="card-text">A mobile testing program which will do mass surveillance testing in communities where transmission is very high.</p>
<button class="card-btn card-btn-2">Read more<span>→</span></button>
</div>
</div>
<a href="#title" class="secondary-btn">BACK TO TOP</a>
</section>
```
| null | CC BY-SA 4.0 | null | 2022-11-05T05:41:34.583 | 2022-11-05T05:49:16.133 | 2022-11-05T05:49:16.133 | 20,422,855 | 20,422,855 | null |
74,325,473 | 2 | null | 74,325,394 | 2 | null | The available data is consistently 0.6-0.8, with few values near zero. It looks very much like those are missing and not actually zeroes. The [HHS recommends 0.7 mg/L,](https://nccd.cdc.gov/doh_mwf/default/AboutMWF.aspx#:%7E:text=The%20U.S.%20Department%20of%20Health,and%20promotes%20good%20oral%20health.) so it would probably be a big scandal we'd hear about if NYC was actually unfluorinated >80% of the time.
```
library(tidyverse)
water %>%
ggplot(aes('Fluoride (mg/L)')) + geom_histogram()
```
[](https://i.stack.imgur.com/CYYWh.png)
```
water %>%
mutate(date = lubridate::mdy(`Sample Date`)) %>%
ggplot(aes(date,`Fluoride (mg/L)`)) +
geom_jitter(size = 0.1)
```
[](https://i.stack.imgur.com/Nmjr5.png)
| null | CC BY-SA 4.0 | null | 2022-11-05T05:58:13.563 | 2022-11-05T05:58:13.563 | null | null | 6,851,825 | null |
74,325,504 | 2 | null | 74,325,139 | 0 | null | ```
section.container .card{height:600px;width:200px;border:1px solid gray;padding:10px}
section.container .card .card-img{display:block;background-color:gray;width:100%;height:200px}
.btn{
text-align: center;
margin: 10px 0;
}
```
```
<section class="container">
<div class="card">
<div class="card-img card-1"></div>
<div class="card-content">
<!--If you want align the title and text on the top and only the buttons down you have to wrap the firsts in a div, otherwise the text is centered vertically (as second card)-->
<div class="divAdded">
<h2 class="card-header">Bayanihan E-Konsulta</h2>
<p class="card-text">The Bayanihan e-Konsulta – a teleconsultation program aimed at assisting both COVID-19 and non-COVID-19 patients which was initially launched to fill the gaps in the government’s pandemic response.</p>
</div>
<p class="btn"><button class="card-btn">Read more<span>→</span></button></p>
</div>
</div>
<div class="card">
<div class="card-img card-2"></div>
<div class="card-content">
<h2 class="card-header">Swab Cab</h2>
<p class="card-text">A mobile testing program which will do mass surveillance testing in communities where transmission is very high.</p>
<p class="btn"><button class="card-btn card-btn-2">Read more<span>→</span></button></p>
</div>
</div>
<a href="#title" class="secondary-btn">BACK TO TOP</a>
</section>
```
You can try this..
add button element in 'p' and you can add class in 'p' element and than go to css file and style
| null | CC BY-SA 4.0 | null | 2022-11-05T06:04:41.343 | 2022-11-05T10:01:19.210 | 2022-11-05T10:01:19.210 | 20,358,442 | 20,358,442 | null |
74,325,783 | 2 | null | 74,322,588 | 1 | null | This is concise and uses regular expressions.
# Input: text.txt
```
Apple iPhone 14
Samsung Galaxy S22
Xiaomi Redmi 9
John Doe
```
# Code
```
import pathlib
import re
data = pathlib.Path('text.txt').read_text()
for line in data.splitlines():
print(re.match('\w+ (.+)', line).group(1))
```
# Output
```
iPhone 14
Galaxy S22
Redmi 9
Doe
```
| null | CC BY-SA 4.0 | null | 2022-11-05T07:05:14.033 | 2022-11-05T07:05:14.033 | null | null | 1,033,217 | null |
74,325,825 | 2 | null | 73,620,582 | 0 | null | Have you tried:
```
def apply_adstock_with_lag(x, L, P, D):
adstocked_x = np.convolve(x, D**((np.arange(0, L, 1) - P)**2))[:-(L-1)] / sum(D**((np.arange(0, L, 1) - P)**2))
adstocked_x = at.as_tensor_variable(adstocked_x)
return adstocked_x
```
This should work
| null | CC BY-SA 4.0 | null | 2022-11-05T07:13:14.497 | 2022-11-05T07:13:14.497 | null | null | 13,912,414 | null |
74,326,219 | 2 | null | 74,320,212 | 0 | null | First, I would recommend adding a “days overdue” column and then conditional formatting based on that. Adding more logic to the conditional format function is risky, as circular errors in formatting functions are a common source of sheet corruption.
Your ‘days overdue’ function would be something like `=TODAY()-C2-SWITCH(D2,”Critical”,3,”High”,5,”Medium”,7,”Low”,10)`. It can be done even easier if you have O365.
Alternatively, you can put a similar formula as the one shown, into your conditional formatting rules, I am just hesitant to recommend that.
| null | CC BY-SA 4.0 | null | 2022-11-05T08:24:38.153 | 2022-11-05T08:24:38.153 | null | null | 19,662,289 | null |
74,326,951 | 2 | null | 74,326,824 | 2 | null | `=FILTER(G1:G3,ISERROR(XMATCH(G1:G3,J1:J4)))`
[](https://i.stack.imgur.com/SwJGU.jpg)
In your case it's `=FILTER(G1:G26,ISERROR(XMATCH(G1:G26,J1:J30)))`
| null | CC BY-SA 4.0 | null | 2022-11-05T10:28:15.260 | 2022-11-05T10:28:15.260 | null | null | 12,634,230 | null |
74,327,256 | 2 | null | 74,326,670 | 0 | null | If you convert it in kotlin you can use this
```
GestureDetector gestureDetector=new GestureDetector(getApplicationContext(),new GestureDetector.SimpleOnGestureListener(){
@Override
public boolean onDoubleTap(MotionEvent e) {
// you can put your code here
return super.onDoubleTap(e);
}
});
```
| null | CC BY-SA 4.0 | null | 2022-11-05T11:21:54.597 | 2022-11-05T11:21:54.597 | null | null | 13,565,633 | null |
74,327,713 | 2 | null | 74,244,322 | 0 | null | I'm calculating the proportional heights myself now.
If anyone has other ideas, they can add theirs. Thanks everyone.
MainPage.xaml
```
<Shell.TitleView>
<Button Text="+ Add Random Element" Clicked="OnAddRandomElementButtonClicked" TextColor="White" />
</Shell.TitleView>
<Grid>
<ScrollView x:Name="MainScrollView" VerticalOptions="Fill" Margin="0">
<StackLayout x:Name="MainStackLayout" />
</ScrollView>
</Grid>
```
MainPage.xaml.cs
```
public partial class MainPage : ContentPage
{
double width;
double height;
int count = 0;
List<MyElement> myElements = new List<MyElement>();
public MainPage()
{
InitializeComponent();
BindingContext = new MainPageViewModel();
myElements.Add(new MyElement(MyElementType.Image, -1, 100, true));
myElements.Add(new MyElement(MyElementType.Label, 30));
myElements.Add(new MyElement(MyElementType.Entry, 35));
myElements.Add(new MyElement(MyElementType.ListView, -1, 200, true));
myElements.Add(new MyElement(MyElementType.Label, 35));
myElements.Add(new MyElement(MyElementType.Button, 40));
SizeChanged += (s, e) =>
{
if (Width != this.width || Height != this.height)
{
this.width = Width;
this.height = Height;
RenderContent();
}
};
}
private void OnAddRandomElementButtonClicked(object sender, EventArgs e)
{
Random rnd = new Random();
int randIndex = rnd.Next(myElements.Count);
var randomElement = myElements[randIndex];
myElements.Add(randomElement);
RenderContent();
}
void CalculateProportionalHeightAndUpdate()
{
double usedDisplayHeight = myElements.Where(e => e.IsProportional == false).Select(e => e.Height).Sum();
double leftOverDisplayHeight= this.height - usedDisplayHeight;
var proportionalElements = myElements.Where(e => e.IsProportional);
if (proportionalElements.Any())
{
double heightForOneUnit = leftOverDisplayHeight/ proportionalElements.Count();
foreach (var element in proportionalElements)
element.Height = Math.Max(element.MinHeight, heightForOneUnit); // Minimum height
}
}
void RenderContent()
{
CalculateProportionalHeightAndUpdate();
Grid grid = new Grid();
foreach (var element in myElements)
grid.RowDefinitions.Add(new RowDefinition() { Height = element.Height });
int row = 0;
foreach (var element in myElements)
{
VisualElement visualElement = element.ElementType switch
{
MyElementType.Label => CreateLabel(element.Height),
MyElementType.ListView => CreateListView(element.Height),
MyElementType.Button => CreateButton(element.Height),
MyElementType.Image => CreateImage(element.Height),
_ => CreateEntry(element.Height)
};
grid.Add(visualElement, 0, row);
row++;
}
MainStackLayout.Children.Clear();
MainStackLayout.Add(grid); //Since scrollview is not active with dynamic content, I added the grid in stacklayout.
}
Entry CreateEntry(double height = 40) => new Entry { Placeholder = "Enter text here", HeightRequest = height, HorizontalOptions = LayoutOptions.Center };
Image CreateImage(double height = 100)
{
return new Image
{
Source = "dotnet_bot.png",
HeightRequest = height,
HorizontalOptions = LayoutOptions.Center
};
}
ListView CreateListView(double height = -1)
{
var listView = new ListView
{
HeightRequest = height,
VerticalOptions = LayoutOptions.Fill
};
listView.SetBinding(ListView.ItemsSourceProperty, "Monkeys");
listView.ItemTemplate = new DataTemplate(() =>
{
Grid grid = new Grid { Padding = 10 };
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
Image image = new Image { Aspect = Aspect.AspectFill, HeightRequest = 60, WidthRequest = 60 };
image.SetBinding(Image.SourceProperty, "ImageUrl");
Label nameLabel = new Label { FontAttributes = FontAttributes.Bold };
nameLabel.SetBinding(Label.TextProperty, "Name");
Label locationLabel = new Label { FontAttributes = FontAttributes.Italic, VerticalOptions = LayoutOptions.End };
locationLabel.SetBinding(Label.TextProperty, "Location");
Grid.SetRowSpan(image, 2);
grid.Add(image);
grid.Add(nameLabel, 1, 0);
grid.Add(locationLabel, 1, 1);
return new ViewCell { View = grid };
});
return listView;
}
Label CreateLabel(double height = 30) => new Label { Text = "Hello, World!", HeightRequest = height, HorizontalOptions = LayoutOptions.Center };
Button CreateButton(double height = 40)
{
var button = new Button { Text = "Click me", HeightRequest = height, HorizontalOptions = LayoutOptions.Center };
button.Clicked += (s, e) => OnCounterClicked(s, e, button);
return button;
}
private void OnCounterClicked(object sender, EventArgs e, Button button)
{
count++;
if (count == 1)
button.Text = $"Clicked {count} time";
else
button.Text = $"Clicked {count} times";
SemanticScreenReader.Announce(button.Text);
}
}
public class MyElement
{
public MyElement(MyElementType elementType, double height, double minHeight = -1, bool isProportional = false)
{
ElementType = elementType;
Height = height;
MinHeight = minHeight == -1 ? height : minHeight;
IsProportional = isProportional;
}
public double Height { get; set; }
public double MinHeight { get; set; }
public MyElementType ElementType { get; set; }
public bool IsProportional { get; set; }
}
public enum MyElementType
{
Label,
Button,
ListView,
Image,
Entry
}
```
[](https://i.stack.imgur.com/m77in.png)
| null | CC BY-SA 4.0 | null | 2022-11-05T12:32:52.167 | 2022-11-05T13:04:03.993 | 2022-11-05T13:04:03.993 | 4,923,625 | 4,923,625 | null |
74,327,924 | 2 | null | 74,327,580 | 0 | null | I followed @oistikbal's comment, installed the new input system (from Window > Package Manager), and then followed [this](https://www.youtube.com/watch?v=we4CGmkPQ6Q&ab_channel=samyam) tutorial. Right stick now works as expected.
| null | CC BY-SA 4.0 | null | 2022-11-05T13:04:11.083 | 2022-11-05T13:04:11.083 | null | null | 16,370,901 | null |
74,328,290 | 2 | null | 30,684,613 | 0 | null | the `implementation 'androidx.core:core-ktx:1.9.0'` need `compileSdk 33` just change ktx to `implementation 'androidx.core:core-ktx:1.7.2` and sdk version to `compileSdk 33` .
this worked for me.
GL
| null | CC BY-SA 4.0 | null | 2022-11-05T13:51:09.653 | 2022-11-05T13:51:09.653 | null | null | 17,623,544 | null |
74,328,474 | 2 | null | 15,727,912 | 1 | null | This is the solution for
I needed SHA1 key for Google Cloud.
1. Run this command in your terminal where your project is. I was working on a Flutter project.
`keytool -keystore path-to-debug-or-production-keystore -list -v`
If it doesn't work and you get this error, follow along.
[](https://i.stack.imgur.com/VHWxQ.png)
1. Go to https://www.java.com and download and install the latest version of Java. Run the above command again, if you get another error like this follow along.
[](https://i.stack.imgur.com/WxkPy.png)
1. Run this command and this will give you SHA1, SHA256, MD5 for default debug key. And it can be used for developing and debugging with google play services.
`keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android`
[](https://i.stack.imgur.com/MVQDa.png)
| null | CC BY-SA 4.0 | null | 2022-11-05T14:15:12.973 | 2022-11-05T14:15:12.973 | null | null | 10,068,879 | null |
74,328,524 | 2 | null | 74,328,410 | 0 | null | ```
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div id="links">
<a href="index.html">Home</a>
<a href="profile.html">About me</a>
<a class="dropdown-toggle" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
Highlights
</a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink" style="background: gray; z-index: 100;">
<li><a class="dropdown-item" href="#">Basics</a></li>
<li><a class="dropdown-item" href="#">Fundamentals</a></li>
<li><a class="dropdown-item" href="#">Core statistics</a></li>
</ul>
<a href="contacts.html">Contact</a>
<a id="login" href="login.html">Login</a>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-11-05T14:19:56.573 | 2022-11-05T14:19:56.573 | null | null | 18,046,485 | null |
74,328,571 | 2 | null | 70,044,102 | 0 | null | for i in range(0,row):
for j in range(0,col):
if((j == 1 or j == col-1) and (i!=0 and i!=row+1)) :
cell[(i,j)] = ''
else:
cell[(i,j)] = " "
print(cell[(i,j)], end=" ")
print(end='\n')
| null | CC BY-SA 4.0 | null | 2022-11-05T14:28:51.960 | 2022-11-05T14:28:51.960 | null | null | 20,426,168 | null |
74,328,634 | 2 | null | 21,995,995 | 0 | null | You can use to capture screenshot. But it not gives Jframe Screenshot. We need to give correct coordinates and refer the frame. is my frame name and below code works for only Jframe area screenshot.
```
try {
Robot cap=new Robot();
Rectangle rec=new Rectangle(gFrame.getX(),gFrame.getY(),gFrame.getWidth(),gFrame.getHeight());
BufferedImage screenshot=cap.createScreenCapture(rec);
ImageIO.write(screenshot, "JPG",
new File("C:\\Users\\ruwan\\Downloads\\screenshot.jpg");
} catch (Exception e) {
e.printStackTrace();
}
```
| null | CC BY-SA 4.0 | null | 2022-11-05T14:36:58.030 | 2022-11-06T05:46:19.770 | 2022-11-06T05:46:19.770 | 19,273,724 | 19,273,724 | null |
74,328,761 | 2 | null | 40,967,295 | 0 | null | you can use this approach in a few steps:
1. Break the lines where they meet other lines and create a new list of lines (or paths)
2. Eliminate lines with one free end (if a line doesn't meet another one at the start or the end)
3. Start from one point and go through lines to the other points and try to find the correct route back to the start point (if you pass a duplicate point, the route is wrong)
4. Save newly found closed route
5. Eliminate all points that are inside the newly found area and connected lines
6. Eliminate all points with just two connected lines and also these two lines
7. Eliminate all lines that their center point is inside the newly found area
8. Go to step 3 until there left no line in the list
9. Now you have a list of enclosed areas
you can easily find a good approach for the calculation of the intersection point of two lines, the area of the enclosed part, the center point of a line, and Checking that a point is inside an area
Best wishes,
| null | CC BY-SA 4.0 | null | 2022-11-05T14:53:10.570 | 2022-11-05T15:07:09.160 | 2022-11-05T15:07:09.160 | 19,762,249 | 19,762,249 | null |
74,328,999 | 2 | null | 70,492,220 | 1 | null | I got exact same problem and fixed it by running
```
flutter clean
```
and then
```
flutter pub get
```
| null | CC BY-SA 4.0 | null | 2022-11-05T15:20:00.010 | 2022-11-05T15:20:00.010 | null | null | 14,111,427 | null |
74,329,057 | 2 | null | 74,328,143 | 0 | null | Im not sure without your code but try setting image `max-height: 90%;` Add `width: auto;` too if needed,
Hope it helps.
| null | CC BY-SA 4.0 | null | 2022-11-05T15:27:48.443 | 2022-11-05T15:27:48.443 | null | null | 17,838,075 | null |
74,329,218 | 2 | null | 74,326,548 | 1 | null |
1. AWS SDK for JavaScript v3 (AKA modular) is not installed globally in the lambda execution context. You are using a v3 module (@aws-sdk/client-cloudwatch-logs) which is why it fails. AWS SDK v2 is installed globally, you are also using it (aws-sdk) so that require works fine.
2. You should use a bundler like webpack, esbuild, parcel or rollup. If you are using AWS CDK, there is a nodejs function construct that will do the bundling with esbuild for you.
3. TS will only emit your compiled javascript. If you are depending on javascript found in your node_modules directory, simply include that directory in your deployment package.
4. Generally, bundlers will take your application entry points (main.js, handler.js, whatever you want really) and recursively resolve all the dependencies, tree-shake any unreachable code then create one file for each entry point that has no other external dependencies. There is a runtime performance cost to this of course but it does simplify things and in a serverless context it isn't usually too impactful.
So, to resolve your error you can take one of two approaches:
1. Include your node_modules directory in your deployment package. (trivial)
2. Use a bundler or CDK (more complex)
Note that in either case, you need to be careful about dependencies with native bindings (binaries basically) as the one installed on your dev machine likely isn't supported in the lambda environment.
| null | CC BY-SA 4.0 | null | 2022-11-05T15:50:51.903 | 2022-11-05T15:50:51.903 | null | null | 7,211,548 | null |
74,329,298 | 2 | null | 74,327,672 | 0 | null | You can disable comments in the ldif output of [ldapsearch](https://linux.die.net/man/1/ldapsearch) using the `-L` option :
> Search results are display in LDAP Data Interchange Format detailed in
ldif(5). A single `-L` restricts the output to LDIFv1. A second `-L`
disables comments. A third `-L` disables printing of the LDIF version.
The default is to use an extended version of LDIF.
```
ldapsearch -LL [options]
```
Note that instead of turning whole dn string into base64, you could write accented characters as printable ASCII by escaping the hex pair given by their UTF-8 encoding, as specified by [RFC 4514](https://www.rfc-editor.org/rfc/rfc4514.txt) :
```
Unicode Letter Description UCS code UTF-8 Escaped
------------------------------- -------- ------ --------
Latin Small Letter E with Acute U+00E9 0xC3A9 \C3\A9
Latin Small Letter E with Grave U+00E8 0xC3A8 \C3\A8
```
Which indeed turns the dn into :
```
dn: ou=\C3\A9l\C3\A8ves,ou=1A,ou=Classes,ou=Personnes,dc=ldap,dc=ecoleplurielle,dc=local
```
It would be interesting to check whether phpLDAPadmin has a problem with this encoding, or if the crash was caused by the base64 encoded dn or something else (I would be glad to have your feedback!).
---
[Edit] - It seems related to this [issue](https://github.com/leenooks/phpLDAPadmin/issues/132).
| null | CC BY-SA 4.0 | null | 2022-11-05T16:01:03.010 | 2022-11-06T14:51:33.670 | 2022-11-06T14:51:33.670 | 2,529,954 | 2,529,954 | null |
74,329,773 | 2 | null | 74,329,649 | 0 | null | Try this:
```
context = {
'student_fees':student_fees['fees__sum']
}
```
| null | CC BY-SA 4.0 | null | 2022-11-05T17:02:46.530 | 2022-11-05T17:04:42.157 | 2022-11-05T17:04:42.157 | 17,562,044 | 16,113,778 | null |
74,330,212 | 2 | null | 62,061,669 | 0 | null | Here is my attempt. This is mostly relying on `sf` but I use `smoothr::densify()` to add vertices to straight edges of polygons (since the voronoi polygons are initially built around the polygon vertices), and I rely on a function from `data.table` to combine sf objects. There are probably ways to make this more efficient.
You would probably also want to simplify input polygons, although that is not needed in this test case.
The one really unresolved issue is for when two polygons share a boundary. The polygon-based voronoi should just follow that boundary, but currently does not.
```
library(sf)
# additionally requires:
## smoothr to densify polygons
## data.table to combine results
## poly = input sf polygons
## clip = polygon to be used as an extent for the output
## max_distance = argument for smoothr::densify, what max distance to have between vertices of a polygon. For breaking up long edges. In map units.
polyVoronoi <- function(poly, clip = NULL, max_distance = NULL) {
# add vertices to polygons to have voronoi polygons along straight edges of polygon
if (!is.null(max_distance)) {
poly <- smoothr::densify(poly, max_distance = max_distance)
}
# generate voronoi polygons for all vertices
vv <- st_voronoi(st_combine(poly))
vv <- st_collection_extract(vv, 'POLYGON')
# deal with geom validity issues
if (!all(st_is_valid(vv))) {
for (i in 1:length(vv)) {
vv[i] <- st_make_valid(vv[i])
if (!all(st_is_valid(vv[i]))) stop()
}
}
# determine which voronoi polygons intersect with input polygons
ii <- st_intersects(poly, vv)
# union/dissolve voronoi polygons that belong to the same inputs
resList <- vector('list', length(ii))
for (i in 1:length(ii)) {
xx <- vv[ii[[i]]]
xx <- st_combine(xx)
if (!all(st_is_valid(xx))) {
xx <- st_make_valid(xx)
}
resList[[i]] <- st_union(xx)
}
res <- st_as_sf(data.table::rbindlist(lapply(resList, st_as_sf)))
res <- res[1:nrow(res),]
res <- st_geometry(res)
if (!is.null(clip)) {
res <- st_intersection(res, clip)
}
return(res)
}
```
Example using built in dataset from `sf`
```
nc = st_read(system.file("shape/nc.shp", package="sf"))
# project to North America Albers Equal Area
nc <- st_transform(nc, crs = "+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs")
poly = st_geometry(nc)
# sample just a few polygons
poly <- poly[sample(1:length(poly), 12)]
# define bounds that we want for the output
e <- st_buffer(st_make_grid(poly, n = 1), 50000)
vv <- polyVoronoi(poly, clip = e, max_distance = 10000)
plot(vv, border = 'blue')
plot(poly, add = TRUE)
```
[](https://i.stack.imgur.com/GJFoD.png)
As you can see, there is a problem when polygons are in contact, and I haven't resolved this yet. Suggestions welcome!
| null | CC BY-SA 4.0 | null | 2022-11-05T18:01:03.070 | 2022-11-05T18:01:03.070 | null | null | 983,332 | null |
74,330,504 | 2 | null | 74,329,601 | 0 | null | You defined the map Variable in the top, you don't need to define it again, just set the value for variable in the initState function.
```
initState(){
super.initState();
map = {};
loadData();
}
```
| null | CC BY-SA 4.0 | null | 2022-11-05T18:38:04.337 | 2022-11-05T18:38:04.337 | null | null | 12,858,184 | null |
74,330,796 | 2 | null | 74,330,776 | 1 | null | You need to use a while loop here, not a do..while.
A do..while loop runs its body at least once, and then checks the condition - so it will show the error message at least once no matter what.
Instead, use a while loop, which checks the condition first:
```
while (input does not contain r, c or p) {
// Show error, ask for new input
}
// Input is now valid
```
| null | CC BY-SA 4.0 | null | 2022-11-05T19:16:53.913 | 2022-11-05T19:16:53.913 | null | null | 12,412,262 | null |
74,330,923 | 2 | null | 74,330,776 | 3 | null | The main problem in your program is the condition you specified for the loop. If the input is not "c" or not "r" or not "p" the loop will continue. But the input will always be not "c" or not "r", if your input is for example "p". You should seperate the conditions with an `and` not an `or`.
```
while (!customerCode.contentEquals("r") && !customerCode.contentEquals("c") && !customerCode.contentEquals("p"));
```
| null | CC BY-SA 4.0 | null | 2022-11-05T19:35:32.150 | 2022-11-05T19:38:28.710 | 2022-11-05T19:38:28.710 | 286,934 | 20,427,794 | null |
74,332,511 | 2 | null | 2,588,181 | 0 | null | I believe CSS has much better machinery for specifying the size of the canvas and CSS must decide styling, not JavaScript or HTML. Having said that, setting width and height in HTML is important for working around the issue with canvas.
CSS has [!important](https://www.w3schools.com/css/css_important.asp) rule that allows to override other styling rules for the property, including those in HTML. Usually, its usage is frowned upon but here the use is a legitimate .
In Rust module for WebAssembly you can do the following:
```
fn update_buffer(canvas: &HtmlCanvasElement) {
canvas.set_width(canvas.client_width() as u32);
canvas.set_height(canvas.client_height() as u32);
}
//..
#[wasm_bindgen(start)]
pub fn start() -> Result<(), JsValue> {
// ...
let canvas: Rc<_> = document
.query_selector("canvas")
.unwrap()
.unwrap()
.dyn_into::<HtmlCanvasElement>()
.unwrap()
.into();
update_buffer(&canvas);
// ...
// create resizing handler for window
{
let on_resize = Closure::<dyn FnMut(_)>::new(move |_event: Event| {
let canvas = canvas.clone();
// ...
update_buffer(&canvas);
// ...
window.add_event_listener_with_callback("resize", on_resize.as_ref().unchecked_ref())?;
on_resize.forget();
}
}
```
There we update the canvas buffer once the WASM module is loaded and then whenever the window is resized. We do it by manually specifying `width` and `height` of canvas as values of [clientWidth](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth) and [clientHeight](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight). Maybe there are better ways to update the buffer but I believe this solution is better than those suggested by @SamB, @CoderNaveed, @Anthony Gedeon, @Bluerain, @Ben Jackson, @Manolo, @XaviGuardia, @Russel Harkins, and @fermar because
1. The element is styled by CSS, not HTML.
2. Unlike elem.style.width & elem.style.height trick used by @Manolo or its JQuery equivalent used by @XaviGuardia, it will work for canvas whose size is specified by usage as flex or grid item.
3. Unlike the solution by @Russel Harkings, this also handles resizing. Though I like his answer because it is really clean and easy.
4. WASM is the future! Haha :D
P.S. there's a ton of `.unwrap()` because Rust explicitly handles possible failures.
P.P.S.
```
{
let on_resize = Closure::<dyn FnMut(_)>::new(move |_event: Event| {
let canvas = canvas.clone();
// ...
update_buffer(&canvas);
// ...
window.add_event_listener_with_callback("resize", on_resize.as_ref().unchecked_ref())?;
on_resize.forget();
}
```
can be done much cleaner with better libraries. E.g.
```
add_resize_handler(&window, move |e: ResizeEvent| {
let canvas = canvas.clone();
// ...
update_buffer(&canvas);
})
```
| null | CC BY-SA 4.0 | null | 2022-11-06T00:40:14.643 | 2022-11-06T00:40:14.643 | null | null | 8,341,513 | null |
74,332,879 | 2 | null | 73,930,707 | 0 | null | > Note that the version of rbenv that is packaged and maintained in the Debian and Ubuntu repositories is out of date. To install the latest version, it is recommended to install rbenv using git.
Use this to install the latest version: [https://github.com/rbenv/rbenv#basic-git-checkout](https://github.com/rbenv/rbenv#basic-git-checkout)
| null | CC BY-SA 4.0 | null | 2022-11-06T02:15:41.647 | 2022-11-06T02:15:41.647 | null | null | 19,805,224 | null |
74,333,661 | 2 | null | 74,333,578 | 0 | null | You can use IconButton.
```
IconButton(
icon: Icon(Icons.save),
onPressed: () {
// some action
},
),
```
or if you have to use custom icon/image on your button then
```
GestureDetector(
onTap: (){},
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(image: DecorationImage(image: AssetImage("path")))
)
)
```
| null | CC BY-SA 4.0 | null | 2022-11-06T06:16:43.747 | 2022-11-06T06:16:43.747 | null | null | 11,283,638 | null |
74,333,850 | 2 | null | 74,331,828 | 1 | null | That number of colours (ten) is quite expected: your `colorScales.quantiles()` will simply return your range array (which has eleven elements) with one value less. The docs about [quantiles()](https://github.com/d3/d3-scale#quantile_quantiles) explain how it works:
> Returns the quantile thresholds. If the range contains n discrete values, the returned array will contain n - 1 thresholds.
That said, there's something not directly related to your question but very important: this is the correct way to use a quantile scale: you have to pass the whole data array, that is, the `domain` is a population of values, not only the minimum and maximum. So, instead of:
```
domain([educMin, educMax])
```
It should be:
```
domain([mapData.objects.counties.geometries].map(d => d.properties.bachelorsOrHigher))
```
---
Edit: answering a comment, here's how your map looks like with the correct domain:
```
fetch('https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/counties.json')
.then(response => response.json())
.then(data => {
const mapData = data;
return fetch('https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/for_user_education.json')
.then(response => response.json())
.then(data => {
const educationData = data;
const mapDataEducationAdded = mapData.objects.counties.geometries.forEach((x => {
x.properties = educationData.find(({
fips
}) => fips === x.id);
}));
const colourScale = d3.scaleQuantile()
.domain(mapData.objects.counties.geometries.map(d => d.properties.bachelorsOrHigher))
.range(['#fff5eb', '#fee8d3', '#fdd8b3', '#fdc28c', '#fda762', '#fb8d3d', '#f2701d', '#e25609', '#c44103', '#9f3303', '#7f2704']);
const toolTip = d3.selectAll('div#chart-container')
.data(mapData.objects.counties.geometries)
.enter()
.append('div')
.style('visibility', 'hidden')
.style('position', 'absolute')
.style('background-color', '#e6ffff')
.style('white-space', 'pre')
.style('padding', '10px')
.style('text-align', 'center')
.style('opacity', '0.8')
.attr('id', 'tooltip');
const toolTipMouseOver = (event, d) => {
toolTip.text(`State: ${d.properties.state}
County: ${d.properties.area_name}
Bachelor's degree: ${d.properties.bachelorsOrHigher}%`);
toolTip.style('top', (event.pageY) + 'px')
.style('left', (event.pageX) + 'px')
.attr('data-education', d.properties.bachelorsOrHigher);
return toolTip.style('visibility', 'visible')
}
const toolTipMouseOut = (event, d) => {
return toolTip.style('visibility', 'hidden');
}
const map = d3.select('div#chart-container')
.append('svg')
.attr('viewBox', '0 0 960 600')
.attr('id', 'chart');
const path = d3.geoPath();
map.selectAll('path')
.data(topojson.feature(mapData, mapData.objects.counties).features)
.enter()
.append('path')
.attr('d', path)
.attr('fill', d => colourScale(d.properties.bachelorsOrHigher))
.attr('class', 'county')
.attr('data-fips', d => d.properties.fips)
.attr('data-education', d => d.properties.bachelorsOrHigher)
.on('mouseover', toolTipMouseOver)
.on('mouseout', toolTipMouseOut);
map.selectAll(null)
.data(topojson.feature(mapData, mapData.objects.states).features)
.enter()
.append('path')
.attr('d', path)
.attr('class', 'state')
.attr('stroke', '#cccccc')
.attr('stroke-width', '0.5px')
.attr('fill', 'none');
});
});
```
```
body {
background-color: #cccccc;
font-family: 'Open Sans', sans-serif;
text-align: center;
}
#chart-container-container {
display: flex;
align-items: center;
justify-content: center;
}
#chart-container {
width: 100%;
}
#chart {
width: 70vw;
height: 38vw;
}
#title {
margin-bottom: 0;
}
#description {
font-size: 18px;
}
#tooltip {
font-family: 'Open Sans', sans-serif;
opacity: 0.8;
}
/* Opacity doesn't work? */
```
```
<h3 id=t itle>US adult educational attainment (2010-2014)</h1>
<h4 id=d escription>Proportion of adults aged ≥25 years with a bachelor degree or higher</h2>
<div id='chart-container-container'>
<div id='chart-container'></div>
</div>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://unpkg.com/topojson@3"></script>
```
| null | CC BY-SA 4.0 | null | 2022-11-06T06:53:53.917 | 2022-11-07T01:40:24.897 | 2022-11-07T01:40:24.897 | 5,768,908 | 5,768,908 | null |
74,334,795 | 2 | null | 74,191,324 | 13 | null | Upgraded android gradle plugin to 7.2.2 and the problem is solved. Try updating Android Studio too
| null | CC BY-SA 4.0 | null | 2022-11-06T09:56:24.050 | 2022-11-06T09:56:24.050 | null | null | 7,904,082 | null |
74,336,833 | 2 | null | 14,618,028 | 0 | null | Try the following code:
```
.yourClassName{
border: 0;
outline: none;
}
```
| null | CC BY-SA 4.0 | null | 2022-11-06T14:38:39.387 | 2022-11-07T06:54:54.027 | 2022-11-07T06:54:54.027 | 16,124,033 | 18,075,212 | null |
74,337,423 | 2 | null | 74,327,898 | 0 | null | Ok, so it seems we must include "https://", otherwise the link won't work. So:
```
[](https://www.linkedin.com/in/myprofile)
```
| null | CC BY-SA 4.0 | null | 2022-11-06T15:53:08.803 | 2022-11-06T15:53:08.803 | null | null | 11,644,523 | null |
74,337,483 | 2 | null | 74,337,251 | 0 | null | - Your first step should be splitting the data from the different questions into separate tables, then "Unpivot Other Columns" but . You can later relate the tables in the report via this .- From here creating your column charts should be a no-brainer.- Starting with a list of question identifiers ("Q1", "Q2", ...) you can automate the splitting via a - I doubt that with Excel imports you'll come anywhere close to Power BI's data limits. However, I am surprised that they are providing such an awkward interface.
| null | CC BY-SA 4.0 | null | 2022-11-06T15:59:28.130 | 2022-11-06T19:10:01.943 | 2022-11-06T19:10:01.943 | 7,108,589 | 7,108,589 | null |
74,337,608 | 2 | null | 63,209,126 | 5 | null | Please follow the steps below:
1. Open the Terminal.
2. Type: nano ~/.zshrc
3. Type: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
[](https://i.stack.imgur.com/cDeXa.png)
1. Press control+x to Exit
2. Type: source ~/.zshrc
3. Restart the Terminal.
4. Verify by typing flutter --version
[](https://i.stack.imgur.com/F3anX.png)
| null | CC BY-SA 4.0 | null | 2022-11-06T16:18:03.733 | 2022-11-06T16:18:03.733 | null | null | 6,921,031 | null |
74,337,662 | 2 | null | 74,337,624 | 0 | null | Use `z-index`
The `z-index` prioritizes the stacking of elements.
Give the select option a higher `z-index` than the card element.
| null | CC BY-SA 4.0 | null | 2022-11-06T16:26:03.757 | 2022-11-06T16:26:03.757 | null | null | 19,603,779 | null |
74,337,702 | 2 | null | 74,337,624 | 0 | null | You have to add css property to the expended box.
eg. `z-index: 12;`
| null | CC BY-SA 4.0 | null | 2022-11-06T16:30:20.993 | 2022-11-06T16:30:20.993 | null | null | 7,758,445 | null |
74,337,708 | 2 | null | 16,748,577 | 1 | null | I ran into the same issue, trying to merge in a single matplotlib figure axes built with different python packages for which I can't easily access the data.
I could make a dirty work around, by saving the images as a png file, then reimporting them as images and create axes based on it.
Here's a function doing it (It's ugly, and you'll need to adapt it, but it does the job).
```
import cairosvg
import matplotlib.pyplot as plt
from PIL import Image
from io import BytesIO
def merge_2axes(fig1,fig2,file_name1="f1.png",file_name2="f2.png"):
fig1.savefig(file_name1)
fig2.savefig(file_name2)
fig, (ax1, ax2) = plt.subplots(2, figsize=(30, 30))
if file_name1[-3:] == "svg":
img_png = cairosvg.svg2png(url=file_name1)
img = Image.open(BytesIO(img_png))
ax1.imshow(img)
else:
ax1.imshow(plt.imread(file_name1))
if file_name2[-3:] == "svg":
img_png = cairosvg.svg2png(url=file_name2)
img = Image.open(BytesIO(img_png))
ax2.imshow(img)
else:
ax2.imshow(plt.imread(file_name2))
ax1.spines['top'].set_visible(False)
ax1.spines['left'].set_visible(False)
ax1.spines['bottom'].set_visible(False)
ax1.spines['right'].set_visible(False)
ax2.spines['top'].set_visible(False)
ax2.spines['left'].set_visible(False)
ax2.spines['bottom'].set_visible(False)
ax2.spines['right'].set_visible(False)
ax1.tick_params(left = False, right = False , labelleft = False ,
labelbottom = False, bottom = False)
ax2.tick_params(left = False, right = False , labelleft = False ,
labelbottom = False, bottom = False)
return fig
```
| null | CC BY-SA 4.0 | null | 2022-11-06T16:31:16.363 | 2022-11-07T23:26:34.940 | 2022-11-07T23:26:34.940 | 2,491,639 | 2,491,639 | null |
74,337,788 | 2 | null | 23,500,772 | 0 | null | I came across the same few times and with further research I was able solve the little issues by using the library below
[Math.js](https://github.com/josdejong/mathjs) Library
Sample
```
import {
atan2, chain, derivative, e, evaluate, log, pi, pow, round, sqrt
} from 'mathjs'
// functions and constants
round(e, 3) // 2.718
atan2(3, -3) / pi // 0.75
log(10000, 10) // 4
sqrt(-4) // 2i
pow([[-1, 2], [3, 1]], 2) // [[7, 0], [0, 7]]
derivative('x^2 + x', 'x') // 2 * x + 1
// expressions
evaluate('12 / (2.3 + 0.7)') // 4
evaluate('12.7 cm to inch') // 5 inch
evaluate('sin(45 deg) ^ 2') // 0.5
evaluate('9 / 3 + 2i') // 3 + 2i
evaluate('det([-1, 2; 3, 1])') // -7
// chaining
chain(3)
.add(4)
.multiply(2)
.done() // 14
```
| null | CC BY-SA 4.0 | null | 2022-11-06T16:39:53.357 | 2022-11-06T16:39:53.357 | null | null | 8,709,603 | null |
74,338,022 | 2 | null | 74,337,900 | 1 | null | that is probably because of what you used to center your content.
You should consider using display flex to center your content in your body.
You used translate top with 50% which is not related to the height of your page
| null | CC BY-SA 4.0 | null | 2022-11-06T17:09:56.423 | 2022-11-06T17:09:56.423 | null | null | 17,183,809 | null |
74,338,912 | 2 | null | 29,253,704 | 0 | null | ```
Sub example()
'Assume we have Workbook with 2 worksheets.
'Sheet1 have (Name) Sheet_TITLE(1) and Name TITLE1
'Sheet2 have (Name) Sheet_TITLE2) and Name TITLE2
'Name is equal to Caption of command button
'The coderows below have a similar effect - activates Sheet2
Sheets(2).Activate
'OR
Sheet_TITLE2.Activate
'OR
Sheets("Title2").Activate
End Sub
Sub msg_box()
MsgBox Sheet_TITLE2.CodeName
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-11-06T19:06:02.173 | 2022-11-06T19:11:22.953 | 2022-11-06T19:11:22.953 | 14,191,423 | 14,191,423 | null |
74,339,127 | 2 | null | 74,339,065 | 0 | null | ShortMove is a Typescript type, if you are not using Typescript you don't need to worry about that and can remove it.
If you ARE using typescript and they do not show up you should made sure that in addition to installing the Library from with `npm install chess.js` you also installed the types by running:
`npm install -D @types/chess.js`
from the commandline
That command comes from the instalation instructions here:
[https://github.com/jhlywa/chess.js/blob/master/README.md](https://github.com/jhlywa/chess.js/blob/master/README.md)
| null | CC BY-SA 4.0 | null | 2022-11-06T19:36:01.503 | 2022-11-06T19:36:01.503 | null | null | 12,641,617 | null |
74,339,399 | 2 | null | 74,337,995 | 0 | null | Simply change
```
<div style="width:1000px; height:1600px; background-color:999999; margin:0 auto;">
```
To
```
<div style="width:100%; background-color:999999; margin:0 auto;">
```
Now go change the width of other divs, and do not use Pixels as a measure, simply use %
Remember the final width of all divs should be 100%
For example
```
div 1 = 30%
div 2 = 50%
div 3 = 20%
```
| null | CC BY-SA 4.0 | null | 2022-11-06T20:12:34.670 | 2022-11-06T20:12:34.670 | null | null | 20,400,911 | null |
74,339,481 | 2 | null | 70,728,496 | 0 | null | I think you are hard-refreshing the whole order object, inclusing all it's eagerloaded relations. When you just refresh the worklist you can save a query.
```
public function delete($id)
{
$work = Worklist::find($id);
$this->order->worklist()->detach($work);
$this->order->worklist()->refresh();
$this->tempTotal();
}
```
| null | CC BY-SA 4.0 | null | 2022-11-06T20:24:13.450 | 2022-11-06T20:24:13.450 | null | null | 2,815,350 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.