Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
⌀ | ParentId
int64 1.68k
75.6M
⌀ | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
⌀ | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
⌀ | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 1
21.3M
⌀ | Tags
list |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
73,825,577 | 2 | null | 73,825,499 | 12 | null | Just apply the `weight(1f, fill=false)` modifier to the `Text`.
> When fill is `true`, the element will be forced to occupy the whole width allocated to it. Otherwise, the element is allowed to be smaller - this will result in Row being smaller,
Something like:
```
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
) {
Text(
text = "subjectName",
modifier = Modifier.weight(1f, false),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Icon(
Icons.Filled.Add,
contentDescription = "contentDescription"
)
}
```
[](https://i.stack.imgur.com/meB79.png)
| null | CC BY-SA 4.0 | null | 2022-09-23T09:20:08.457 | 2022-09-23T09:25:11.747 | 2022-09-23T09:25:11.747 | 2,016,562 | 2,016,562 | null |
73,826,060 | 2 | null | 73,825,845 | 0 | null | There's a answer over here:
[pandas to_datetime parsing wrong year](https://stackoverflow.com/questions/37766353/pandas-to-datetime-parsing-wrong-year)
It's due to 2 digit years from 0-68 mapping to 20xx.
| null | CC BY-SA 4.0 | null | 2022-09-23T10:01:42.470 | 2022-09-23T10:01:42.470 | null | null | 9,441,249 | null |
73,826,223 | 2 | null | 73,823,854 | 0 | null | Bootstrap hides overflow so you can apply this style to the progressBar or you can make a new CSS class and apply this style rather than the inline style
```
style="position: absolute; width:20%; color: black; text-align: left; overflow: visible;"
```
You can make some adjustment according to your use case
| null | CC BY-SA 4.0 | null | 2022-09-23T10:14:57.313 | 2022-09-23T10:14:57.313 | null | null | 8,422,024 | null |
73,826,305 | 2 | null | 63,215,635 | 0 | null | To make the top or any other header sticky for section list, provide a custom scroll component:
```
const CustomScrollComponent = (props) => <ScrollView {...props} stickyHeaderHiddenOnScroll={true} stickyHeaderIndices={[0]} />
```
then in your section list:
```
<SectionList
// other props
renderScrollComponent={CustomScrollComponent}
/>
```
| null | CC BY-SA 4.0 | null | 2022-09-23T10:22:26.073 | 2022-09-23T10:22:26.073 | null | null | 4,998,659 | null |
73,826,630 | 2 | null | 73,819,089 | 0 | null | You need to cast `namedLocation` to `IpNamedLocation` type.
```
foreach (var namedLocation in namedlocationsList)
{
Console.WriteLine(namedLocation.Id + namedLocation.DisplayName + namedLocation.ODataType + namedLocation);
if (namedLocation is IpNamedLocation ipNamedLocation)
{
var isTrusted = ipNamedLocation.IsTrusted;
var ipRanges = ipNamedLocation.IpRanges;
if (ipRanges is IEnumerable<IPv4CidrRange> ipv4cidrRanges)
{
foreach(var ipv4cidrRange in ipv4cidrRanges)
{
Console.WriteLine($"{ipv4cidrRange.CidrAddress}");
}
}
Console.WriteLine("Write out all the properties");
}
}
```
| null | CC BY-SA 4.0 | null | 2022-09-23T10:51:20.113 | 2022-09-27T14:21:10.410 | 2022-09-27T14:21:10.410 | 2,250,152 | 2,250,152 | null |
73,826,635 | 2 | null | 73,826,619 | 0 | null | use:
```
=IF(200>=205; "yes"; "no")
```
and substitute `200` & `205` with respective cells
| null | CC BY-SA 4.0 | null | 2022-09-23T10:51:27.500 | 2022-09-23T10:51:27.500 | null | null | 5,632,629 | null |
73,826,668 | 2 | null | 73,826,198 | 1 | null | The test fails because the content of the json is different to that being tested. You probably want to test that the structure is the same, rather than the content:
```
/** @test */
public function users_can_view_homepage_products()
{
$response = $this->get('api/products');
$response->assertStatus(200)
->assertJsonStructure([
'id',
'name'
'slug'
'intro'
'price'
]);
}
```
| null | CC BY-SA 4.0 | null | 2022-09-23T10:55:00.500 | 2022-09-23T10:55:00.500 | null | null | 1,424,591 | null |
73,826,689 | 2 | null | 65,472,584 | 1 | null | While I'm not exactly sure why, setting `animation.fillMode = .both` or `.backwards` seems to solve the flicker problem. Per the documentation for this value:
```
The receiver clamps values before zero to zero when the animation is completed.
```
So I suspect what's happening is that when it is first attached, the animation is being shown at a time offset < 0 and by clamping it you ensure it shows a valid state at all times.
| null | CC BY-SA 4.0 | null | 2022-09-23T10:56:56.177 | 2022-09-23T10:56:56.177 | null | null | 422,133 | null |
73,827,104 | 2 | null | 24,985,529 | 1 | null |
# You can use a CSS filter with SVG, called "Gooey Effect"
Full explanation: [https://css-tricks.com/gooey-effect/](https://css-tricks.com/gooey-effect/)
Live demo: [https://codepen.io/ines/pen/NXbmRO](https://codepen.io/ines/pen/NXbmRO)
## Example code:
```
<h1>
<div class="highlight" contenteditable="true">This is an example of a simple headline or text with rounded corners using<br>a gooey SVG filter.</div>
</h1>
<!-- Create the SVG Filter: https://css-tricks.com/gooey-effect/ -->
<svg style="visibility: hidden; position: absolute;" width="0" height="0" xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<filter id="goo"><feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9" result="goo" />
<feComposite in="SourceGraphic" in2="goo" operator="atop"/>
</filter>
</defs>
</svg>
```
```
:root {
--color-bg: #34304c;
--color-bg2: #534d7a;
--color-highlight: #fff;
--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
.highlight {
filter: url('#goo'); /* Apply the SVG filter*/
font-size: 3rem;
line-height: 1.48;
display: inline;
box-decoration-break: clone;
background: var(--color-highlight);
padding: 0.5rem 1rem;
}
.highlight:focus {
outline: 0;
}
body {
padding: 7.5vh 100px 0 100px;
font-family: var(--font);
background: var(--color-bg);
}
```
| null | CC BY-SA 4.0 | null | 2022-09-23T11:37:43.270 | 2022-09-23T11:37:43.270 | null | null | 3,910,375 | null |
73,827,653 | 2 | null | 73,286,245 | 1 | null | You can fix just by substituting some `\hline` with `\cline{1-3}`. More precisely, where `multirow` spans `n` rows, you must make this substitution `n-1` times after it.
```
\documentclass[12pt,a4paper]{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[margin=1in]{geometry}
\begin{document}
\renewcommand{\arraystretch}{1.5}
\centering
\begin{tabular}{c|c|c|c}
\hline
\textbf{ Classification} & \textbf{Total Impulse} & \textbf{Total Impulse} & \textbf{Type/}\\
& (Newton-Seconds) & (Pounds-Seconds) & \textbf{US Requirements}\\
\hline
%___________Micro____________
1/8 A & 0—0.3125 \textbf{N·s} & 0 – 0.07 lbf·s & \multirow{1}{*}\textbf{Micro} \\%[.3cm]
%\cline{3-4}
%\cline{4-5}
\hline
%_________Low Power_________
1/4 A & 0.3126 – 0.625 N·s & 0.071 – 0.14 lbf·s & \multirow{6}{*}{Low Power}\\
\cline{1-3}
1/2 A & 0.626 – 1.25 N·s & 0.141 – 0.28 lbf·s & \\
\cline{1-3}
A & 0.626 – 1.25 N·s & 0.141 – 0.28 lbf·s & \\
\cline{1-3}
B & 2.51 – 5.00 N·s & 0.561 – 1.12 lbf·s & \\
\cline{1-3}
C & 5.01 – 10.0 N·s & 1.121 – 2.25 lbf·s & \\
\cline{1-3}
D & 10.01 – 20.0 N·s & 2.251 – 4.5 lbf·s & \\
\hline
%_______Mid Power__________
E & 20.01 – 40.0 N·s & 4.51 – 8.99 lbf·s & \multirow{3}{*}{Mid Power}\\
\cline{1-3}
F & 40.01 – 80.0 N·s & 8.991 – 18.0 lbf·s & \\
\cline{1-3}
G & 80.01 – 160 N·s & 18.01 – 36.0 lbf·s & \\
\hline
%_____High Power | Level 1_________
H & 160.01 – 320 N·s & 36.01 – 71.9 lbf·s & \multirow{2}{150px}{\textbf{ High Power | Level 1} \newline
Level 1 Certification required for purchase. Certification available through Tripoli or NAR. Under 125g propellant is Federal Aviation Administration exempt.}\\
\cline{1-3}
I & 320.01 – 640 N·s & 71.9 – 144 lbf·s & \\[2cm]
\hline
%____High Power | Level 2 _____
J & 640.01 – 1,280 N·s & 144.01–288 lbf·s & \multirow{3}{150px}{\textbf{ High Power | Level 2} \newline
Level 2 Certification required for purchase. Certification available through Tripoli or NAR.}\\
\cline{1-3}
K & 1,280.01 – 2,560 N·s & 288.01–576 lbf·s & \\
\cline{1-3}
L & 2,560.01 – 5,120 N·s & 576.01–1,151 lbf·s & \\[.2cm]
\hline
%_______High Power | Level 3________
M & 5,120.01 – 10,240 N·s & 1,151.01–2,302 lbf·s & \multirow{3}{150px}{\textbf{ High Power | Level 3}
\newline
Level 3 Certification required for purchase. Certification available through Tripoli or NAR.}\\
\cline{1-3}
N & 10,240.01 – 20,480 N·s & 2,302.01–4,604 lbf·s & \\
\cline{1-3}
O & 20,480.01 – 40,960 N·s & 4,604.01–9,208 lbf·s & \\[.2cm]
\hline
\end {tabular}
\end{document}
```
The output:
[](https://i.stack.imgur.com/1lQoH.png)
Also, `\begin{tabular}{c|c|c|c{3.5cm}}` and `\multirow{3}{150}{}` give errors, at least with this header.
| null | CC BY-SA 4.0 | null | 2022-09-23T12:21:16.783 | 2022-09-23T12:21:16.783 | null | null | 3,543,233 | null |
73,827,923 | 2 | null | 61,845,226 | 0 | null | [equation to be minimzed](https://i.stack.imgur.com/WEdRQ.png)hey how to solve these type of prolems
problem:
Minimization
> summation(xij*yij)
i=from 0 to 4000
j= from 0 to 100
y is coast matrix given
```
m = GEKKO(remote=False)
dem_var = m.Array(m.Var,(4096,100),lb=0)
for i,j in s_d:
m.Minimize(sum([dem_var[i][j]*coast_new[i][j]]))
```
here y=coast_new
x= dem_var
| null | CC BY-SA 4.0 | null | 2022-09-23T12:43:38.677 | 2022-09-23T12:44:34.493 | 2022-09-23T12:44:34.493 | 16,321,809 | 16,321,809 | null |
73,828,264 | 2 | null | 73,825,845 | 0 | null | what if just replace years?
```
sf['Datum'] = pd.to_datetime(sf['Datum'].str.replace(r'(\d\d)$',r'19\1'))
```
| null | CC BY-SA 4.0 | null | 2022-09-23T13:12:58.997 | 2022-09-23T13:12:58.997 | null | null | 18,344,512 | null |
73,828,382 | 2 | null | 19,248,443 | 2 | null | I have [an online generator](https://css-generators.com/custom-corners/) from where you can easily get such shape. Select your configuration and you will get the `clip-path` values
[](https://i.stack.imgur.com/NQLX5.png)
```
.box {
display: inline-grid;
position: relative;
/* from the generator */
clip-path: polygon(0 102.00px,102.00px 0,100% 0,100% 100%,0 100%);
}
.box:before {
content: "";
position: absolute;
inset: 0;
background: red; /* your border color */
/* from the generator*/
clip-path: polygon(0 102.00px,102.00px 0,100% 0,100% 100%,0 100%,0 102.00px,10px calc(102.00px + 4.14px),10px calc(100% - 10px),calc(100% - 10px) calc(100% - 10px),calc(100% - 10px) 10px,calc(102.00px + 4.14px) 10px,10px calc(102.00px + 4.14px));
}
```
```
<div class="box">
<img src="https://picsum.photos/id/1069/400/250">
</div>
```
| null | CC BY-SA 4.0 | null | 2022-09-23T13:21:51.393 | 2022-09-23T13:21:51.393 | null | null | 8,620,333 | null |
73,828,597 | 2 | null | 26,889,970 | 1 | null | This and another kind of "Could not autowire. No Beans of ..." can be solve by installing the plugin, in my case was JobBuilderFactory from Spring Batch.
[](https://i.stack.imgur.com/ZnOKU.png)
| null | CC BY-SA 4.0 | null | 2022-09-23T13:37:38.087 | 2022-09-23T13:37:38.087 | null | null | 1,000,908 | null |
73,828,910 | 2 | null | 73,813,480 | 0 | null | Thank you all for the feedback.
I have not been able to use your suggestions exactly as intended.
But I managed to combine the idea's and create a new piece that does the trick for me!
```
const checkm = document.getElementById('check');
checkm.addEventListener('click', serialChecker)
async function serialChecker(){
const url = 'http://localhost/validator2/naamloos.csv';
const response = await fetch(url);
// wait for the request to be completed
const serialdata = await response.text();
const table = serialdata.split('\r\n');
const serialsArray = [];
const nameArray = [];
table.forEach(row =>{
const column = row.split(',');
const sArray = column[0];
const nArray = column[1];
serialsArray.push(sArray);
nameArray.push(nArray);
})
var array1 = serialsArray,
array2 = nameArray,
result = [],
i, l = Math.min(array1.length, array2.length);
for (i = 0; i < l; i++) {
result.push(array1[i], array2[i]);
}
result.push(...array1.slice(l), ...array2.slice(l));
function testfunction(array, variable){
var varindex = array.indexOf(variable)
return array[varindex+1]
}
//calling the function + userinput for serial
const inputserialnumber = document.getElementById('serialnumber').value.toString();
console.log(testfunction(result, inputserialnumber))
if(serialsArray.includes(inputserialnumber) == true && inputserialnumber.length == 7 ){
document.getElementById('validity').innerHTML = "Valid " + testfunction(result, inputserialnumber);
startConfetti();
}else {
document.getElementById('validity').innerHTML = "Invalid";
stopConfetti();
}
}
```
Hope this can help someone out in having an input field on their website with a .csv file in the backend (possible to have multiple for the user to select with a dropdown box with the async function).
This will check the file & will return the value from the csv that matches the serial!(based on serial number & length of the serial number(7characters))
| null | CC BY-SA 4.0 | null | 2022-09-23T13:59:36.567 | 2022-09-23T15:28:09.950 | 2022-09-23T15:28:09.950 | 20,060,808 | 20,060,808 | null |
73,829,133 | 2 | null | 30,340,486 | 0 | null | Click Run As > Java.
If Java is not available there, click Run Configurations > JRE.
Choose "Execution environment" , click Environments and choose the Java version you want to use. Click Apply, Run.
That should do it.
| null | CC BY-SA 4.0 | null | 2022-09-23T14:17:02.693 | 2022-09-23T14:17:02.693 | null | null | 1,487,917 | null |
73,829,458 | 2 | null | 73,829,457 | 1 | null | To layout Composables based on their count `Layout` is required and need to select `Constraints`, a detailed answer about Constraints is available in [this link](https://stackoverflow.com/a/73316247/5457853), based on number of items and place them accordingly.
For Constraints selection when there are 2 items we need to pick half width and full height to have result in question. When there are 4 items we need to pick half width and half height.
When item count is 3 we need to use 2 constraints, 1 for measuring first 2 items, another one measuring the one that covers whole width
```
@Composable
private fun ImageDrawLayout(
modifier: Modifier = Modifier,
itemCount: Int,
divider: Dp,
content: @Composable () -> Unit
) {
val spacePx = LocalDensity.current.run { (divider).roundToPx() }
val measurePolicy = remember(itemCount, spacePx) {
MeasurePolicy { measurables, constraints ->
val newConstraints = when (itemCount) {
1 -> constraints
2 -> Constraints.fixed(
width = constraints.maxWidth / 2 - spacePx / 2,
height = constraints.maxHeight
)
else -> Constraints.fixed(
width = constraints.maxWidth / 2 - spacePx / 2,
height = constraints.maxHeight / 2 - spacePx / 2
)
}
val gridMeasurables = if (itemCount < 5) {
measurables
} else {
measurables.take(3) + measurables.first { it.layoutId == "Text" }
}
val placeables: List<Placeable> = if (measurables.size != 3) {
gridMeasurables.map { measurable: Measurable ->
measurable.measure(constraints = newConstraints)
}
} else {
gridMeasurables
.take(2)
.map { measurable: Measurable ->
measurable.measure(constraints = newConstraints)
} +
gridMeasurables
.last()
.measure(
constraints = Constraints.fixed(
constraints.maxWidth,
constraints.maxHeight / 2 - spacePx
)
)
}
layout(constraints.maxWidth, constraints.maxHeight) {
when (itemCount) {
1 -> {
placeables.forEach { placeable: Placeable ->
placeable.placeRelative(0, 0)
}
}
2 -> {
var xPos = 0
placeables.forEach { placeable: Placeable ->
placeable.placeRelative(xPos, 0)
xPos += placeable.width + spacePx
}
}
else -> {
var xPos = 0
var yPos = 0
placeables.forEachIndexed { index: Int, placeable: Placeable ->
placeable.placeRelative(xPos, yPos)
if (index % 2 == 0) {
xPos += placeable.width + spacePx
} else {
xPos = 0
}
if (index % 2 == 1) {
yPos += placeable.height + spacePx
}
}
}
}
}
}
}
Layout(
modifier = modifier,
content = content,
measurePolicy = measurePolicy
)
}
```
Another thing to note here is we need to find find Composable that contains `Text`. It's possible to find it from index since it's 4th item but i used `Modifier.layoutId()` for demonstration. This Modifier helps finding Composables when you don't know in which order they are placed inside a Composaable.
```
val gridMeasurables = if (size < 5) {
measurables
} else {
measurables.take(3) + measurables.first { it.layoutId == "Text" }
}
```
And place items based on item count and we add space only after first item on each row.
Usage
```
@Composable
fun GridImageLayout(
modifier: Modifier = Modifier,
thumbnails: List<Int>,
divider: Dp = 2.dp,
onClick: ((List<Int>) -> Unit)? = null
) {
if (thumbnails.isNotEmpty()) {
ImageDrawLayout(
modifier = modifier
.clickable {
onClick?.invoke(thumbnails)
},
divider = divider,
itemCount = thumbnails.size
) {
thumbnails.forEach {
Image(
modifier = Modifier.layoutId("Icon"),
painter = painterResource(id = it),
contentDescription = "Icon",
contentScale = ContentScale.Crop,
)
}
if (thumbnails.size > 4) {
val carry = thumbnails.size - 3
Box(
modifier = Modifier.layoutId("Text"),
contentAlignment = Alignment.Center
) {
Text(text = "+$carry", fontSize = 20.sp)
}
}
}
}
}
```
And using `GridImageLayout`
Column {
```
val icons5 = listOf(
R.drawable.landscape1,
R.drawable.landscape2,
R.drawable.landscape3,
R.drawable.landscape4,
R.drawable.landscape5,
R.drawable.landscape6,
R.drawable.landscape7,
)
GridImageLayout(
modifier = Modifier
.border(1.dp, Color.Red, RoundedCornerShape(10))
.clip(RoundedCornerShape(10))
.size(150.dp),
thumbnails = icons5
)
```
}
| null | CC BY-SA 4.0 | null | 2022-09-23T14:42:40.813 | 2022-09-24T16:59:36.017 | 2022-09-24T16:59:36.017 | 5,457,853 | 5,457,853 | null |
73,829,774 | 2 | null | 13,636,840 | 0 | null | The first time this problem happened, we tried some of the solutions listed here, some version of [Richard's](https://stackoverflow.com/a/43883049) and [Greg's](https://stackoverflow.com/a/48348671/12291500), which worked to solve the problem. But when it reoccurred the next day, that didn't work. Neither did uninstalling and reinstalling Visual Studio (we're using Visual Studio Community 2022 Version 17.2.5).
We looked for further suggestions. On Stack Overflow on the issue of this designer error of there's this current question with its suggestions for referencing the exe, and [this question](https://stackoverflow.com/q/70903285/12291500). Someone asked DevExpress [this question](https://supportcenter.devexpress.com/Ticket/Details/T711301/designer-error-the-type-xxx-resources-has-no-property-named-yyy) on their support site. There's a few others scattered around the internet, but they all seem to have the same answers on them as this question has (perhaps even copied and pasted, but who knows).
What ended up solving the problem was deleting the Visual Studio cache, as suggested [by Reza in this comment](https://stackoverflow.com/questions/70903285/the-type-properties-resources-has-no-property-named#comment129630160_70903285). Based on [this question](https://stackoverflow.com/q/54673091/12291500), we opened `appdata` to look for the cache. This can be done by pressing `WindowsKey + R` to open the `Run` dialog box, typing in `%appdata%` and pressing `Enter`. We found the cache files in `appdata\local\Microsoft\VisualStudio`, and deleted everything out of there. (Make sure VS is closed when you try to do this, otherwise it will say "Unable to Delete" because the files are in use.) When we opened VS, everything worked correctly.
| null | CC BY-SA 4.0 | null | 2022-09-23T15:10:02.643 | 2022-09-28T13:18:05.883 | 2022-09-28T13:18:05.883 | 12,291,500 | 12,291,500 | null |
73,830,111 | 2 | null | 73,830,028 | 1 | null | Since I couldn't find anything equivalent to `ReturnType` for JSDoc, I've decided to do the other way, and make the parameter return `T`, so that `@returns {T}` now returns the instance type:
```
/**
* @template T
* @param {{ new(...args: any[]): T }} classType
* @returns {T}
*/
function genericFunction(classType) {
return new classType();
}
```
Tested with [https://vscode.dev/](https://vscode.dev/) and [typescriptlang.org/play](https://www.typescriptlang.org/play?strictNullChecks=true&declaration=false&target=99&jsx=0&filetype=js#code/EQVwzgpgBGAuBOBLAxrYBuAsAKB8gNgIZhhQAKh8EAdrFAN45TNSEDm0AvFAIwAMWXNhZQA9iFgAHCQEEOACgCUDJiJbJR1MKPwQAdPlFt5AAwCyAT1YcoiUgBJ6sABZ297CAF8TiwSM84AUIExKQAwq74ACZQEAAesDRRpBRUtCrCLNSEALZcUMAAQqIARhg4qsziUhIAcrkQShlq6praugZGppZQ2Xm2Dk6uYHp9Xj5+LEFBOAD0AFTzTPNQAAKJOZJEiVAAKstrkpS5DPS9EADu8no3lGxgAFys1BYA2gC6ik+7UJ6eUCESLsLJIIAdVlRYCB4FoGLsglB5rMcAAzEDUVCITRQDjUCBIZAAMXRmM08kBYGBoOUjEyzEh0Oo5wuAKIQJBjV8gQq2A0WjoiTgAHEaPiUFBuLixUSSbAsdR5BFENEudhBbARXiCXpqtJYPU8kpBOrNdKdRI9XJOeggA)
| null | CC BY-SA 4.0 | null | 2022-09-23T15:38:37.930 | 2022-09-23T16:42:18.863 | 2022-09-23T16:42:18.863 | 540,955 | 18,244,921 | null |
73,830,308 | 2 | null | 50,020,523 | 1 | null | I found this question while looking for a solution to disable splash on `ElevatedButton`. all solutions presented here did not work for my problem, even though `Theme(data: ThemeData(... NoSplash..))` was working but for some reason did not work. I set `overlayColor:..` in `ButtonStyle()` to transparent like this: `overlayColor: MaterialStateProperty.all(Colors.transparent),` and worked. hope this will help someone
| null | CC BY-SA 4.0 | null | 2022-09-23T15:57:02.687 | 2022-09-23T15:57:02.687 | null | null | 17,668,049 | null |
73,830,421 | 2 | null | 73,802,820 | 0 | null | Was able to get a solution from Reddit, so I'm posting it here for anyone who stumbles across this:
My final XAMl ended up being
```
<Grid>
<Image
x:Name="backgroundImage"
Source="image_source.png"
Aspect="AspectFill"
HorizontalOptions="Start"/>
</Grid>
```
And I added this to the code-behind:
```
protected override void OnSizeAllocated (double pageWidth, double pageHeight) {
base.OnSizeAllocated(pageWidth, pageHeight);
const double aspectRatio = 1600 / 1441.0; // Aspect ratio of the original image
backgroundImage.WidthRequest = Math.Max(pageHeight * aspectRatio, pageWidth);
}
```
| null | CC BY-SA 4.0 | null | 2022-09-23T16:09:05.363 | 2022-09-24T19:38:11.397 | 2022-09-24T19:38:11.397 | 6,284,199 | 6,284,199 | null |
73,830,532 | 2 | null | 73,830,028 | 0 | null | If you want to use @template, then it seems to me that it would be more correct
```
/**
* @template ParentType
* @property {number} age
* @property {function(): void} outputAge
*/
class Parent {
age = 10;
outputAge() {
console.log(`My age is ${this.age}`);
}
}
/**
* @template ChildType
* @extends {Parent}
* @property {string} name
* @property {function(): void} outputName
*/
class Child extends Parent {
name = "Bob";
outputName() {
console.log(`My name is ${this.name}`);
}
}
/**
* @template {ChildType} T
* @param {T} classType
* @returns {T}
*/
function genericFunction(classType) {
return new classType();
}
const testGeneric = genericFunction(Child);
testGeneric.outputName();
testGeneric.outputAge();
```
| null | CC BY-SA 4.0 | null | 2022-09-23T16:19:12.287 | 2022-09-23T16:19:12.287 | null | null | 20,014,359 | null |
73,830,624 | 2 | null | 12,025,635 | 3 | null | This won't help with the gradle bug mentioned in the answer (which I dunno might be fixed by now) but here's how I changed the Locale used by IntelliJ itself
Help --> Edit Custom VM Options
append these three lines
```
-Duser.language=en
-Duser.country=US
-Duser.variant=US
```
save and restart IntelliJ
| null | CC BY-SA 4.0 | null | 2022-09-23T16:28:56.853 | 2022-09-23T16:28:56.853 | null | null | 289,037 | null |
73,830,920 | 2 | null | 73,828,302 | 0 | null | it works !
```
const PORT = 8000
const axios = require('axios')
const cheerio = require('cheerio')
const express = require('express')
const fs = require('fs')
const app = express()
const url = 'http://www.gemmaline.com/sorts/liste-classe-pretre.htm'
axios(url, {
responseEncoding: 'binary'
})
.then(response => {
const $ = cheerio.load(response.data.toString('ISO-8859-1'),{decodeEntities: false})
const data = []
$('body:nth-child(2) ul li').each(function() {
const name = $(this).text()
const url = $(this).find('a').attr('href')
data.push({ name, url })
})
fs.writeFileSync('test2.json', JSON.stringify(data, null, 1))
}).catch(err => console.log(err))
app.listen(PORT, () => console.log(`server running on port ${PORT}`))
```
[wrong character line 11](https://i.stack.imgur.com/tRXc6.png)
I have now a new issue, a single quote at line 11 should be not become ’. On this line it's normaly `Conservation d'organe Nécromancie` instead of `Conservation dorgane Nécromancie`.
After, i could just substitute this symbol by a single quote for each time i get it but maybe we can find something more clean directly by encoding
| null | CC BY-SA 4.0 | null | 2022-09-23T17:03:17.070 | 2022-09-23T17:12:23.697 | 2022-09-23T17:12:23.697 | 20,070,087 | 20,070,087 | null |
73,831,110 | 2 | null | 73,830,634 | 1 | null | There is no way inFirebase's security rules for Cloud Storage to limit the domain that can read files. You be able to control that through Cloud Storage's configuration itself, but otherwise you'll want to look at Firebase [App Check](https://firebase.google.com/docs/app-check) which ensures that only your own code can make API calls.
Note: if you generate a download URL for a file in Cloud Storage, access through that URL (by design) bypasses the security rules and App Check, so will always be allowed. Given your use-case "in blogs" that might apply here, but I wasn't sure.
| null | CC BY-SA 4.0 | null | 2022-09-23T17:25:45.413 | 2022-09-23T17:39:46.757 | 2022-09-23T17:39:46.757 | 209,103 | 209,103 | null |
73,831,314 | 2 | null | 12,526,795 | 0 | null | Expanding on Joao's solution (thanks for that) you can also do it without a subreport by joining the counter table to the actual data you want to display in the dataset.
1. Add a Copies integer parameter with a default value of 1
2. Update your dataset to include the counter and join -- Generate a table with @Count rows
WITH dataset AS (SELECT 1 AS Copy UNION ALL SELECT Copy + 1 AS Expr1 FROM dataset AS dataset_2 WHERE (Copy < @Copies))
SELECT * FROM dataset INNER JOIN (
-- The primary data to repeat
SELECT * FROM MyTable WHERE Id = @IdParam
-- End
) d ON 1=1 OPTION (MAXRECURSION 0)
3. Add/update your row group to group on [Copy]
4. Set the row group page breaks to 'between each instance'
| null | CC BY-SA 4.0 | null | 2022-09-23T17:49:08.680 | 2022-09-23T17:49:08.680 | null | null | 36,695 | null |
73,831,351 | 2 | null | 17,534,128 | 0 | null | also Farsi language in HTML document
```
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<a href="https://www.w3schools.com/tags/ref_language_codes.asp">and other languages</a>
</body>
</html>
```
[and other languages](https://www.w3schools.com/tags/ref_language_codes.asp)
| null | CC BY-SA 4.0 | null | 2022-09-23T17:52:49.943 | 2022-09-23T17:57:02.913 | 2022-09-23T17:57:02.913 | 17,600,778 | 17,600,778 | null |
73,831,643 | 2 | null | 73,831,499 | 1 | null | Assuming that the number strings are in column `A2:A`, use this regex formula:
```
=arrayformula(
iferror(
regexreplace(
A2:A,
"(\d{7})(\d{2})(\d{4})(\d)(\d{2})(\d{4})",
"$1-$2.$3.$4.$5.$6"
)
)
)
```
To learn the exact [regular expression](http://www.regular-expressions.info/quickstart.html) syntax used by Google Sheets, see [RE2](https://github.com/google/re2/wiki/Syntax).
If you want to do this with Apps Script, use [String.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) and the same regex parameters as in the spreadsheet formula above. Note that Google Apps Script uses [JavaScript regexes](https://regexr.com/).
| null | CC BY-SA 4.0 | null | 2022-09-23T18:27:38.197 | 2022-09-23T19:21:43.793 | 2022-09-23T19:21:43.793 | 13,045,193 | 13,045,193 | null |
73,831,698 | 2 | null | 73,831,499 | 0 | null | Try this:
```
function reorder() {
const a = ["12345678901234567890","12345678901234567890"];//put all of the strings into an array
const b = a.map(s => {
return `${s.slice(0,7)}-${s.slice(7,9)}.${s.slice(9,13)}.${s.slice(13,14)}.${s.slice(14,16)}.${s.slice(16)}`
})
Logger.log(b.join('\n'))
}
Execution log
12:34:02 PM Notice Execution started
12:34:03 PM Info 1234567-89.0123.4.56.7890
1234567-89.0123.4.56.7890
12:34:04 PM Notice Execution completed
```
Or this:
```
function reorder() {
const a = ["12345678901234567890","12345678901234567890"];
const b = a.map(s => s.replace(/(\w{7})(\w{2})(\w{4})(\w)(\w{2})(\w{4})/, "$1-$2.$3.$4.$5.$6"));
Logger.log(b.join('\n'))
}
Execution log
12:48:51 PM Notice Execution started
12:48:52 PM Info abcdefg-89.0123.4.56.7890
1234567-89.0123.4.56.7890
12:48:52 PM Notice Execution completed
```
In a spreadsheet:
```
function reorder() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName("Sheet0")
const a = sh.getRange(1,1,sh.getLastRow()).getValues().flat();
const b = a.map(s => [s.replace(/(\w{7})(\w{2})(\w{4})(\w)(\w{2})(\w{4})/, "$1-$2.$3.$4.$5.$6")]);
sh.getRange(1,2,b.length,b[0].length).setValues(b);
}
```
| A | B |
| - | - |
| abcdefg8901234567890 | abcdefg-89.0123.4.56.7890 |
| 12345678901234567890 | 1234567-89.0123.4.56.7890 |
| null | CC BY-SA 4.0 | null | 2022-09-23T18:34:23.093 | 2022-09-23T18:58:16.273 | 2022-09-23T18:58:16.273 | 7,215,091 | 7,215,091 | null |
73,831,707 | 2 | null | 2,691,726 | 0 | null | For me turning focus off didn't work until the control was shown.
I did this:
```
bool HideFocus { get; set; }
bool _hasEnter;
void OnEnter(object sender, EventArgs e)
{
if (!_hasEnter)
{
_hasEnter = true;
// Selection at startup wont change the actual focus
if (this.SelectedIndices.Count > 0)
this.Items[this.SelectedIndices[0]].Focused = true;
// Hide focus rectangle if requested
if (this.ShowFocusCues && this.HideFocus)
{
var lParam1 = MakeLong(UIS_SET, UISF_HIDEFOCUS);
SendMessage(this.Handle, WM_CHANGEUISTATE, lParam1, 0);
}
}
}
```
See [https://stackoverflow.com/a/15768802/714557](https://stackoverflow.com/a/15768802/714557) above for the MakeLong call.
Also, any selected items before the control is shown, won't set the selection focus.
I basically used the "Set Focus" event to know that the control was shown and that it was actually getting focus, to make the corretions.
| null | CC BY-SA 4.0 | null | 2022-09-23T18:35:33.323 | 2022-09-23T19:27:52.330 | 2022-09-23T19:27:52.330 | 714,557 | 714,557 | null |
73,832,060 | 2 | null | 43,627,721 | 0 | null | I was also facing the same issues by using this in Scaffold. I am able to fix it.
> resizeToAvoidBottomInset: false,
According to Documentation --
If true the [body] and the scaffold's floating widgets should size themselves to avoid the onscreen keyboard whose height is defined by the ambient [MediaQuery]'s [MediaQueryData.viewInsets] bottom property.
For example, if there is an onscreen keyboard displayed above the scaffold, the body can be resized to avoid overlapping the keyboard, which prevents widgets inside the body from being obscured by the keyboard.
Defaults to true.
```
Scaffold(
.......
resizeToAvoidBottomInset: false,
);
```
| null | CC BY-SA 4.0 | null | 2022-09-23T19:15:37.493 | 2022-09-23T19:15:37.493 | null | null | 11,591,996 | null |
73,832,292 | 2 | null | 70,733,920 | 0 | null | Another idea is to replace the navigation bar with a custom one like this:
```
{
...
}
.safeAreaInset(edge: .top) {
VStack(alignment: .leading, spacing: 8) {
HStack() {
Button {
presentationMode.wrappedValue.dismiss()
} label: {
Image(systemName: "chevron.backward")
}
Spacer()
Text(navigationTitle).font(.title2).bold()
.multilineTextAlignment(.center)
.foregroundColor(.accentColor)
.frame(maxWidth: .infinity)
Spacer()
}
HStack {
Button("Button") { }
Button("Button") { }
Button("Button") { }
Spacer()
}
}
.padding()
.background(
.bar
)
}
```
You will also have to set:
```
.navigationBarBackButtonHidden(true)
```
and do not set a navigation title:
```
// .navigationTitle("....")
```
| null | CC BY-SA 4.0 | null | 2022-09-23T19:41:52.947 | 2022-09-23T19:41:52.947 | null | null | 345,258 | null |
73,832,462 | 2 | null | 63,133,390 | 0 | null | Note ReorientObject() is not supported with sql < 2012 the solution i came up is to draw right to left instead on left to right
If we specify points in clockwise direction, it takes all the points in the entire world except the region of the polygon whereas if we specify in counter clockwise direction, we get the expected region .
Right to left
```
DECLARE @polygon geography = 'POLYGON((10 10, 30 10, 30 30, 10 10))';
SELECT @polygon
```
[](https://i.stack.imgur.com/2vF9Y.png)
Left to right
```
DECLARE @polygon geography = 'POLYGON((10 10, 30 30, 30 10, 10 10))';
SELECT @polygon
```
[](https://i.stack.imgur.com/2eIJh.png)
| null | CC BY-SA 4.0 | null | 2022-09-23T20:01:59.467 | 2022-09-23T20:01:59.467 | null | null | 1,855,177 | null |
73,832,524 | 2 | null | 27,636,373 | 0 | null |
# Update
[See this repl](https://svelte.dev/repl/75e63267a54b48cd83fd309ee2e17f56?version=3.50.1) for added top-down support.
[Screenshot (top-down)](https://i.stack.imgur.com/69iZG.png)
# Initial answer
I set up a repl with an highly customizable example using CSS's clip-path.
[See here.](https://svelte.dev/repl/58722a1c85b14b15a90506f416211401?version=3.50.1)
[Screenshot](https://i.stack.imgur.com/EPTmI.png)
```
<script>
let arrowWidth = 25;
let stepPaddingX = 25;
let stepPaddingY = 0;
let stepGap = 5;
let height = 50;
$: cssVariables = `--height: ${height}px;--step-gap: ${stepGap}px;--arrow-width: ${arrowWidth}px; --step-padding-x: ${stepPaddingX}px; --step-padding-y: ${stepPaddingY}px`;
let wrap = false;
let wrapWords = true;
let pillStyle = true;
let limitHeight = false;
let autoHeight = true;
const steps = ["Test", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam"]
</script>
<div class="settings">
<div class="setting">
<label for="setting__height">Height</label>
<input id="setting__height" min="50" max="200" bind:value={height} type="range"/>
</div>
<div class="setting">
<label for="setting__limit-height">Limit height</label>
<input id="setting__limit-height" bind:checked={limitHeight} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__auto-height">Auto-height</label>
<input id="setting__auto-height" bind:checked={autoHeight} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__arrow-width">Arrow width</label>
<input id="setting__arrow-width" bind:value={arrowWidth} type="range"/>
</div>
<div class="setting">
<label for="setting__step-padding-y">Step Padding Y</label>
<input id="setting__step-padding-y" bind:value={stepPaddingY} type="range"/>
</div>
<div class="setting">
<label for="setting__step-padding-x">Step Padding X</label>
<input id="setting__step-padding-x" bind:value={stepPaddingX} type="range"/>
</div>
<div class="setting">
<label for="setting__step-gap">Step Gap</label>
<input id="setting__step-gap" bind:value={stepGap} type="range"/>
</div>
<div class="setting">
<label for="setting__wrap-steps">Wrap steps</label>
<input id="setting__wrap-steps" bind:checked={wrap} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__wrap-words">Wrap words</label>
<input id="setting__wrap-words" bind:checked={wrapWords} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__pill-style">Pill style</label>
<input id="setting__pill-style" bind:checked={pillStyle} type="checkbox"/>
</div>
</div>
<div class="steps" class:wrap class:pillStyle class:limitHeight class:autoHeight style={cssVariables}>
{#each steps as step}
<div class="step" class:wrapWords>
{step}
</div>
{/each}
</div>
<style>
:global(body){
--arrow-width: 25px;
--step-gap: 5px;
--step-padding-x: 10px;
--height: 50px;
}
.settings {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.setting {
display: flex;
align-items: center;
gap: 0.5rem;
border: 1px solid #333;
border-radius: 5px;
padding: 0.25rem;
width: max-content;
}
input {
margin: 0;
}
.steps.pillStyle .step:first-of-type {
border-top-left-radius: 99999px;
border-bottom-left-radius: 99999px;
}
.steps.pillStyle .step:last-of-type {
border-top-right-radius: 99999px;
border-bottom-right-radius: 99999px;
}
.steps {
display: flex;
gap: var(--step-gap);
overflow-x: scroll;
/*scrollbar-width: none;*/
padding: 1rem 0;
}
.steps.wrap {
flex-wrap: wrap;
}
.steps.limitHeight .step{
max-height: 50px;
}
.steps.autoHeight .step{
height: unset;
}
.step:not(.wrapWords) {
white-space: nowrap;
}
.step {
background: #756bea;
width: auto;
height: var(--height);
color: #fff;
transform-style: preserve-3d;
position: relative;
display: flex;
justify-content: center;
align-items: center;
padding: var(--step-padding-y) var(--step-padding-x);
box-sizing: border-box;
}
.step:hover{
background: #4b3fe4;
}
.step:first-child {
/*padding-right: var(--arrow-width);*/
/*padding-left: var(--step-padding-x);*/
}
.step:first-child::after {
content: "";
background: inherit;
position: absolute;
left: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(calc(100% - var(--arrow-width)) 0%, 100% 50%, calc(100% - var(--arrow-width)) 100%, 0% 100%, 0% 0%);
}
.step:not(:is(:first-child, :last-child))::before{
content: "";
background: inherit;
position: absolute;
right: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(100% 0%, 100% 100%, 0% 100%, var(--arrow-width) 50%, 0% 0%);
}
.step:not(:is(:first-child, :last-child))::after {
content: "";
background: inherit;
position: absolute;
left: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(calc(100% - var(--arrow-width)) 0%, 100% 50%, calc(100% - var(--arrow-width)) 100%, 0% 100%, 0% 0%);
}
.step:not(:last-child) {
margin-right: var(--arrow-width);
padding-left: var(--step-padding-x);
}
.step:last-child {
padding-left: var(--step-padding-x);
padding-right: var(--step-padding-x);
}
.step:last-child::before {
content: "";
background: inherit;
position: absolute;
right: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(100% 0, 100% 100%, 0% 100%, var(--arrow-width) 50%, 0% 0%);
}
</style>
```
If you want a border for the steps look at [this repl](https://svelte.dev/repl/cc13e7a1d04a4b8e8db19a5f73e32469?version=3.50.1)
```
<script>
let wrap = false;
let wrapWords = true;
let pillStyle = true;
let limitHeight = false;
let autoHeight = true;
let lockBorderToGap = false;
let arrowWidth = 25;
let stepPaddingX = 25;
let stepPaddingY = 0;
let stepGap = 5;
let height = 50;
let stepBorderWidth = 5;
$: cssVariables = `--height: ${height}px;--step-gap: ${stepGap}px;--arrow-width: ${arrowWidth}px; --step-padding-x: ${stepPaddingX}px; --step-padding-y: ${stepPaddingY}px; --step-border-width: ${stepBorderWidth}px`;
const steps = ["Test", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam"]
</script>
<div class="settings">
<div class="setting">
<label for="setting__height">Height</label>
<input id="setting__height" min="50" max="200" bind:value={height} type="range"/>
</div>
<div class="setting">
<label for="setting__limit-height">Limit height</label>
<input id="setting__limit-height" bind:checked={limitHeight} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__auto-height">Auto-height</label>
<input id="setting__auto-height" bind:checked={autoHeight} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__arrow-width">Arrow width</label>
<input id="setting__arrow-width" bind:value={arrowWidth} type="range"/>
</div>
<div class="setting">
<label for="setting__step-padding-y">Step Padding Y</label>
<input id="setting__step-padding-y" bind:value={stepPaddingY} type="range"/>
</div>
<div class="setting">
<label for="setting__step-padding-x">Step Padding X</label>
<input id="setting__step-padding-x" bind:value={stepPaddingX} type="range"/>
</div>
<div class="setting">
<label for="setting__step-gap">Step Gap</label>
<input id="setting__step-gap" bind:value={stepGap} type="range"/>
</div>
<div class="setting">
<label for="setting__lock-border">Lock border to gap</label>
<input id="setting__lock-border" bind:checked={lockBorderToGap} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__wrap-steps">Wrap steps</label>
<input id="setting__wrap-steps" bind:checked={wrap} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__wrap-words">Wrap words</label>
<input id="setting__wrap-words" bind:checked={wrapWords} type="checkbox"/>
</div>
<div class="setting">
<label for="setting__pill-style">Pill style</label>
<input id="setting__pill-style" bind:checked={pillStyle} type="checkbox"/>
</div>
</div>
<div id="example" style={cssVariables}>
<div class="steps-wrapper" class:lockBorderToGap>
<div class="steps" class:wrap class:pillStyle class:limitHeight class:autoHeight>
{#each steps as step}
<div class="step" class:wrapWords>
{step}
</div>
{/each}
</div>
</div>
</div>
<style>
:global(body){
--arrow-width: 25px;
--step-gap: 5px;
--step-padding-x: 10px;
--height: 50px;
--step-border-width: 5px;
}
.settings {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
margin-bottom: 2rem;
}
.setting {
display: flex;
align-items: center;
gap: 0.5rem;
border: 1px solid #333;
border-radius: 5px;
padding: 0.25rem;
width: max-content;
}
input {
margin: 0;
}
.steps.pillStyle .step:first-of-type {
border-top-left-radius: 99999px;
border-bottom-left-radius: 99999px;
}
.steps.pillStyle .step:last-of-type {
border-top-right-radius: 99999px;
border-bottom-right-radius: 99999px;
}
.steps-wrapper {
/*padding: 0.5rem;*/
box-sizing: border-box;
background: black;
border-radius: 99999px;
overflow: hidden;
border: var(--step-border-width) solid transparent;
}
.steps-wrapper.lockBorderToGap {
border-width: var(--step-gap);
}
.steps {
display: flex;
gap: var(--step-gap);
overflow-x: scroll;
scrollbar-width: none;
/*padding: 1rem 0;*/
}
.steps.wrap {
flex-wrap: wrap;
}
.steps.limitHeight .step{
max-height: 50px;
}
.steps.autoHeight .step{
height: unset;
}
.step:not(.wrapWords) {
white-space: nowrap;
}
.step {
background: #756bea;
width: auto;
height: var(--height);
color: #fff;
transform-style: preserve-3d;
position: relative;
display: flex;
justify-content: center;
align-items: center;
padding: var(--step-padding-y) var(--step-padding-x);
box-sizing: border-box;
}
.step:hover{
background: #4b3fe4;
}
.step:first-child {
/*padding-right: var(--arrow-width);*/
/*padding-left: var(--step-padding-x);*/
}
.step:first-child::after {
content: "";
background: inherit;
position: absolute;
left: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(calc(100% - var(--arrow-width)) 0%, 100% 50%, calc(100% - var(--arrow-width)) 100%, 0% 100%, 0% 0%);
}
.step:not(:is(:first-child, :last-child))::before{
content: "";
background: inherit;
position: absolute;
right: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(100% 0%, 100% 100%, 0% 100%, var(--arrow-width) 50%, 0% 0%);
}
.step:not(:is(:first-child, :last-child))::after {
content: "";
background: inherit;
position: absolute;
left: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(calc(100% - var(--arrow-width)) 0%, 100% 50%, calc(100% - var(--arrow-width)) 100%, 0% 100%, 0% 0%);
}
.step:not(:last-child) {
margin-right: var(--arrow-width);
padding-left: var(--step-padding-x);
}
.step:last-child {
padding-left: var(--step-padding-x);
padding-right: var(--step-padding-x);
}
.step:last-child::before {
content: "";
background: inherit;
position: absolute;
right: 100%;
width: var(--arrow-width);
height: 100%;
clip-path: polygon(100% 0, 100% 100%, 0% 100%, var(--arrow-width) 50%, 0% 0%);
}
</style>
```
| null | CC BY-SA 4.0 | null | 2022-09-23T20:07:46.967 | 2022-09-23T21:42:21.793 | 2022-09-23T21:42:21.793 | 20,072,893 | 20,072,893 | null |
73,832,810 | 2 | null | 33,071,950 | 3 | null | Shoutout to [Jérémy Magrin](https://stackoverflow.com/users/2310601/j%c3%a9r%c3%a9my-magrin) for his answer. This is his code but refactored to use functional components and hooks.
Note, you might need to use `minHight` instead of `height` in some RN versions.
```
const AutoExpandingTextInput = ({...props})=> {
const [text, setText] = useState('');
const [height, setHeight] = useState();
return (
<TextInput
{...props}
multiline={true}
onChangeText={text => {
setText(text);
}}
onContentSizeChange={event => {
setHeight(event.nativeEvent.contentSize.height);
}}
style={[styles.default, {height: height}]}
value={text}
/>
);
}
```
| null | CC BY-SA 4.0 | null | 2022-09-23T20:43:34.113 | 2022-09-24T00:08:26.783 | 2022-09-24T00:08:26.783 | 13,995,198 | 13,995,198 | null |
73,832,987 | 2 | null | 73,832,211 | 1 | null | ```
library(ggplot2)
ggplot(mpg, aes(x = displ,y = hwy, col = factor(year),size = 5)) +
geom_point() +
scale_color_manual(
values = c("1999" = "blue","2008"="red"),
name = "year"
)
```
| null | CC BY-SA 4.0 | null | 2022-09-23T21:09:14.977 | 2022-09-23T21:10:30.507 | 2022-09-23T21:10:30.507 | 7,143,066 | 7,143,066 | null |
73,833,039 | 2 | null | 73,083,916 | 0 | null | Load your data into a nested dictionary with this structure:
```
username_dict = {'user1': {"ip":"192.168.102.128", "user_dst_count":"475"},
'user2': {"ip":"192.168.102.128", "user_dst_cnt":"113"},
'user3': {"ip":"192.168.102.128", "user_dst_cnt":"43"},
'user4': {"ip":"192.168.102.128", "user_dst_cnt":"23"},
'user5': {"ip":"192.168.102.128", "user_dst_cnt":"3"},
'user6': {"ip":"192.168.102.128", "user_dst_cnt":"2"}}
```
One way to do this using `pandas` would be:
```
df = pd.read_csv(path_to_csv_input_file)
username_dict = {}
for index, row in df.iterrows():
username_dict[row['username']]={"ip":row['ip'], "user_dst_cnt":row["user_dst_cnt"]}
```
Next, you need to tweak your template file to look like this:
[](https://i.stack.imgur.com/lh9od.png)
Finally, set the context to `context = {'username_dict':username_dict}` and render for your desired output:
[](https://i.stack.imgur.com/NuNvv.png)
| null | CC BY-SA 4.0 | null | 2022-09-23T21:15:14.843 | 2022-09-23T21:15:14.843 | null | null | 6,828,137 | null |
73,833,071 | 2 | null | 73,832,887 | 0 | null | I hope I understood what you mean.
If you are using Xcode 14 and can deploy iOS 16 or later, you can simply replace `VStack` with `Grid` and `HStack` with `GridRow`; this will place the text in columns. Then, you can remove the `Spacer()` all over. If the text is too long, it will increase the lines inside its own column.
Like this:
```
Grid {
GridRow {
Text("title1")
Text("title2")
Text("title3")
}
GridRow {
Text("fo0o0o0o0o0o0o0o0")
Text("fo0o0o0o0o")
Text("fo0")
}
GridRow {
Text("fo0o0o0o0o")
Text("fo0o")
Text("fo0")
}
}
```
Result in the images (short vs. long text):
[](https://i.stack.imgur.com/Q989x.png)
[](https://i.stack.imgur.com/RbsqC.png)
| null | CC BY-SA 4.0 | null | 2022-09-23T21:18:33.847 | 2022-09-23T21:18:33.847 | null | null | 18,251,327 | null |
73,833,098 | 2 | null | 66,045,106 | 1 | null | The problem description on this one is unclear. It seems like it's asking you to rotate the cards as you would physically, which entails replacing 6s and 9s, but that replacement never seems to be tested. You can get away with simply reversing the digits in the numbers.
To make matters worse, there's no sample test case with a 3, 4 or 7, which have no sensible representation in flipped form. Intuitively, these flips should be disregarded, and that intuition turns out to be true in the Kattis test suite.
Another edge case is what to do about 10 or 2100. These reverse to 1 and 12 respectively and shouldn't be ignored.
> I am stuck at how to edit such that the 2 or 5 can be inverted in an integer form.
After spinning a card physically, 2 stays 2 and 5 stays 5. Only 6 and 9 would change values on a flip, and Kattis doesn't test those at this time. 2 and 5 mirror each other horizontally, but that's not relevant here.
After clarifying the requirements, the problem pretty much boils down to [two sum](https://leetcode.com/problems/two-sum/) with a reversal tossed in on certain numbers:
- - - `lookup.contains(targetSum - newInputValue)`- - - `lookup.contains(targetSum - newInputValueFlipped)`- -
An "obvious" optimization is to cache each completed flip in a lookup table but it's not necessary to pass the challenge.
| null | CC BY-SA 4.0 | null | 2022-09-23T21:22:20.843 | 2022-09-26T18:56:21.757 | 2022-09-26T18:56:21.757 | 6,243,352 | 6,243,352 | null |
73,833,312 | 2 | null | 73,831,489 | 1 | null | I tried to reproduce your example from the photo, I didn't get all numbers right because I've copied it by hand, but, still, take a look:
```
day <- rep(c("2022-06", "2022-07", "2022-08", "2022-09",
"2022-10", "2022-11", "2022-12", "2022-13",
"2022-14", "2022-15", "2022-16", "2022-17",
"2022-18", "2022-19", "2022-20", "2022-21"))
trialtype <- as.factor(rep(c("go", "no-go"), 16, by = 2))
# mean <- data$CONT_Y[1:8]
mean <- c(0.49, 0.54, 0.44, 0.40, 0.44, 0.34, 0.45, 0.46,
0.42, 0.47, 0.46, 0.45, 0.26, 0.47, 0.41, 0.48)
mydata <- data.frame(day = day,
trialtype = trialtype,
mean = mean)
mydata %>%
ggplot(., aes(x = day, y = mean, group = trialtype)) +
geom_line(aes(color = trialtype)) +
geom_point(aes(color = trialtype)) +
theme(axis.text.x = element_text(angle = 60)) +
labs(title="Average response time of Go/No-go Trials",
x = "Date of training",
y = " Average Response Time ")
```
the plot:
[](https://i.stack.imgur.com/pmzvg.png)
Next time, instead of a picture, if it's possible, then maybe you could share the dataframe via github or dput() (I still don't know how to use dput, but I've been asked to upload via it as well :)
Following Ben's comment, I've just changed `group = 2` to `group = trialtype`
(I'm sorry, I've just checked the comment after posting, I may delete the answer if it's good practice, I'm new to the forum too)
- `group = 2`
[](https://i.stack.imgur.com/IUoGo.png)
:)
| null | CC BY-SA 4.0 | null | 2022-09-23T21:52:26.417 | 2022-09-23T22:06:06.717 | 2022-09-23T22:06:06.717 | 18,364,222 | 18,364,222 | null |
73,833,850 | 2 | null | 19,522,897 | 0 | null | solution step is delete following files in project folder
`.settings`
`.project`
`.classpath`
[](https://i.stack.imgur.com/eYOTx.jpg)
| null | CC BY-SA 4.0 | null | 2022-09-23T23:47:22.503 | 2022-09-23T23:47:22.503 | null | null | 5,256,337 | null |
73,834,203 | 2 | null | 73,832,887 | 0 | null | you could try this approach, using `.fixedSize(horizontal: _, vertical: _)` and some space calculation logic, together with a `@State var`.
```
struct ContentView: View {
@State var dofix = false // <-- here
var body: some View {
VStack {
// for testing, do your space calculation logic
Button("dofix") {
dofix.toggle() // <-- here
}
HStack {
Text("title1")
Spacer()
Text("title2")
Spacer()
Text("title3")
}
HStack {
Text("fo0o0o0o0o0o0o0o0oo0o0o0")
Spacer()
Text("fo0o0o0o0o")
Spacer()
Text("fo0")
}
HStack {
Text("fo0o0o0o0o")
Spacer()
Text("fo0o")
Spacer()
Text("fo0")
}
}
.fixedSize(horizontal: dofix, vertical: dofix) // <-- here
}
}
```
| null | CC BY-SA 4.0 | null | 2022-09-24T01:34:33.670 | 2022-09-24T01:34:33.670 | null | null | 11,969,817 | null |
73,834,504 | 2 | null | 14,936,291 | 0 | null | All solution here
HTML Codes for Spanish Language Characters
[https://www.thoughtco.com/html-codes-spanish-characters-4062194](https://www.thoughtco.com/html-codes-spanish-characters-4062194)
| null | CC BY-SA 4.0 | null | 2022-09-24T03:13:09.373 | 2022-09-24T03:13:09.373 | null | null | 6,481,783 | null |
73,835,320 | 2 | null | 18,790,106 | 1 | null | Right click on the project > > > > > Select > apply and close > refresh the project.
[](https://i.stack.imgur.com/6iS8H.png)
| null | CC BY-SA 4.0 | null | 2022-09-24T07:01:12.820 | 2022-09-24T07:01:12.820 | null | null | 6,483,029 | null |
73,835,588 | 2 | null | 16,753,939 | 0 | null | I'll add this not because it's the solution to the question, but I've not seen it anywhere else. If you're running a custom OS and the only debuggable apps listed in Android Studio are the low level ones (probably Qualcomm stuff), you may be debugging as root. If `whoami` within `adb shell` shows your name as `root`, try running `adb unroot`. Your name should now be `shell`. Then try debugging again.
| null | CC BY-SA 4.0 | null | 2022-09-24T07:52:07.163 | 2022-09-24T07:52:07.163 | null | null | 1,306,433 | null |
73,835,656 | 2 | null | 73,834,595 | 0 | null | If color bars are needed for each scatter plot, add a color scale setting to the graph settings. Adding a color bar will adjust the graph spacing so that the graph and color bar overlap. The legend is intentionally hidden, but enable this line if needed. (with the legend hidden disabled)
```
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import pandas as pd
dataset= {'Item1': ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"],
'Item2': ["Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", "AB", "AC", "AD", "AE", "AF"],
'Property1': [1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, ],
'Property2': [150, 300, 400, 100, 200, 200, 300, 100, 400, 150, 200, 100, 300, 350, 250, 100 ]}
df = pd.DataFrame(data=dataset)
df_1 = df[df['Property1'] ==1]
df_0 = df[df['Property1'] ==0]
MyPlot = make_subplots(rows=1, cols=2, horizontal_spacing=0.3)
MyPlot.add_scatter(x = df_1['Item1'],
y = df_1['Item2'],
mode = "markers",
row = 1,
col = 1,
marker_color = df_1['Property2'],
marker_colorscale='Plasma',
marker_showscale=True,
marker_colorbar_x=0.45,
marker_size = 10,
name = 'Property1 = 1'
)
MyPlot.add_scatter(x = df_0['Item1'],
y = df_0['Item2'],
mode = "markers",
row = 1,
col = 2,
marker_color = df_0['Property2'],
marker_colorscale='Plasma',
marker_showscale=True,
marker_size = 10,
name = 'Property1 = 0'
)
MyPlot.update_layout(height=400, width=800, xaxis_gridcolor = 'beige', yaxis_gridcolor = 'beige', plot_bgcolor = 'white')
MyPlot.update_layout(showlegend=False)
#MyPlot.update_layout(legend=dict(yanchor="top", y=0.99, xanchor="left", x=1.15))
MyPlot.show()
```
[](https://i.stack.imgur.com/AkMxQ.png)
| null | CC BY-SA 4.0 | null | 2022-09-24T08:05:18.517 | 2022-09-24T08:05:18.517 | null | null | 13,107,804 | null |
73,836,548 | 2 | null | 73,832,997 | 2 | null | One of the rules to create a clean table is to either avoid repeated information or move it somewhere else: heading, annotation or even outside the table, s.a. the main text. I removed content from the second to the fourth row and move it to a bottom of table, which then became extremely wide and shallow. So the next idea was to decrease its width.
The long phrases are split in multi-lines. I applied `makecell` for that. I also decreased space between columns and reduced font in cells with numbers. After the changes, the table is much cleaner and can even fit the page.
I also prefer `booktabs` from regular and I most of times suggest the package in my solutions.
[](https://i.stack.imgur.com/mMjut.png)
```
\documentclass{amsbook}
\usepackage{array}
\usepackage{makecell}
\usepackage{booktabs}
\usepackage{caption}
\captionsetup[table]{position=top,skip=6pt}
\newcommand\fmtnum[1]{\small#1}
\newcommand\tnote[1]{\rlap{\textsuperscript{\,#1}}}
\begin{document}
\begin{table}
\renewcommand*{\arraystretch}{1.25}
\setlength\tabcolsep{4.1pt}
\centering
\caption{Input parameters}
\begin{tabular}{@{}*{12}{c}@{}} % {0.8\textwidth}
\toprule
\multicolumn{12}{@{}c@{}}{
\raggedright Table of Results for Mn, Mw, PDI and X | Operating Temperature, T = 100$^{\circ}$C} \\
\midrule
\multicolumn{4}{c}{\makecell*{DETERMINISTIC\\SIMULATION\tnote{*}}}
& \multicolumn{4}{c}{\makecell*{STOCHASTIC\\SIMULATION\tnote{*}}}
& \multicolumn{4}{c}{\makecell*{EXPERIMENTAL\\RESULTS\tnote{*}}} \\
\cmidrule(r){1-4} \cmidrule(lr){5-8} \cmidrule(l){9-12}
Mn & Mw & PDI & X & Mn & Mw &
PDI & X & Mn & Mw & PDI & X \\
\cmidrule(r){1-4} \cmidrule(lr){5-8} \cmidrule(l){9-12}
\fmtnum{457.44} & \fmtnum{810.72} & \fmtnum{1.61} & \fmtnum{0.61} & \fmtnum{339.15} & \fmtnum{574.16} &
\fmtnum{1.51} & \fmtnum{0.55} & \fmtnum{6768} & \fmtnum{13607} & \fmtnum{1.57} & \fmtnum{0.091} \\
\bottomrule
\multicolumn{12}{@{}l}{$^{*}$ \makecell[tl]{\footnotesize Monomer/Solvent = 60/40 v/v,
Initiator Concentration = 5v, Simulation\\\footnotesize time, t = 5mins}}
\end{tabular}
\end{table}
\end{document}
```
---
EDIT.
A new table
[](https://i.stack.imgur.com/cGkeh.png)
```
\documentclass{amsbook}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{caption}
\captionsetup[table]{position=top,skip=6pt}
\newcommand\fmtnum[1]{#1}
\newcommand\tnote[1]{\rlap{\textsuperscript{\,#1}}}
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}
\renewcommand*{\arraystretch}{1.15}
\setlength\tabcolsep{4.1pt}
\centering
\caption{Input parameters}
\begin{tabularx}{0.8\textwidth}{
*2{>{\hsize=0.15\hsize\linewidth=\hsize}X}
*2{>{\hsize=0.1\hsize\linewidth=\hsize}X}
*2{>{\hsize=0.15\hsize\linewidth=\hsize}X}
*2{>{\hsize=0.1\hsize\linewidth=\hsize}X}
}
\toprule
\multicolumn{8}{@{}c@{}}{\makecell{
Table of Results for Mn, Mw, PDI and X\\Operating Temperature, T = 100$^{\circ}$C}} \\
\midrule
\multicolumn{4}{c}{\makecell{DETERMINISTIC\\SIMULATION\tnote{*}}}
& \multicolumn{4}{c}{\makecell{STOCHASTIC\\SIMULATION\tnote{*}}} \\
\cmidrule(r){1-4} \cmidrule(l){5-8}
Mn & Mw & PDI & X & Mn & Mw & PDI & X \\
\cmidrule(r){1-4} \cmidrule(l){5-8}
\fmtnum{457.44} & \fmtnum{810.72} & \fmtnum{1.61} & \fmtnum{0.61}
& \fmtnum{339.15} & \fmtnum{574.16} & \fmtnum{0.21} & \fmtnum{0.55} \\
\bottomrule
\multicolumn{8}{@{}l}{$^{*}$\makecell[tl]{
\footnotesize Monomer/Solvent = 60/40 v/v, Initiator Concentration = 5v, Simulation\\\footnotesize time, t = 5mins}}
\end{tabularx}
\end{table}
\end{document}
```
| null | CC BY-SA 4.0 | null | 2022-09-24T10:36:15.697 | 2022-10-06T16:49:28.013 | 2022-10-06T16:49:28.013 | 1,612,369 | 1,612,369 | null |
73,836,640 | 2 | null | 73,836,445 | 0 | null | Try below formula-
```
={{"Date";BYROW(UNIQUE(A3:A11),LAMBDA(x,x))},
{"Sum Qty";BYROW(UNIQUE(A3:A11),LAMBDA(x,SUMIFS(B3:B11,A3:A11,x)))},
{"New";BYROW(UNIQUE(A3:A11),LAMBDA(x,SUMIFS(D3:D11,A3:A11,x,C3:C11,"New")))},
{"Old";BYROW(UNIQUE(A3:A11),LAMBDA(x,SUMIFS(D3:D11,A3:A11,x,C3:C11,"Old")))},
{"Sub Total";BYROW(UNIQUE(A3:A11),LAMBDA(x,SUMIFS(D3:D11,A3:A11,x)))}}
```
[](https://i.stack.imgur.com/RGxRQ.png)
| null | CC BY-SA 4.0 | null | 2022-09-24T10:52:23.057 | 2022-09-24T10:52:23.057 | null | null | 5,514,747 | null |
73,836,954 | 2 | null | 73,836,926 | 1 | null | because you are comparing two strings and the first string is "larger" than the second one...
try this as an example:
```
x = bin(1538)
print(x)
print(type(x))
y = bin(5138)
print(y)
print(type(y))
```
returns this:
```
0b11000000010
<class 'str'>
0b1010000010010
<class 'str'>
```
| null | CC BY-SA 4.0 | null | 2022-09-24T11:41:31.253 | 2022-09-24T11:41:31.253 | null | null | 7,318,120 | null |
73,837,047 | 2 | null | 73,836,445 | 0 | null | You can simply join them side by side using [array literals](https://support.google.com/docs/answer/6208276) `{\}` and lookup only the needed columns with `HLOOKUP`
```
=ARRAYFORMULA(
LAMBDA(rg;
HLOOKUP(
{1\2\5\6\3};
{
SEQUENCE(1;6);
{
QUERY(rg;"select Col1, sum(Col2), sum(Col4) group by Col1";0)\
QUERY(rg;"select Col1, sum(Col4) group by Col1 pivot Col3";0)
}
};
SEQUENCE(ROWS(rg);1;2);
0
)
)(QUERY(
IMPORTRANGE("source";"'Sheet'!A:D");
"where Col1 is not null";0)
)
)
```
Add `IFERROR()`, if needed.
| null | CC BY-SA 4.0 | null | 2022-09-24T11:58:03.553 | 2022-09-24T11:58:03.553 | null | null | 8,404,453 | null |
73,837,700 | 2 | null | 73,837,108 | 1 | null | @zorals, you can modify this code and apply it to your own code.
```
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
import numpy as np
labels = ['< 0.1' , "< 0.4","> 0.6"]
msizes = np.array([20, 25,30,])
for ii in range(3):
plt.plot([],[], 's', markeredgecolor='k',markerfacecolor='none',markersize=msizes[ii],label = labels[ii])
leg = plt.legend( ncol = 3,
fancybox=False,title="Difference:\n",title_fontsize=15,edgecolor='k',framealpha=1,
fontsize=12, loc='lower left', bbox_to_anchor=(1, 0.0), borderaxespad=0.,
scatterpoints=1,borderpad=1.5)
leg._legend_box.align = "left"
plt.show()
```
[](https://i.stack.imgur.com/HvM3u.png)
| null | CC BY-SA 4.0 | null | 2022-09-24T13:47:12.377 | 2022-09-24T13:47:12.377 | null | null | 7,664,840 | null |
73,838,806 | 2 | null | 73,838,617 | 0 | null | Of course you should be compiling bootstrap's files combined with your style to make a perfect match, taking advantage of bootstrap variables, and overriding them in case of need. You can compile it automatically when saving using editor extension or other way you choose.
I assume you are using bootstrap 3 because it uses `less` files.
<-- your file
```
@import "path/to/bootstrap.less";
// your overrides here: (see file variables.less)
@navbar-default-color: white;
@navbar-default-bg: pink;
// and also
.my-primary-border {
border: 1px solid @brand-primary;
}
// and rest of your styles.
```
```
<!-- main.css is automatic output of main.less -->
<link rel="stylesheet" href="main.css">
```
If you're using bootstrap 4/5 it's the same idea. See [here](https://stackoverflow.com/a/73114678/3807365)
| null | CC BY-SA 4.0 | null | 2022-09-24T16:23:01.413 | 2022-09-24T16:23:01.413 | null | null | 3,807,365 | null |
73,839,487 | 2 | null | 73,806,708 | 1 | null | Add GuildVoiceStates Intent
```
intents: [
GatewayIntentBits.GuildVoiceStates,
],
```
| null | CC BY-SA 4.0 | null | 2022-09-24T18:03:08.077 | 2022-09-24T18:03:08.077 | null | null | 17,191,255 | null |
73,839,601 | 2 | null | 73,838,655 | 0 | null | Add this to your CSS file to hide the field, hope this will help
```
.rdrDateDisplayWrapper {
display: none;
}
```
[](https://i.stack.imgur.com/PBp1i.png)
| null | CC BY-SA 4.0 | null | 2022-09-24T18:16:57.753 | 2022-09-24T18:16:57.753 | null | null | 2,520,358 | null |
73,839,839 | 2 | null | 73,839,777 | 0 | null | The problem is at your .sponsor style with
```
padding: 50px;
margin: 15px auto;
```
Adjust the padding and margin properly to fit the images inside the div.
| null | CC BY-SA 4.0 | null | 2022-09-24T18:59:02.270 | 2022-09-24T18:59:02.270 | null | null | 3,935,906 | null |
73,840,068 | 2 | null | 60,348,523 | 0 | null | I have a mcafee antivirus, though in my case it was 20 seconds of compile time for a `Hello world` program. I disabled antivirus realtime scanning and now its taking 0.5 seconds. Hope this may help someone.
| null | CC BY-SA 4.0 | null | 2022-09-24T19:33:55.063 | 2022-10-01T18:18:41.247 | 2022-10-01T18:18:41.247 | 13,812,590 | 15,878,472 | null |
73,840,074 | 2 | null | 73,839,936 | 0 | null | u can add it manually to your project with link
[https://github.com/spencerccf/app_settings/blob/master/lib/app_settings.dart](https://github.com/spencerccf/app_settings/blob/master/lib/app_settings.dart)
```
/// Future async method call to open battery optimization settings.
static Future<void> openBatteryOptimizationSettings({
bool asAnotherTask = false,
}) async {
_channel.invokeMethod('battery_optimization', {
'asAnotherTask': asAnotherTask,
});
}
```
| null | CC BY-SA 4.0 | null | 2022-09-24T19:35:50.403 | 2022-09-24T19:35:50.403 | null | null | 20,078,789 | null |
73,840,200 | 2 | null | 73,837,458 | 0 | null | Hey there if someone is looking out for this solution i just uninstalled VScode completely
[https://www.youtube.com/watch?v=E7NnYv6r_rY&ab_channel=CreativeNetworks](https://www.youtube.com/watch?v=E7NnYv6r_rY&ab_channel=CreativeNetworks)
you can check this out
after that i installed mingw from scratch and tried it works.
And it was not easy idk why....
| null | CC BY-SA 4.0 | null | 2022-09-24T19:55:01.403 | 2022-09-24T19:55:01.403 | null | null | 20,077,229 | null |
73,840,247 | 2 | null | 73,828,284 | -1 | null | Thanks to for answer, bug was in my CORS setting,
it required
localhost:3000 not only localhost:3000
| null | CC BY-SA 4.0 | null | 2022-09-24T20:03:45.897 | 2022-09-24T20:03:45.897 | null | null | 19,929,163 | null |
73,840,424 | 2 | null | 73,840,363 | 0 | null |
1. Use document.getElementById to get a reference to a DOM element.
2. Then use textContent or innerText to get the text (not HTML) of that element (and all its descendants) stitched together. Use textContent to get text from all descendant elements, including hidden and <script> elements. Use innerText to filter-out hidden elements and non-human-readable elements.
3. As you cannot directly interact with the DOM in WebView2 you will need to do it all in JavaScript inside ExecuteScriptAsync. The result of the last expression inside the script will be converted to a .NET String value and returned via the Task<String> which you can await.
Like so:
```
Private Async Function WebView2_NavigationCompletedAsync( ... ) As Task
Handles WebView21.NavigationCompleted
'''''
Dim firstNameText As String = Await WebView21.ExecuteScriptAsync("document.getElementById('m.first_name').textContent");
MessageBox.Show( "First name: """ & firstNameText & """." )
End Function
```
| null | CC BY-SA 4.0 | null | 2022-09-24T20:37:11.917 | 2022-09-25T00:53:33.567 | 2022-09-25T00:53:33.567 | 159,145 | 159,145 | null |
73,840,592 | 2 | null | 73,839,777 | 0 | null | change
```
display: block
```
to
```
display: inline-block
```
in your .sponsors class
| null | CC BY-SA 4.0 | null | 2022-09-24T21:09:54.803 | 2022-09-24T21:33:40.100 | 2022-09-24T21:33:40.100 | 19,636,184 | 19,636,184 | null |
73,840,649 | 2 | null | 43,658,276 | -1 | null | You can do that using the error handle function. Something like:
```
Sub subCreatesNewFolderIfThereIsNotExists(strFolderName As String)
On Error GoTo CaseFolderExists
strFullPath = ThisWorkbook.path & "\" & strFolderName
MkDir (strFullPath)
Exit Sub
CaseFolderExists:
''' Do nothing
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-09-24T21:19:48.810 | 2022-09-24T21:47:41.293 | 2022-09-24T21:47:41.293 | 11,281,707 | 11,281,707 | null |
73,840,918 | 2 | null | 73,840,178 | 0 | null | Since you haven't posted any actual transliteration code, I'll leave you to add the cyrillic and latin character sets to the code below:
```
Sub Transliterate()
Application.ScreenUpdating = False
Dim p As Long, i As Long, StrLng1, StrLng2
'Insert the character codes for the cyrillic characters here
StrLng1 = Array(ChrW(&H430), ChrW(&H431), ChrW(&H432))
'Insert the corresponding latin characters here
StrLng2 = Array("a", "b", "c")
With ActiveDocument.Range
Do While .Characters.Last.Previous = vbCr
.Characters.Last.Previous.Delete
Loop
.InsertAfter vbCr
'Duplicate Content
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Wrap = wdFindContinue
.MatchWildcards = True
.Text = "^13"
.Replacement.Text = "^l"
.Execute Replace:=wdReplaceAll
.Font.Bold = True
.Text = "[!^l]@^l"
.Replacement.Text = "^p^&"
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Text = "^l^13"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
.Execute Replace:=wdReplaceAll
.Text = "[!^13]@^13"
.Replacement.Text = "^&^&^p"
.Execute Replace:=wdReplaceAll
End With
.Characters.Last.Previous.Delete
.Characters.First.Delete
'Loop through duplicated paragraphs
For p = .Paragraphs.Count - 1 To 2 Step -3
With .Paragraphs(p).Range
.Font.Italic = True
'Transliterate paragraph
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Wrap = wdFindStop
.MatchWildcards = False
.MatchCase = True
.Font.Bold = False
For i = 0 To UBound(StrLng1)
.Text = StrLng1(i)
.Replacement.Text = StrLng2(i)
.Execute Replace:=wdReplaceAll
Next
End With
'Duplicate translated paragraph
.Characters.Last.Next.FormattedText = .FormattedText
End With
Next
.Characters.Last.Previous.Delete
'Loop through duplicated paragraphs
For p = .Paragraphs.Count To 3 Step -3
With .Paragraphs(p).Range
.Font.Underline = wdUnderlineSingle
'Reverse Transliterate paragraph
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Wrap = wdFindStop
.MatchWildcards = False
.Font.Bold = False
.MatchCase = True
For i = 0 To UBound(StrLng1)
.Text = StrLng2(i)
.Replacement.Text = StrLng1(i)
.Execute Replace:=wdReplaceAll
Next
End With
End With
Next
End With
Application.ScreenUpdating = True
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-09-24T22:18:39.200 | 2022-09-28T23:50:08.763 | 2022-09-28T23:50:08.763 | 9,170,274 | 9,170,274 | null |
73,841,000 | 2 | null | 73,836,239 | 0 | null |
## Update New Table With Data From Previously Added Table
[](https://i.stack.imgur.com/WnWjT.jpg)
```
Sub UpdateNewTable()
' Define constants.
Const wsName As String = "Report"
Const CriteriaHeader As String = "ID"
Const sTableHeadersList As String _
= "Wage,Tax1,Tax2,Fees"
Const dTableHeadersList As String _
= "Wage Previous,Tax1 Previous,Tax2 Previous,Fees Previous"
' Reference the objects.
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = wb.Worksheets(wsName)
Dim tblCount As Long: tblCount = ws.ListObjects.Count
If tblCount < 2 Then Exit Sub
Dim stbl As ListObject: Set stbl = ws.ListObjects(tblCount - 1)
Dim dtbl As ListObject: Set dtbl = ws.ListObjects(tblCount)
Dim srg As Range: Set srg = stbl.ListColumns(CriteriaHeader).DataBodyRange
Dim drg As Range: Set drg = dtbl.ListColumns(CriteriaHeader).DataBodyRange
' Read data.
' A 2D one-based one-column array with the same number of rows
' as the source (one-column) range, holding the destination (table)
' row indexes where the source values were found.
' There will be error values for not found values ('IsNumeric').
Dim drIndexes As Variant: drIndexes = Application.Match(srg, drg, 0)
Dim sHeaders() As String: sHeaders = Split(sTableHeadersList, ",")
Dim dHeaders() As String: dHeaders = Split(dTableHeadersList, ",")
Dim hUpper As Long: hUpper = UBound(sHeaders)
' Write (copy) data.
Dim sr As Long
Dim dr As Long
Dim hc As Long
For sr = 1 To UBound(drIndexes) ' or '1 To srg.Rows.Count'
If IsNumeric(drIndexes(sr, 1)) Then
dr = drIndexes(sr, 1)
For hc = 0 To hUpper
dtbl.ListColumns(dHeaders(hc)).DataBodyRange.Rows(dr).Value _
= stbl.ListColumns(sHeaders(hc)) _
.DataBodyRange.Rows(sr).Value
Next hc
End If
Next sr
' Inform.
MsgBox "New table updated.", vbInformation
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-09-24T22:39:45.487 | 2022-09-24T22:49:12.283 | 2022-09-24T22:49:12.283 | 9,814,069 | 9,814,069 | null |
73,841,101 | 2 | null | 17,546,953 | -1 | null | I faced the same problem.
From the server, I was returning data in json_encode.
Like this
```
echo json_encode($res);
```
After I returned a simple PHP array without json_encode, it solved the problem.
```
return $res;
```
| null | CC BY-SA 4.0 | null | 2022-09-24T23:06:38.637 | 2022-09-24T23:06:38.637 | null | null | 9,185,409 | null |
73,841,163 | 2 | null | 73,841,127 | -2 | null | ```
#parte1 img {
background-color: transparent;
display: block;
}
```
| null | CC BY-SA 4.0 | null | 2022-09-24T23:21:59.827 | 2022-09-24T23:21:59.827 | null | null | 19,636,184 | null |
73,841,181 | 2 | null | 73,831,661 | 0 | null | I built [https://www.Stornaway.io](https://www.Stornaway.io) as a no-code web app for this to let people easily design branching interactive videos and then embed an HTML/JavaScript player on any site.
You can design & playtest with the trial, then to publish it's paid because of hosting and streaming costs. Or you can export what you've made in Stornaway to native mobile/desktop/VR apps via our Unity plugin, or to interactive YouTube via a Chrome extension.
For simple YouTube videos with links to other YouTube videos, you can just add links to the end of YouTube videos with End Screens.
Other web-based interactive video apps are available with different button features & costs. H5P lets you do host-your-own interactive stuff with custom code.
You mention links after 3-4 mins. From a lot of experience, I recommend that you show links sooner than 3 to 4 minutes – when people know they are playing an interactive video, they get impatient to get on with the interactivity and see it regularly.
Stornaway will let you design & playtest for free to get a feel for this user experience, whatever you end up using.
| null | CC BY-SA 4.0 | null | 2022-09-24T23:26:26.063 | 2022-09-25T00:26:00.423 | 2022-09-25T00:26:00.423 | 3,842,598 | 20,079,859 | null |
73,841,435 | 2 | null | 54,155,605 | 0 | null | Go to `Window -> Preferences -> Java -> Editor -> Content Assist` Now find Auto something like activation triggers for Java (at the bottom) and set the value as:
```
.@(#&$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
```
Also, make sure in the content assist there is one advance tab in which `Java Type proposals` and `Java proposals` should be checked.
| null | CC BY-SA 4.0 | null | 2022-09-25T00:48:04.167 | 2022-09-25T00:48:04.167 | null | null | 12,069,846 | null |
73,841,924 | 2 | null | 73,824,644 | 0 | null | You determine the document path with:
```
admin.firestore().collection('Orders').doc(`/Orders/{OrderId}/fcmToken`)
```
But in JavaScript template literals, the variables must be prefixed with a `$`, so:
```
admin.firestore().collection('Orders').doc(`/Orders/${OrderId}/fcmToken`)
```
| null | CC BY-SA 4.0 | null | 2022-09-25T03:43:23.110 | 2022-09-25T03:43:23.110 | null | null | 209,103 | null |
73,842,065 | 2 | null | 73,802,759 | 0 | null |
### Univariate Outliers
You didnt provide your data for us to look at, so instead I will use the `mpg` dataset in R, which measures a number of variables on automobile metrics. I will only use the displ, hwy, and cty variables here for demonstration.
Since you were possibly looking for an R solution, one simple way is to use the `is_outlier` function in the `rstatix` package. You can also consider checking the mahalanobis distance with `mahalanobis_distance` if you are concerned about multivariate outliers. To quickly inspect, you can use `is_outlier` for generic detection (you can modify the settings to set the criterion for what is an "outlier" too) or `is_extreme` for extreme outliers.
```
#### Load Libraries ####
library(tidyverse)
library(rstatix)
#### Check Outliers ####
is_outlier(mpg$hwy) %>%
table()
```
Here you can see in the tabulated outcome that there are three outliers:
```
FALSE TRUE
231 3
```
We can plot them by coloring this factor within `ggplot` in the `tidyverse` package we just loaded:
```
#### Plot Outliers on Scatter Plot ####
mpg %>%
ggplot(aes(x=hwy,
y=displ))+
geom_point(aes(color=is_outlier(hwy)))+
geom_smooth(se=F,
color="lightblue")+
labs(color="Outlier",
x="Highway MPG",
y="Engine Displacement",
title="MPG x Displacement With Outlier Detection")+
theme_bw()+
scale_color_manual(values = c("darkblue",
"red"))
```
Which gives us this plot. Notice that what the commentor above is higlighted here as well...using `geom_smooth` allows us to see that the loess line has shifted towards the outliers at the end of this plot.
[](https://i.stack.imgur.com/TFc9B.png)
You mentioned that you would like to filter these values out. We can see clearly that highway MPG values above 40 are outliers now. So we simply make one switch to the plot code with `filter`:
```
mpg %>%
filter(!hwy > 40) %>%
ggplot(aes(x=hwy,
y=displ))+
geom_point(aes(color=is_outlier(hwy)))+
geom_smooth(se=F,
color="lightblue")+
labs(color="Outlier",
x="Highway MPG",
y="Engine Displacement",
title="MPG x Displacement With Outlier Detection")+
theme_bw()+
scale_color_manual(values = c("darkblue",
"red"))
```
Then our plot shows no values anymore:
[](https://i.stack.imgur.com/ozquF.png)
If you would like to save the data to not have these outliers, simply do so with the following code. FYI the `!` operator here simply says "dont give me this.":
```
mpg.no.outliers <- mpg %>%
filter(!hwy > 40)
```
### Multivariate Outliers
Multivariate outliers in your data can be handled in the same way, and your two variables are no different in that regard. We can try to tabulate them as so:
```
#### Find MVN Outliers ####
mpg %>%
select(cty,hwy) %>%
mahalanobis_distance() %>%
filter(is.outlier == "TRUE")
```
We thus find three outliers between the city and highway MPG variables:
```
# A tibble: 3 × 4
cty hwy mahal.dist is.outlier
<int> <int> <dbl> <lgl>
1 28 33 16.2 TRUE
2 33 44 14.7 TRUE
3 35 44 22.7 TRUE
```
To plot them, we use a very similar method:
```
#### Plot Them ####
mpg %>%
select(cty,hwy) %>%
mahalanobis_distance() %>%
ggplot(aes(x=hwy,
y=cty,
color=is.outlier))+
geom_point()+
geom_smooth(color="lightblue",
se=F)+
labs(x="Highway MPG",
y="City MPG",
title="Highway x City Mileage with MVN Outliers",
color="MVN Outlier?")+
theme_bw()+
scale_color_manual(values = c("darkblue",
"red"))
```
Which gives us this:
[](https://i.stack.imgur.com/mYwxq.png)
You can see in this case that the loess function does not have radical shifts due to the outliers. This is because the numeric values are extreme compared to the others, but their linearity is still similar to the rest of the data points.
As another has said, a more detailed discussion on the when and how of outliers can be had at Cross Validated.
| null | CC BY-SA 4.0 | null | 2022-09-25T04:30:20.850 | 2022-09-25T05:21:34.613 | 2022-09-25T05:21:34.613 | 16,631,565 | 16,631,565 | null |
73,842,382 | 2 | null | 71,613,919 | 0 | null | Below configuration must work:
```
treeview.configure(yscrollcommand=scrollbar.set)
```
| null | CC BY-SA 4.0 | null | 2022-09-25T06:09:27.107 | 2022-09-29T00:15:36.770 | 2022-09-29T00:15:36.770 | 8,512,262 | 18,795,619 | null |
73,842,478 | 2 | null | 33,878,539 | 0 | null | Use tailwind CSS ([https://tailwindcss.com/](https://tailwindcss.com/)) then the code below will create a nice info button.
```
<div class="flex items-center justify-center italic
text-stone-500 cursor-default w-5 h-5
rounded-full border border-gray-500 bg-green-100">
i
</div>
```
| null | CC BY-SA 4.0 | null | 2022-09-25T06:30:39.103 | 2022-09-25T06:30:39.103 | null | null | 2,179,062 | null |
73,842,636 | 2 | null | 73,841,083 | 0 | null | Thinking about this more, it makes sense, it was just very non-obvious what was happening because of the incorrect message from the IDE [1]
The gist of what I was doing is:
```
createViewModel() {
val repository = new Repository()
return new ViewModel(repository.showTimer)
}
```
The root issue is: `repository`
Normally this wouldn't be an issue, but in this case `showTimer`.
`Repository` was listening to an event source and posting new values to `showTimer`. But once it's garbage collected it ceases to post to `showTimer`. So while `viewModel` has a reference to `showTimer`,
---
Just to confirm that was exactly what was happening, I added a finalizer that logged the stack trace when Repository was collected, along the lines of:
```
class Repository(){
val stackTraceWhenCreated = GetStackTrace()
fun finalize() { //Run when Repository is garbage collected
logger.info("Repository finalized, was created at $stackTraceWhenCreated")
}
}
```
And sure enough, the logs show immediately after leaving `createViewModel`, the repository is garbage collected (heavily truncated logs:)
```
Repository was finalized, was created at:
java.lang.Exception
at Repository.Constructor
at createViewModel()
```
---
So any change that that explicitly holds a reference to `repository` past the end of the function scope works... including adding `val`. That forces ViewModel to hold onto `repository` for its lifetime and allows `showTimer` to be updated.
I went with something a little more explicit and stored a reference to Repository in the calling class for createViewModel().
---
[1] Thinking about this I realized the reason why I've never run into this, despite it being such a common pattern, is a quirk of the event source being used
Normally registering a listener goes along the lines of
```
val myListener = { this.updateValue() }
eventSource.registerListener(myListener)
//Some time later
eventSource.unregisterListener(myListener)
```
Causing a reference to be held to `this` as long as the eventSource is subscribed to. But this specific `eventSource` explicitly mentions only holding to its listeners (it's a long well known source of confusion: [What is meant by a 'strong' reference to an object, and why should we store the reference to OnSharedPreferenceChangeListener in an object's data?](https://stackoverflow.com/questions/35935936/what-is-meant-by-a-strong-reference-to-an-object-and-why-should-we-store-the)).
I had accounted for this by storing the listener in a field, but since the only reference to said listener is a , by extension the only reference to the entire class is a
So I decided to fix it by having Repository hold a strong reference to the listener in a static variable, and adding an explicit "close" method to Repository.
| null | CC BY-SA 4.0 | null | 2022-09-25T07:04:55.300 | 2022-09-25T09:05:22.870 | 2022-09-25T09:05:22.870 | 3,808,828 | 3,808,828 | null |
73,842,715 | 2 | null | 12,528,963 | 0 | null | using wmic:
show all running process where name of process is cmd.exe
```
wmic process where name="cmd.exe" GET ProcessId, CommandLine,CreationClassName
```
then terminate the specific instance of process by processId (PID)
`WMIC PROCESS WHERE "ProcessID=13800" CALL TERMINATE`
| null | CC BY-SA 4.0 | null | 2022-09-25T07:25:15.230 | 2022-09-25T07:25:15.230 | null | null | 14,266,997 | null |
73,842,835 | 2 | null | 66,905,383 | 0 | null |
```
const [imageUpload, setImageUpload] = React.useState(null); // image selecting state
const [image, setImage] = React.useState(""); //url setting state
const storage = getStorage();
useEffect(() => {
// declare the data getImage function
const getImage = async () => {
const ImageURL = await getDownloadURL(ref(storage, `${imageUpload.name}`));
setImage(ImageURL);
}
// call the function
getImage()
console.log(image)
}, [imageUpload])
const uploadImage = () => {
if (imageUpload == null) return;
const storageRef = ref(storage, `${imageUpload.name}`);
uploadBytes(storageRef, imageUpload).then((snapshot) => {
console.log("Uploaded image");
});
};
```
| null | CC BY-SA 4.0 | null | 2022-09-25T07:50:07.550 | 2022-09-25T07:50:07.550 | null | null | 14,119,926 | null |
73,843,086 | 2 | null | 73,840,363 | 2 | null | You have wrong event handler signature here:
```
Private Async Function WebView2_NavigationCompletedAsync(
sender As Object, e As CoreWebView2NavigationCompletedEventArgs) _
As Task Handles WebView21.NavigationCompleted
' ...
End Function
```
an [event handler](https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/events/) is a `Sub/void` not a `Function` and does not return any value of any type.
The correct signature is:
```
Private Sub WebView2_NavigationCompletedAsync(
sender As Object, e As CoreWebView2NavigationCompletedEventArgs) _
Handles WebView21.NavigationCompleted
' ...
End Sub
```
As for the `webView2` part, make the handle `Async` method and get the content of the target `td` as follows:
```
Private Async Sub WebView2_NavigationCompletedAsync(
sender As Object,
e As CoreWebView2NavigationCompletedEventArgs) _
Handles WebView21.NavigationCompleted
Dim firstName = (Await WebView21.
ExecuteScriptAsync("document.getElementById('m.first_name').textContent;")).
Trim(ChrW(34))
Debug.WriteLine(firstName)
End Sub
```
You could try the [querySelector()](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) method as well:
```
Private Async Sub WebView2_NavigationCompletedAsync(
sender As Object,
e As CoreWebView2NavigationCompletedEventArgs) _
Handles WebView21.NavigationCompleted
Dim firstName = (Await WebView21.
ExecuteScriptAsync("document.querySelector('#m\\.first_name').textContent;")).
Trim(ChrW(34))
Debug.WriteLine(firstName)
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-09-25T08:35:13.783 | 2022-09-25T08:35:13.783 | null | null | 14,171,304 | null |
73,843,245 | 2 | null | 73,843,216 | 0 | null | You could create a column with the colors you want to give each bar. Here is an example using `mutate` by calling the column "mypal" with the first five colors of your vector:
```
library(tidyverse)
library(highcharter)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
df <- tibble(category = c('A1', 'A2', 'A3', 'A4','A5'),
n = c(3415,3701,2898,2409,1886))
mypal <- c("#BC3C29FF", "#0072B5FF", "#E18727FF",
"#20854EFF", "#7876B1FF", "#6F99ADFF","#FFDC91FF","#EE4C97FF")
df %>%
mutate(mypal = mypal[1:5]) %>%
arrange(desc(n)) %>%
hchart( type = 'bar', hcaes(x = category, y = n, color = mypal))%>%
hc_title(text = 'Most Reported Categories') %>%
hc_xAxis(title = '') %>%
hc_add_theme(hc_theme_elementary())
```
[](https://i.stack.imgur.com/AHUXH.png)
[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-09-25T09:01:43.070 | 2022-09-25T09:01:43.070 | null | null | 14,282,714 | null |
73,843,474 | 2 | null | 73,841,935 | 0 | null | Thanks for providing the `dput`, but I'm guessing some information was lost in the subset you gave because I'm unable to reproduce it. For example `CPTED_DIST` only goes to -1 here when I glimpse the data:
```
Rows: 10
Columns: 39
$ OBJECTID <int> 8, 15, 29, 43, 52, 72, 96, 115, 116, 117
$ Care_500m <int> 0, 391, 0, 185, 296, 0, 279, 262, 262, 262
$ Kind_500m <int> 284, 0, 161, 344, 155, 161, 219, 269, 269, 269
$ Elem_500m <int> 0, 652, 630, 521, 652, 630, 667, 521, 521, 521
$ Midl_500m <int> 0, 553, 757, 0, 1310, 757, 0, 0, 0, 0
$ High_500m <int> 0, 0, 2182, 0, 0, 2182, 0, 0, 0, 0
$ Area <dbl> 76.160, 77.490, 76.832, 57.900, 67.670, 68.250, 63.…
$ Land_Area <dbl> 42.30, 33.00, 53.74, 26.59, 52.90, 26.20, 62.00, 44…
$ Floor <int> 3, 5, 4, 4, 2, 4, 2, 3, 3, 4
$ YY.MM <chr> "2010. 01", "2010. 01", "2010. 01", "2010. 01", "20…
$ Constructe <int> 2002, 1981, 1998, 2001, 1979, 2000, 1979, 2009, 200…
$ Age <int> 8, 29, 12, 9, 31, 10, 31, 1, 1, 1
$ Age.2 <int> 64, 841, 144, 81, 961, 100, 961, 1, 1, 1
$ Price_1000 <int> 9100, 8700, 10200, 8700, 7200, 8800, 11650, 11700, …
$ CPI_Price <dbl> 10114.033, 9669.460, 11336.608, 9669.460, 8002.312,…
$ CPI_Sqm <dbl> 132.7998, 124.7833, 147.5506, 167.0028, 118.2549, 1…
$ LM.PRICE. <dbl> 9.221679, 9.176728, 9.335792, 9.176728, 8.987486, 9…
$ CPTED_YR <fct> 999, 999, 999, 999, 999, 999, 999, 999, 999, 999
$ YR_D3 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ YR_D2 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ YR_D1 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ YR_D0 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ YR_A1 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ YR_A2 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ YR_A3 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ AFTER <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ D0_D100 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ BEF_D100 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ AFT_D100 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ D100_D200 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ AFT_D200 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
$ CPTED_DIST <dbl> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
$ CBD_DIST <dbl> 11991.10, 8773.04, 8964.61, 9999.16, 8633.87, 8891.…
$ SBWY_DIST <dbl> 2933.490, 148.544, 384.490, 475.106, 153.118, 390.7…
$ EMD <int> 33, 38, 38, 38, 38, 38, 38, 38, 38, 38
$ SIG <chr> "Gangseo", "Geumjeong", "Geumjeong", "Geumjeong", "…
$ POP_YR <dbl> 22618, 57399, 57399, 57399, 57399, 57399, 57399, 57…
$ DONG_AREA <dbl> 14.16150, 6.27858, 6.27858, 6.27858, 6.27858, 6.278…
$ INC_YR <dbl> 240.9639, 269.6291, 269.6291, 269.6291, 269.6291, 2…
```
I can provide an example with another dataset if that is helpful.
I'm thinking your issue is that you are using `geom_line` rather than `geom_smooth` (you used this in your first example and I think it makes sense to do in your second plot as well). The `geom_line` function draws a line to the next proximal point, whereas `geom_smooth` tries to run either an OLS regression line or loess regression line through the data. Here is an example of `geom_line` and how messy it looks:
```
iris %>%
ggplot(aes(x=Sepal.Length,
y=Sepal.Width))+
geom_line(aes(linetype=Species,
color=Species),
se=F)
```
[](https://i.stack.imgur.com/IC9bI.png)
Versus `geom_smooth`:
```
iris %>%
ggplot(aes(x=Sepal.Length,
y=Sepal.Width))+
geom_smooth(aes(linetype=Species,
color=Species),
se=F)
```
Seen below, where I have changed both the color and the linetype of each line:
[](https://i.stack.imgur.com/xTHAm.png)
I also tried to loosely simulate your data and made a similar plot below, which you can of course switch out for your values in your data:
```
df <- data.frame(CPTED_DIST = rnorm(n=1000,
mean=1000,
sd=100),
CPI_Price = rnorm(n=1000,
mean=9000),
CPTED_YR = as.factor(rbinom(n=1000,
size=3,
prob=.5)))
unique(df$CPTED_YR)
df %>%
ggplot(aes(x=CPTED_DIST,
y=CPI_Price))+
geom_smooth(se=F,
data = filter(df, CPTED_YR==2),
aes(color = CPTED_YR),
linetype = "longdash")+
geom_smooth(se=F,
data = filter(df, CPTED_YR==1),
aes(color = CPTED_YR),
linetype = "dashed")+
geom_smooth(se=F,
data = filter(df, CPTED_YR==0),
aes(color = CPTED_YR),
linetype = "solid")+
geom_smooth(se=F,
data = filter(df, CPTED_YR==3),
aes(color = CPTED_YR),
linetype = "twodash")+
geom_vline(xintercept = 1000)+
scale_color_manual(values=c("blue",
"navyblue",
"red",
"brown"))
```
Which gives you this (I turned of the SE of each line btw because its distracting for the data I used):
[](https://i.stack.imgur.com/aUJX2.png)
Let me know if this is similar to what you are looking for and if not I can amend my answer.
| null | CC BY-SA 4.0 | null | 2022-09-25T09:37:06.557 | 2022-09-25T09:37:06.557 | null | null | 16,631,565 | null |
73,843,840 | 2 | null | 44,667,916 | 0 | null | If you are extending your Bottomsheet class to BottomSheetDialogFragment(), you can use dialog's decorView as a view.
Sample Code Snippet for reference :
```
Snackbar.make(
dialog?.window?.decorView,
"Press login button to continue",
Snackbar.LENGTH_LONG
)
.setAction("Login") { v: View? ->
val intent = Intent(context, DestinationActivityAfterLogin::class.java)
startActivity(intent)
}.show()
```
====
If you are using BottomSheetDialog for showing the bottomsheet, there one can use rootView to pop-up snackbar.
Sample code for reference :
```
Snackbar.make(
bsBinding.root.rootView, // bsBinding is view binding object
"Press login button to continue",
Snackbar.LENGTH_LONG
)
.setAction("Login") { v: View? ->
val intent = Intent(context, DestinationActivityAfterLogin::class.java)
startActivity(intent)
}.show()
```
Hope this would be useful while showing snackbar with bottom sheet dialogs.
Happy coding.
| null | CC BY-SA 4.0 | null | 2022-09-25T10:39:52.073 | 2022-09-25T10:39:52.073 | null | null | 12,256,844 | null |
73,843,941 | 2 | null | 26,292,710 | 0 | null | We have a table ABC. In that table we have a column which contains dropdown as select having value as blank, option a, option b. Now, with change with this dropdown I want to update the input field accordingly, i.e; if a is chosen, input field value will be 100, if b is chosen, input field will be 0 and if blank is chosen, input field will be blank , readonly. The input field id is set to input_ where i is 1 to no of rows in the table.
Below is the code for implementing this.
HTML :
```
<select id="select" onChange="changeEvent(this.options[this.selectedIndex].value);" name="select">
```
Javascript:
```
function changeEvent(chosen) {
var table = document.getElementById("ABC");
var rows = document.querySelectorAll('tr');
var rowsArray = Array.from(rows);
table.addEventListener('change', (event) => {
var target = event.target.toString();
var rowIndex = rowsArray.findIndex(row => row.contains(event.target));
var x = table.rows.length;
var id = "input_"+(parseInt(rowIndex) - 2).toString();
if(chosen === "a") {
table.rows[rowIndex].cells.item(3).innerHTML="<td><input value='100' id='"+id+" 'style='width:50px;'></input></td>";
return;
}else if(chosen === "b"){
table.rows[rowIndex].cells.item(3).innerHTML="<td><input value='0' id='"+id+"' readonly style='width:50px;'></input></td>";
return;
}else{
table.rows[rowIndex].cells.item(3).innerHTML="<td><input value='' id='"+id+"' readonly style='width:50px;'></input></td>";
return;
}
})
}
```
| null | CC BY-SA 4.0 | null | 2022-09-25T10:55:55.297 | 2022-09-25T10:55:55.297 | null | null | 7,840,465 | null |
73,843,947 | 2 | null | 73,828,475 | 1 | null | When counting the level from bottom to top, the solution becomes:
```
require(igraph)
tree2 <- make_tree(10, 3) + make_tree(10, 2)
tree3 <- set_edge_attr(tree2, name="weight", value=-1) # longest path = shortest negative
dist <- (-distances(tree3, v=(V(tree3)), mode="out")) # matrix of VxV distances of shortest paths
layers <- apply(dist, 1, max) # max per row
layers <- max(layers) - layers # shift down
plot(tree3, layout=layout_with_sugiyama(tree3, layers=layers))
```
If the `dist` matrix does not fit in memory then a `dfs()` search must be done, calculating the layers.
| null | CC BY-SA 4.0 | null | 2022-09-25T10:56:24.663 | 2022-09-25T15:23:16.570 | 2022-09-25T15:23:16.570 | 3,604,103 | 3,604,103 | null |
73,844,166 | 2 | null | 73,541,662 | 0 | null | This should be fixed with next release:
[https://github.com/MudBlazor/MudBlazor/pull/5355](https://github.com/MudBlazor/MudBlazor/pull/5355)
| null | CC BY-SA 4.0 | null | 2022-09-25T11:31:12.303 | 2022-09-25T11:31:12.303 | null | null | 11,507,197 | null |
73,844,418 | 2 | null | 73,828,475 | 1 | null | In the example supplied, calculate roots and rootlevels as follows:
```
require(igraph)
tree2 <- make_tree(10, 3) + make_tree(10, 2)
roots <- V(tree2)[which(degree(tree2, mode="in") == 0)] # no incoming edges
dist <- distances(tree2, roots) # all distances from roots
dist[which(is.infinite(dist))] <- NA # remove infinite
rootlevel <- apply(dist, 1, max, na.rm = TRUE) # max per row
rootlevel <- max(rootlevel) - rootlevel + 1 # offset
plot(tree2, layout=layout_as_tree(tree2, root=roots, rootlevel=rootlevel))
```
If the `dist` matrix does not fit in memory then a `dfs()` search must be done, calculating the layers.
| null | CC BY-SA 4.0 | null | 2022-09-25T12:17:32.220 | 2022-10-02T07:44:33.387 | 2022-10-02T07:44:33.387 | 3,604,103 | 3,604,103 | null |
73,844,514 | 2 | null | 73,843,834 | 1 | null | According to the [regexp_replace's docs](https://spark.apache.org/docs/3.0.1/api/python/pyspark.sql.html#pyspark.sql.functions.regexp_replace), the last parameter should be a string as well, but you're passing an integer.
| null | CC BY-SA 4.0 | null | 2022-09-25T12:35:56.013 | 2022-09-25T12:35:56.013 | null | null | 3,441,510 | null |
73,844,604 | 2 | null | 73,844,296 | 2 | null | ViewModels are unique to classes that implement `ViewModelStoreOwner`
```
@Composable
public inline fun <reified VM : ViewModel> viewModel(
viewModelStoreOwner: ViewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) {
"No ViewModelStoreOwner was provided via LocalViewModelStoreOwner"
},
key: String? = null,
factory: ViewModelProvider.Factory? = null,
extras: CreationExtras = if (viewModelStoreOwner is HasDefaultViewModelProviderFactory) {
viewModelStoreOwner.defaultViewModelCreationExtras
} else {
CreationExtras.Empty
}
```
`ComponentActivity` implements `ViewModelStoreOwner`, so it's a `ViewModelStoreOwner` that contains its own `ViewModel` instances and uses a `HashMap` to get same `ViewModel` for key provided as String.
```
val vm: MyViewModel = ViewModelProvider(owner = this)[MyViewModel::class.java]
```
This is how they are created under the hood. This here is Activity or Fragment depending on where ViewModelProvider's owner param is set at. In Compose ViewModelStore owner is accessed by `LocalViewModelStoreOwner.current`
You need to pass your `hasChanged` between `Activities` using `Bundle`, or have a Singleton repository or UseCase class that you can inject to both ViewModels or use local db or another methods to pass data between Activities.
| null | CC BY-SA 4.0 | null | 2022-09-25T12:47:21.403 | 2022-09-25T12:49:26.117 | 2022-09-25T12:49:26.117 | 5,457,853 | 5,457,853 | null |
73,844,644 | 2 | null | 73,843,406 | 1 | null | There are 3 different approaches to [loading related entities](https://learn.microsoft.com/en-us/ef/core/querying/related-data/) via navigation properties in the model. It seems that [lazy loading](https://learn.microsoft.com/en-us/ef/core/querying/related-data/lazy) is not enabled in your case (and personally I'm not a big fan of it), so you need to either [explicitly load](https://learn.microsoft.com/en-us/ef/core/querying/related-data/explicit) them or use [eager loading](https://learn.microsoft.com/en-us/ef/core/querying/related-data/eager):
```
var result = _context.Employees
.Include(e => e.Department)
.ToList();
EmployeesVM = _mapper.Map<List<EmployeesVM>>(result);
```
Also possibly you would like to use Automapper's has [queryable extensions](https://docs.automapper.org/en/stable/Queryable-Extensions.html) to prevent overfetching an handle the relations via the `ProjectTo<>` method which will tell AutoMapper’s mapping engine to emit a select clause to the IQueryable that will inform entity framework that it only needs to query some of the fields.
Note that `ProjectTo` has quite a lot of limitations in terms of supported mappings ([see this part of the docs](https://docs.automapper.org/en/stable/Queryable-Extensions.html#supported-mapping-options)).
| null | CC BY-SA 4.0 | null | 2022-09-25T12:55:38.697 | 2022-09-25T13:26:59.683 | 2022-09-25T13:26:59.683 | 2,501,279 | 2,501,279 | null |
73,844,777 | 2 | null | 73,844,454 | 4 | null | You can use `width` and `height`, as documented [here](https://quarto.org/docs/authoring/figures.html#pgftikz-graphics).
```
---
title: "resize image"
format: pdf
---
{width=10%}
{height=50%}
```
You can also use `px` and `in` as the unit, or specify it between quotes:
```
{height=100px}
{height=2in}
{height="100"}
```
---
`fig-height``fig-width`
As stated in the [document](https://quarto.org/docs/reference/formats/pdf.html#figures) you cite, `fig-height` and `fig-width` are settings for the .
Since your image is not generated by R or Matplotlib, you should use `pandoc`'s attributes, as documented [here](https://pandoc.org/MANUAL.html#extension-link_attributes).
| null | CC BY-SA 4.0 | null | 2022-09-25T13:15:11.130 | 2022-09-25T14:01:55.680 | 2022-09-25T14:01:55.680 | 13,460,602 | 13,460,602 | null |
73,844,864 | 2 | null | 73,844,360 | 0 | null | This is quite challenging in older Excel, but possible nonetheless:
```
=IFERROR(
INDEX(
MMULT(--(RANK($C$4:$C$12,$C$4:$C$12)+RANK($D$4:$D$12,$D$4:$D$12)+RANK($E$4:$E$12,$E$4:$E$12)>=TRANSPOSE(RANK($C$4:$C$12,$C$4:$C$12)+RANK($D$4:$D$12,$D$4:$D$12)+RANK($E$4:$E$12,$E$4:$E$12))),ROW($C$4:$C$12)^0),ROW($A1))
-SUMPRODUCT(--(MMULT(--(RANK($C$4:$C$12,$C$4:$C$12)+RANK($D$4:$D$12,$D$4:$D$12)+RANK($E$4:$E$12,$E$4:$E$12)>=TRANSPOSE(RANK($C$4:$C$12,$C$4:$C$12)+RANK($D$4:$D$12,$D$4:$D$12)+RANK($E$4:$E$12,$E$4:$E$12))),ROW($C$4:$C$12)^0)
=INDEX(MMULT(--(RANK($C$4:$C$12,$C$4:$C$12)+RANK($D$4:$D$12,$D$4:$D$12)+RANK($E$4:$E$12,$E$4:$E$12)>=TRANSPOSE(RANK($C$4:$C$12,$C$4:$C$12)+RANK($D$4:$D$12,$D$4:$D$12)+RANK($E$4:$E$12,$E$4:$E$12))),ROW($C$4:$C$12)^0),
ROW($A1))))+1
,"")
```
(requires being entered with `ctrl+shift+enter`)
[](https://i.stack.imgur.com/rDIS7.png)
Explanation:
First an array is made of the sum of the 3 rankings:
`RANK($C$4:$C$12,$C$4:$C$12)+RANK($D$4:$D$12,$D$4:$D$12)+RANK($E$4:$E$12,$E$4:$E$12)`
This results in your so called Rank Sum - array.
Then - since `RANK` requires a range, not an array, we need an alternative to create a ranking of the array: `MMULT` can do that.
`MMULT(RankSum>=RankSum,ROW(RankSum)^0)` creates an array of the ranked RankSum, however. If 2 are ranked equally - for instance rank 1 - it's rank both as 2, not 1. Therefore I used `SUMPRODUCT` to calculate the number of items in the calculated `MMULT`-array that equal the indexed `MMULT`-array result as an alternative to `COUNTIF`, which is also limited to take a Range, not Array. So `MMULTarray-SUMPRODUCT(--(MMULTarray=IndexedMMULTarray))` is your end result.
Calculation is based on your data being in `B4:E12` and formula above is entered (with `ctrl+shift+enter`) in a cell in row 4 and copied down; `I4` in the shared screenshot.
Even though this formula answers your question, I doubt this is what you thought what it would be. Changing the range to a different range by itself could be very teasing. And calculating the rankings manually and sum/rank them is probably easier to maintain. You may make it more dynamical by adding INDEX in the ranges.
| null | CC BY-SA 4.0 | null | 2022-09-25T13:27:34.117 | 2022-09-25T15:41:37.883 | 2022-09-25T15:41:37.883 | 12,634,230 | 12,634,230 | null |
73,844,928 | 2 | null | 73,844,708 | 1 | null | You can use the `text.width` argument of the `legend()`-function.
```
data <- as.matrix(data.frame(A = c(0.2, 0.4),
B = c(0.3, 0.1),
C = c(0.7, 0.1),
D = c(0.1, 0.2),
E = c(0.3, 0.3)))
barplot(data, col = c("#1b98e0", "#353436"))
legend("topleft",
legend = c("Group 1", "Group 2"),
fill = c("#1b98e0", "#353436"),
text.width = 2)
```
which yields
[](https://i.stack.imgur.com/A9Hm1.png)
| null | CC BY-SA 4.0 | null | 2022-09-25T13:37:37.410 | 2022-09-25T13:37:37.410 | null | null | 17,942,871 | null |
73,845,619 | 2 | null | 73,832,211 | 0 | null | Another option using `dplyr` to add a column with the colors to each year like this:
```
library(ggplot2)
library(dplyr)
mpg %>%
mutate(colors = case_when(year == 1999 ~ '1',
year == 2008 ~ '2')) %>%
ggplot(aes(x = displ,y = hwy, color = colors)) +
geom_point(size = 5) +
scale_color_manual('year', values = c('1' = 'blue', '2' = 'red'), labels = c('1999', '2008'))
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-09-25T15:15:59.357 | 2022-09-25T15:15:59.357 | null | null | 14,282,714 | null |
73,845,976 | 2 | null | 58,300,790 | 0 | null | ```
span {
width: min-content;
}
```
Setting the `width` of the span tag to `min-content` worked for me.
| null | CC BY-SA 4.0 | null | 2022-09-25T16:07:07.860 | 2022-10-01T00:21:34.560 | 2022-10-01T00:21:34.560 | 10,245,694 | 18,604,721 | null |
73,846,285 | 2 | null | 73,844,360 | 1 | null | Assuming the same layout as P.b., in `I4`:
`=1+SUMPRODUCT(N(MMULT(CHOOSE({1,2,3},RANK(C$4:C$12,C$4:C$12),RANK(D$4:D$12,D$4:D$12),RANK(E$4:E$12,E$4:E$12)),{1;1;1})<SUM(RANK(C4,C$4:C$12),RANK(D4,D$4:D$12),RANK(E4,E$4:E$12))))`
and copied down.
| null | CC BY-SA 4.0 | null | 2022-09-25T16:55:04.497 | 2022-09-25T16:55:04.497 | null | null | 17,007,704 | null |
73,846,538 | 2 | null | 73,840,363 | 1 | null | You haven't provided enough code to know exactly what the issue is.
According to [WebView2.CoreWebView2 Property](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2.corewebview2?view=webview2-dotnet-1.0.1343.22):
> Accesses the complete functionality of the underlying CoreWebView2 COM
API. Returns null until initialization has completed. See the
[WebView2 class](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2?view=webview2-dotnet-1.0.1343.22) documentation for an initialization overview.
It's not clear how you're initializing CoreWebView2. The issue may be with your CoreWebView2 initialization and order of execution. You can use [Debug.WriteLine](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.debug.writeline?view=net-6.0) to confirm this. To help debug the issue, subscribe to the following events:
[WebView2](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2?view=webview2-dotnet-1.0.1343.22):
- [CoreWebView2InitializationCompleted](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2.corewebview2initializationcompleted?view=webview2-dotnet-1.0.1343.22)- [NavigationCompleted](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2.navigationcompleted?view=webview2-dotnet-1.0.1343.22)
[CoreWebView2](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2?view=webview2-dotnet-1.0.1343.22):
- [DOMContentLoaded](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.domcontentloaded?view=webview2-dotnet-1.0.1343.22)
---
Below shows how to set the UserDataFolder for both explicit and implicit initialization.
: `Microsoft.Web.WebView2` (v 1.0.1293.44)
: WebView2 version `1.0.1343.22` seems to have a bug that causes a null reference exception. This can be seen by placing the following code within the `CoreWebView2InitializationCompleted` event handler:
```
Private Sub WebView21_CoreWebView2InitializationCompleted(sender As Object, e As CoreWebView2InitializationCompletedEventArgs) Handles WebView21.CoreWebView2InitializationCompleted
Dim wv As WebView2 = DirectCast(sender, WebView2)
Debug.WriteLine($"UserDataFolder: {wv.CoreWebView2.Environment.UserDataFolder}")
Debug.WriteLine($"Edge Browser version: {wv.CoreWebView2.Environment.BrowserVersionString}")
End Sub
```
However, explicit initialization, using CoreWebView2Environment as shown below, seems to work in WebView2 version `1.0.1343.22`.
On the form, I've used TableLayoutPanel, TextBox (name: textBoxAddressBar), Button (names: btnBack, btnForward, btnGo), and WebView2 (name: WebView21) controls.
Here's what the form looks like:
[](https://i.stack.imgur.com/EAPpJ.png)
In the code below, each of the options contains some common code. To avoid confusion, I've included the complete code (for each of the options) and added explanations (as comments) within the code. Each of the options below have been tested.
- explicit initialization (CoreWebView2Environment)
```
Imports System.IO
Imports Microsoft.Web.WebView2.Core
Imports Microsoft.Web.WebView2.WinForms
Public Class Form1
Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LogMsg($"WebView2 version: {GetWebView2Version()}")
'explicitly initialize CoreWebView2
Await InitializeCoreWebView2Async(WebView21)
'since we've used explicit initialization, which is Awaited,
'if desired, one can subscribe to CoreWebView2 events here
'instead of within CoreWebView2InitializationCompleted
'subscribe to events
'AddHandler WebView21.CoreWebView2.DOMContentLoaded, AddressOf CoreWebView2_DOMContentLoaded
'AddHandler WebView21.CoreWebView2.HistoryChanged, AddressOf CoreWebView2_HistoryChanged
LogMsg($"before setting source")
'ToDo: update with desired URL
'after setting Source property execution continues immediately
WebView21.Source = New Uri("http://127.0.0.1:9009/index.html")
LogMsg($"after setting source")
End Sub
Public Function GetWebView2Version() As String
Dim webView2Assembly As System.Reflection.Assembly = GetType(WebView2).Assembly
Return FileVersionInfo.GetVersionInfo(webView2Assembly.Location).ProductVersion
End Function
Public Async Function InitializeCoreWebView2Async(wv As WebView2, Optional userDataFolder As String = Nothing) As Task
Dim options As CoreWebView2EnvironmentOptions = Nothing
Dim webView2Environment As CoreWebView2Environment = Nothing
If String.IsNullOrEmpty(userDataFolder) Then
'create unique name for web cache folder in temp folder
'userDataFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.Guid.NewGuid().ToString("N"))
userDataFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().Location))
End If
'webView2Environment = await CoreWebView2Environment.CreateAsync(@"C:\Program Files (x86)\Microsoft\Edge\Application\105.0.1343.50", userDataFolder, options);
webView2Environment = Await CoreWebView2Environment.CreateAsync(Nothing, userDataFolder, options)
LogMsg("before EnsureCoreWebView2Async")
'wait for CoreWebView2 initialization
Await wv.EnsureCoreWebView2Async(webView2Environment)
LogMsg("after EnsureCoreWebView2Aync")
LogMsg("UserDataFolder folder set to: " & userDataFolder)
End Function
Private Sub LogMsg(ByVal msg As String)
msg = String.Format("{0} {1}", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff"), msg)
Debug.WriteLine(msg)
End Sub
Public Sub WebsiteNavigate(ByVal wv As WebView2, ByVal dest As String)
If Not wv Is Nothing AndAlso Not wv.CoreWebView2 Is Nothing Then
If Not String.IsNullOrEmpty(dest) Then
If Not dest = "about:blank" AndAlso
Not dest.StartsWith("edge://") AndAlso
Not dest.StartsWith("file://") AndAlso
Not dest.StartsWith("http://") AndAlso
Not dest.StartsWith("https://") AndAlso
Not System.Text.RegularExpressions.Regex.IsMatch(dest, "^([A-Z]|[a-z]):") Then
'URL must start with one of the specified strings
'if Not, pre-pend with "http://"
'Debug.Print("Prepending ""http://"" to URL.")
'set value
dest = "http://" & dest
End If
'option 1
wv.Source = New Uri(dest, UriKind.Absolute)
'option 2
'wv.CoreWebView2.Navigate(dest)
End If
End If
End Sub
Private Sub textBoxAddressBar_KeyDown(sender As Object, e As KeyEventArgs) Handles textBoxAddressBar.KeyDown
If e.KeyCode = Keys.Enter AndAlso WebView21 IsNot Nothing Then
WebsiteNavigate(WebView21, textBoxAddressBar.Text)
End If
End Sub
Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
WebsiteNavigate(WebView21, textBoxAddressBar.Text)
End Sub
Private Async Sub CoreWebView2_DOMContentLoaded(sender As Object, e As CoreWebView2DOMContentLoadedEventArgs)
LogMsg($"CoreWebView2_DOMContentLoaded")
Dim cwv2 As CoreWebView2 = DirectCast(sender, CoreWebView2)
Try
Dim result As String = Await cwv2.ExecuteScriptAsync("document.getElementById('m.first_name').textContent")
Debug.WriteLine($"result: {result}")
Catch ex As AggregateException
'ToDo: change code as desired
LogMsg($"Error: {ex.Message}")
If ex.InnerExceptions IsNot Nothing Then
For Each ex2 As Exception In ex.InnerExceptions
LogMsg($"{ex2.Message}")
Next
End If
LogMsg($"StackTrace: {ex.StackTrace}")
End Try
End Sub
Private Sub CoreWebView2_HistoryChanged(sender As Object, e As Object)
Dim cwv2 As CoreWebView2 = DirectCast(sender, CoreWebView2)
btnBack.Enabled = WebView21.CoreWebView2.CanGoBack
btnForward.Enabled = WebView21.CoreWebView2.CanGoForward
'update address bar
textBoxAddressBar.Text = cwv2.Source
textBoxAddressBar.Select(textBoxAddressBar.Text.Length, 0)
End Sub
Private Sub WebView21_CoreWebView2InitializationCompleted(sender As Object, e As CoreWebView2InitializationCompletedEventArgs) Handles WebView21.CoreWebView2InitializationCompleted
Dim wv As WebView2 = DirectCast(sender, WebView2)
LogMsg($"WebView21_CoreWebView2InitializationCompleted")
LogMsg($"UserDataFolder: {WebView21.CoreWebView2.Environment.UserDataFolder}")
LogMsg($"Edge Browser version: {WebView21.CoreWebView2.Environment.BrowserVersionString}")
'subscribe to events
AddHandler wv.CoreWebView2.DOMContentLoaded, AddressOf CoreWebView2_DOMContentLoaded
AddHandler wv.CoreWebView2.HistoryChanged, AddressOf CoreWebView2_HistoryChanged
End Sub
Private Sub WebView21_NavigationCompleted(sender As Object, e As CoreWebView2NavigationCompletedEventArgs) Handles WebView21.NavigationCompleted
LogMsg($"WebView21_NavigationCompleted")
End Sub
End Class
```
- explicit initialization (CreationProperties)
```
Imports System.IO
Imports Microsoft.Web.WebView2.Core
Imports Microsoft.Web.WebView2.WinForms
Public Class Form1
Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LogMsg($"WebView2 version: {GetWebView2Version()}")
'set UserDataFolder
Dim userDataFolder As String = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().Location))
WebView21.CreationProperties = New CoreWebView2CreationProperties() With {.UserDataFolder = userDataFolder}
'explicitly initialize CoreWebView2
Await WebView21.EnsureCoreWebView2Async()
'since we've used explicit initialization, which is Awaited,
'if desired, one can subscribe to CoreWebView2 events here
'instead of within CoreWebView2InitializationCompleted
'subscribe to events
'AddHandler WebView21.CoreWebView2.DOMContentLoaded, AddressOf CoreWebView2_DOMContentLoaded
'AddHandler WebView21.CoreWebView2.HistoryChanged, AddressOf CoreWebView2_HistoryChanged
LogMsg($"before setting source")
'ToDo: update with desired URL
'after setting Source property execution continues immediately
WebView21.Source = New Uri("http://127.0.0.1:9009/index.html")
LogMsg($"after setting source")
End Sub
Public Function GetWebView2Version() As String
Dim webView2Assembly As System.Reflection.Assembly = GetType(WebView2).Assembly
Return FileVersionInfo.GetVersionInfo(webView2Assembly.Location).ProductVersion
End Function
Private Sub LogMsg(ByVal msg As String)
msg = String.Format("{0} {1}", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff"), msg)
Debug.WriteLine(msg)
End Sub
Public Sub WebsiteNavigate(ByVal wv As WebView2, ByVal dest As String)
If Not wv Is Nothing AndAlso Not wv.CoreWebView2 Is Nothing Then
If Not String.IsNullOrEmpty(dest) Then
If Not dest = "about:blank" AndAlso
Not dest.StartsWith("edge://") AndAlso
Not dest.StartsWith("file://") AndAlso
Not dest.StartsWith("http://") AndAlso
Not dest.StartsWith("https://") AndAlso
Not System.Text.RegularExpressions.Regex.IsMatch(dest, "^([A-Z]|[a-z]):") Then
'URL must start with one of the specified strings
'if Not, pre-pend with "http://"
'Debug.Print("Prepending ""http://"" to URL.")
'set value
dest = "http://" & dest
End If
'option 1
wv.Source = New Uri(dest, UriKind.Absolute)
'option 2
'wv.CoreWebView2.Navigate(dest)
End If
End If
End Sub
Private Sub textBoxAddressBar_KeyDown(sender As Object, e As KeyEventArgs) Handles textBoxAddressBar.KeyDown
If e.KeyCode = Keys.Enter AndAlso WebView21 IsNot Nothing Then
WebsiteNavigate(WebView21, textBoxAddressBar.Text)
End If
End Sub
Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
WebsiteNavigate(WebView21, textBoxAddressBar.Text)
End Sub
Private Async Sub CoreWebView2_DOMContentLoaded(sender As Object, e As CoreWebView2DOMContentLoadedEventArgs)
LogMsg($"CoreWebView2_DOMContentLoaded")
Dim cwv2 As CoreWebView2 = DirectCast(sender, CoreWebView2)
Try
Dim result As String = Await cwv2.ExecuteScriptAsync("document.getElementById('m.first_name').textContent")
Debug.WriteLine($"result: {result}")
Catch ex As AggregateException
'ToDo: change code as desired
LogMsg($"Error: {ex.Message}")
If ex.InnerExceptions IsNot Nothing Then
For Each ex2 As Exception In ex.InnerExceptions
LogMsg($"{ex2.Message}")
Next
End If
LogMsg($"StackTrace: {ex.StackTrace}")
End Try
End Sub
Private Sub CoreWebView2_HistoryChanged(sender As Object, e As Object)
Dim cwv2 As CoreWebView2 = DirectCast(sender, CoreWebView2)
btnBack.Enabled = WebView21.CoreWebView2.CanGoBack
btnForward.Enabled = WebView21.CoreWebView2.CanGoForward
'update address bar
textBoxAddressBar.Text = cwv2.Source
textBoxAddressBar.Select(textBoxAddressBar.Text.Length, 0)
End Sub
Private Sub WebView21_CoreWebView2InitializationCompleted(sender As Object, e As CoreWebView2InitializationCompletedEventArgs) Handles WebView21.CoreWebView2InitializationCompleted
Dim wv As WebView2 = DirectCast(sender, WebView2)
LogMsg($"WebView21_CoreWebView2InitializationCompleted")
LogMsg($"UserDataFolder: {WebView21.CoreWebView2.Environment.UserDataFolder}")
LogMsg($"Edge Browser version: {WebView21.CoreWebView2.Environment.BrowserVersionString}")
'subscribe to events
AddHandler wv.CoreWebView2.DOMContentLoaded, AddressOf CoreWebView2_DOMContentLoaded
AddHandler wv.CoreWebView2.HistoryChanged, AddressOf CoreWebView2_HistoryChanged
End Sub
Private Sub WebView21_NavigationCompleted(sender As Object, e As CoreWebView2NavigationCompletedEventArgs) Handles WebView21.NavigationCompleted
LogMsg($"WebView21_NavigationCompleted")
End Sub
End Class
```
- implicit initialization (CreationProperties)
```
Imports System.IO
Imports Microsoft.Web.WebView2.Core
Imports Microsoft.Web.WebView2.WinForms
Public Class Form1
Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LogMsg($"WebView2 version: {GetWebView2Version()}")
'set UserDataFolder
Dim userDataFolder As String = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().Location))
WebView21.CreationProperties = New CoreWebView2CreationProperties() With {.UserDataFolder = userDataFolder}
LogMsg($"before setting source")
'CoreWebView2 will be implicitly initialized when
'Source property is set
'this doesn't wait for CoreWebView2 intialization to complete
'so any code that exists after this statement may execute
'prior to CoreWebView2 intialization completing
WebView21.Source = New Uri("http://127.0.0.1:9009/index.html")
LogMsg($"after setting source")
End Sub
Public Function GetWebView2Version() As String
Dim webView2Assembly As System.Reflection.Assembly = GetType(WebView2).Assembly
Return FileVersionInfo.GetVersionInfo(webView2Assembly.Location).ProductVersion
End Function
Private Sub LogMsg(ByVal msg As String)
msg = String.Format("{0} {1}", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff"), msg)
Debug.WriteLine(msg)
End Sub
Public Sub WebsiteNavigate(ByVal wv As WebView2, ByVal dest As String)
If Not wv Is Nothing AndAlso Not wv.CoreWebView2 Is Nothing Then
If Not String.IsNullOrEmpty(dest) Then
If Not dest = "about:blank" AndAlso
Not dest.StartsWith("edge://") AndAlso
Not dest.StartsWith("file://") AndAlso
Not dest.StartsWith("http://") AndAlso
Not dest.StartsWith("https://") AndAlso
Not System.Text.RegularExpressions.Regex.IsMatch(dest, "^([A-Z]|[a-z]):") Then
'URL must start with one of the specified strings
'if Not, pre-pend with "http://"
'Debug.Print("Prepending ""http://"" to URL.")
'set value
dest = "http://" & dest
End If
'option 1
wv.Source = New Uri(dest, UriKind.Absolute)
'option 2
'wv.CoreWebView2.Navigate(dest)
End If
End If
End Sub
Private Sub textBoxAddressBar_KeyDown(sender As Object, e As KeyEventArgs) Handles textBoxAddressBar.KeyDown
If e.KeyCode = Keys.Enter AndAlso WebView21 IsNot Nothing Then
WebsiteNavigate(WebView21, textBoxAddressBar.Text)
End If
End Sub
Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
WebsiteNavigate(WebView21, textBoxAddressBar.Text)
End Sub
Private Async Sub CoreWebView2_DOMContentLoaded(sender As Object, e As CoreWebView2DOMContentLoadedEventArgs)
LogMsg($"CoreWebView2_DOMContentLoaded")
Dim cwv2 As CoreWebView2 = DirectCast(sender, CoreWebView2)
Try
Dim result As String = Await cwv2.ExecuteScriptAsync("document.getElementById('m.first_name').textContent")
Debug.WriteLine($"result: {result}")
Catch ex As AggregateException
'ToDo: change code as desired
LogMsg($"Error: {ex.Message}")
If ex.InnerExceptions IsNot Nothing Then
For Each ex2 As Exception In ex.InnerExceptions
LogMsg($"{ex2.Message}")
Next
End If
LogMsg($"StackTrace: {ex.StackTrace}")
End Try
End Sub
Private Sub CoreWebView2_HistoryChanged(sender As Object, e As Object)
Dim cwv2 As CoreWebView2 = DirectCast(sender, CoreWebView2)
btnBack.Enabled = WebView21.CoreWebView2.CanGoBack
btnForward.Enabled = WebView21.CoreWebView2.CanGoForward
'update address bar
textBoxAddressBar.Text = cwv2.Source
textBoxAddressBar.Select(textBoxAddressBar.Text.Length, 0)
End Sub
Private Sub WebView21_CoreWebView2InitializationCompleted(sender As Object, e As CoreWebView2InitializationCompletedEventArgs) Handles WebView21.CoreWebView2InitializationCompleted
Dim wv As WebView2 = DirectCast(sender, WebView2)
LogMsg($"WebView21_CoreWebView2InitializationCompleted")
LogMsg($"UserDataFolder: {WebView21.CoreWebView2.Environment.UserDataFolder}")
LogMsg($"Edge Browser version: {WebView21.CoreWebView2.Environment.BrowserVersionString}")
'subscribe to events
AddHandler wv.CoreWebView2.DOMContentLoaded, AddressOf CoreWebView2_DOMContentLoaded
AddHandler wv.CoreWebView2.HistoryChanged, AddressOf CoreWebView2_HistoryChanged
End Sub
Private Sub WebView21_NavigationCompleted(sender As Object, e As CoreWebView2NavigationCompletedEventArgs) Handles WebView21.NavigationCompleted
LogMsg($"WebView21_NavigationCompleted")
End Sub
End Class
```
---
Here's the HTML that I used for testing:
```
<html>
<head>
</head>
<body>
<div id="view_m" style="display: block;">
<div id="form_small_left">
<table id="view_m_1" style="display: block;">
<tbody>
<tr>
<th>First name:</th>
<td id="m.first_name">Margeaet</td>
</tr>
<tr>
<th>Last name:</th>
<td id="m.last_name">Bill</td>
</tr>
</tbody>
</div>
</div>
</body>
</html>
```
---
- [WebView2](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2?view=webview2-dotnet-1.0.1343.22)- [CoreWebView2](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2?view=webview2-dotnet-1.0.1343.22)- [CoreWebView2Environment](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2environment?view=webview2-dotnet-1.0.1343.22)- [CreationProperties](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.winforms.webview2.creationproperties?view=webview2-dotnet-1.0.1343.22)- [EnsureCoreWebView2Async](https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2.ensurecorewebview2async?view=webview2-dotnet-1.0.1343.22)
| null | CC BY-SA 4.0 | null | 2022-09-25T17:33:08.783 | 2022-09-25T17:42:29.467 | 2022-09-25T17:42:29.467 | 10,024,425 | 10,024,425 | null |
73,847,177 | 2 | null | 73,846,284 | 0 | null | Here is a way.
First, take a look at the data.
- `P20`- `"Peor"``P3`
```
library(ggplot2)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
CIS_data_5$CIS.P3 <- sub("\\(NO LEER\\) ", "", CIS_data_5$CIS.P3)
labs <- c("Mejor", "Igual", "Peor", "N.S.", "N.C.")
CIS_data_5$CIS.P3 <- factor(CIS_data_5$CIS.P3, labels = labs)
P20 <- as.integer(as.character(CIS_data_5$CIS.P20))
range(P20)
#> [1] 16 93
anyNA(P20)
#> [1] FALSE
P20labs <- c("16-29", "30-44", "45-64", ">65", "N.C.")
cut_points <- c(16, 30, 45, 65, Inf)
i <- findInterval(P20, cut_points)
P20_fac <- P20labs[i]
P20_fac[is.na(P20)] <- P20labs[length(P20labs)]
P20_fac <- factor(P20_fac, levels = P20labs)
CIS_data_5$CIS.P20 <- P20
CIS_data_5$P20_range <- P20_fac
CIS_data_5 %>%
filter(CIS.P3 == "Peor") %>%
count(P20_range, CIS.P3)
#> P20_range CIS.P3 n
#> 1 45-64 Peor 2
#> 2 >65 Peor 1
```
[reprex v2.0.2](https://reprex.tidyverse.org)
---
## The plots
Below are two plots, a percentages plot and a counts one. The percentages are on the total table, not per each level of `P3`.
I plot the percentages bar plot using package `scales` to label the axis.
```
CIS_data_5 %>%
group_by(P20_range, CIS.P3) %>%
summarise(Percentage = n()/nrow(CIS_data_5), .groups = "drop") %>%
ggplot(aes(P20_range, Percentage)) +
geom_col() +
scale_y_continuous(labels = scales::percent) +
xlab("Current VS Past Individual Situation Based on Age") +
ylab("Percentage") +
coord_flip() +
facet_wrap(~ CIS.P3) +
theme_bw()
```

```
ggplot(CIS_data_5, aes(P20_range)) +
geom_bar() +
xlab("Current VS Past Individual Situation Based on Age") +
ylab("Count") +
coord_flip() +
facet_wrap(~ CIS.P3) +
theme_bw()
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-09-25T19:08:19.447 | 2022-09-25T19:45:45.260 | 2022-09-25T19:45:45.260 | 8,245,406 | 8,245,406 | null |
73,847,252 | 2 | null | 73,846,692 | 2 | null | Hum, I am running 17.3.4, and it works just fine.
I would consider doing a repair - see if that helps.
tools->get tools and features.
You get this:
[](https://i.stack.imgur.com/LjJAd.png)
(it actually opens two pages). So close the above form, and then you get this:
[](https://i.stack.imgur.com/LOqXX.png)
So, try the repair.
I suppose ensuring that previous (legacy) templates are also installed would help, but first try a repair.
# Edit: Installing legacy templates
Ok, in comments it was asked what additional install(s) is one to select.
From VS menu tools->get tools and features.
You get/see this:
In above, expand the "ASP.NET and web development" on the right
this:
[](https://i.stack.imgur.com/XI45f.png)
And then select these:
(can't remember which exactly from above gets you everything, but given doing legacy development, good idea to select all that I pointed out).
[](https://i.stack.imgur.com/PlpfR.png)
| null | CC BY-SA 4.0 | null | 2022-09-25T19:19:28.873 | 2022-10-29T15:30:06.710 | 2022-10-29T15:30:06.710 | 10,527 | 10,527 | null |
73,847,328 | 2 | null | 73,847,166 | 2 | null | Try studying the patterns here:
```
fun1 <- function(x){
if (x < 0) {
x^2+2*x+3
} else if (x < 2) {
x + 3
} else {
# Your turn
}
}
```
| null | CC BY-SA 4.0 | null | 2022-09-25T19:31:30.367 | 2022-09-25T19:31:30.367 | null | null | 4,552,295 | null |
73,847,335 | 2 | null | 73,847,308 | 1 | null | The column `A` doesn't come from split but it's the index of your actual dataframe by default. You can change that by setting `index=False` in `df.to_csv`:
```
df.to_csv('{PATH}.csv', index=False)
```
| null | CC BY-SA 4.0 | null | 2022-09-25T19:33:15.887 | 2022-09-25T19:33:15.887 | null | null | 19,255,749 | null |
73,847,351 | 2 | null | 73,847,166 | 3 | null | Ideally your function should be able to take vectorized input, in which case you should use `ifelse` or `case_when`.
For example:
```
f <- function(x) {
ifelse(x < 0, x^2 + 2*x + 3,
ifelse(x >= 2, x^2 + 4 * x - 7,
x + 3))
}
```
Or
```
f <- function(x) {
dplyr::case_when(x < 0 ~ x^2 + 2*x + 3,
x > 2 ~ x^2 + 4 * x - 7,
TRUE ~ x + 3)
}
```
both of which produce the same output. We can see what the function looks like by doing:
```
plot(f, xlim = c(-5, 5))
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-09-25T19:35:21.417 | 2022-09-25T19:45:34.483 | 2022-09-25T19:45:34.483 | 12,500,315 | 12,500,315 | null |
73,847,628 | 2 | null | 71,663,138 | 1 | null | If your database has relationships, you can query related tables too.
```
final res = await supabase
.from('countries')
.select('''
name,
cities (
name
)
''')
.execute();
```
This is directly from the docs: [Supabase Dart Docs](https://supabase.com/docs/reference/dart/select)
| null | CC BY-SA 4.0 | null | 2022-09-25T20:24:13.713 | 2022-09-25T20:24:13.713 | null | null | 10,123,373 | null |
73,847,672 | 2 | null | 20,114,366 | 0 | null | I have seen all the answers but none solves the issue when backspace is clicked,
to tackle that here is my solution,
HTML:
```
<input class="input" type="text" id="input-1" maxlength=1 data-id="1" />
<input class="input" type="text" id="input-2" maxlength=1 data-id="2" />
<input class="input" type="text" id="input-3" maxlength=1 data-id="3" />
<input class="input" type="text" id="input-4" maxlength=1 data-id="4" />
```
CSS:
```
.input {
padding: 0.8rem;
border: 1px solid #ddd;
width: 50px;
height: 50px;
text-align: center;
font-size: 30px;
margin-left: 1rem;
}
```
Javascript:
```
const loginInputs = document.querySelectorAll(".input");
loginInputs.forEach((el) => {
el.addEventListener("keyup", (e) => {
const id = +e.target.dataset.id;
if (e.key === "Backspace") {
if (id === 1) return;
const prevEl = document.getElementById(`input-${id - 1}`);
prevEl.focus();
} else {
if (id === 4) return;
const nextEl = document.getElementById(`input-${id + 1}`);
nextEl.focus();
}
});
});
```
| null | CC BY-SA 4.0 | null | 2022-09-25T20:31:59.163 | 2022-09-25T20:31:59.163 | null | null | 17,948,008 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.