Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
β | ParentId
int64 1.68k
75.6M
β | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
β | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
β | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
β | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
β | LastEditorUserId
int64 -1
21.3M
β | OwnerUserId
int64 1
21.3M
β | Tags
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
75,106,771 | 2 | null | 75,095,558 | 0 | null | A more complete description of what Yong Shun is saying:
Right now, your component, as a whole, has a single `quantity` variable.
Your template, in its entirety, is referencing this one variable.
However, your template is rendering multiple rows (`*ngFor="let item of articulos"`).
Each of those rows (`item`) have their OWN quantity value (`item.cantidad`), but each of those rows point to exactly the same, single `quantity` variable.
So if you press `+` on the first row, `quantity` becomes 1. If you press `+` on the row, `quantity` becomes 2.
Many rows ---> one `quantity` variable.
You need one row -> one quantity variable.
You can either :
1. Extend your item objects with an extra property that you initialise and then use in the template, e.g.
```
private onDataReceived(articulos: any[]): void {
articulos.forEach((item: any) => {
item.variableQuantity = item.cantidad;
});
this.articulos = articulos;
}
```
(Also, it's a button, why not use a `button` element?)
```
<button (click)="item.variableQuantity+=1">+</button>
<input type="text" [value]="item.variableQuantity">
<button (click)="item.variableQuantity-=1">-</button>
```
OR
You keep track of the quantities separately (still needs to be initialised):
```
public quantities = {};
private onDataReceived(articulos: any[]): void {
articulos.forEach((item: any) => {
quantities[item.articulo] = item.cantidad;
});
this.articulos = articulos;
}
```
```
<button (click)="quantities[item.articulo]+=1">+</button>
<input type="text" [value]="quantities[item.articulo]">
<button (click)="quantities[item.articulo]-=1">-</button>
```
| null | CC BY-SA 4.0 | null | 2023-01-13T08:44:46.627 | 2023-01-13T08:44:46.627 | null | null | 1,585,218 | null |
75,106,804 | 2 | null | 29,642,871 | -1 | null | ```
npm i iran-province-city-selector
npm i jalali-day-month-years-selector
```
| null | CC BY-SA 4.0 | null | 2023-01-13T08:48:11.450 | 2023-01-13T17:19:36.253 | 2023-01-13T17:19:36.253 | 7,325,599 | 19,577,149 | null |
75,106,861 | 2 | null | 75,106,095 | 0 | null |
After your clarification and looking at what's actually in your SQL code. I'm guessing you are looking for a solution to what's called a gaps and islands problem. That is, you want to identify the "islands" of activity and sum the amount for each iteration or island. Taking your example you can first identify the start of a new session (or "gap") and then use that to create a unique iteration ("island") identifier for each user. You can then use that identifier to perform a `SUM()`.
```
gaps as (
select
name,
date,
amount,
if(date_diff(date, lag(date,1) over(partition by name order by date), DAY) >= 10, 1, 0) new_iteration
from base
),
islands as (
select
*,
1 + sum(new_iteration) over(partition by name order by date) iteration_id
from gaps
)
select
*,
sum(amount) over(partition by name, iteration_id) iteration_amount
from islands
```
---
Sounds like you just need a `RANK()` to count the iterations in your window functions. Depending on your need you can then sum cumulative or total amounts in a similar window function. Something like this:
```
select
name
,date
,rank() over (partition by name order by date) as iteration
,sum(amount) over (partition by name order by date) as cumulative_amount
,sum(amount) over (partition by name) as total_amount
,amount
from base
```
| null | CC BY-SA 4.0 | null | 2023-01-13T08:53:26.027 | 2023-01-13T12:45:25.660 | 2023-01-13T12:45:25.660 | 5,761,491 | 5,761,491 | null |
75,106,939 | 2 | null | 28,426,034 | 0 | null | A quick hack might also be possible, start a CMD and type:
```
cd \
subst F: .
```
then try installing again.
| null | CC BY-SA 4.0 | null | 2023-01-13T09:00:46.603 | 2023-01-13T09:00:46.603 | null | null | 233,402 | null |
75,106,958 | 2 | null | 75,106,799 | 0 | null | The following sample query will list your 3 types of data into a single result set.
var allResults = resultSet1.Concat(resultSet2);
For the return type create a class which will be the parent class for all your products (Bag,Shirt,Shoes) Which will help you to return data in a single Generic data.
If you use any non-generic list to send the data like hashtable or Arraylist then then there will be no issue.
In my way I will suggest to use generic data list as it will help you fetch data in better time complexity.
| null | CC BY-SA 4.0 | null | 2023-01-13T09:02:51.687 | 2023-01-13T09:02:51.687 | null | null | 11,946,180 | null |
75,106,973 | 2 | null | 75,106,799 | 0 | null | In this case you may need to define additional indirect base class with these 4 parameters. Than you can create Collection of this base class, and concatinate all 3 tables into.
```
public class BaseEntity
{
public string Name {get;set;}
}
public class Shoes : BaseEntity
{
}
...
```
```
public IEnumerable<BaseEntity> GetAllTables()
{
var shirts = await _dbContext.Shirt.ToListAsync();
var shoes = await _dbContext.Shoes.ToListAsync();
var bags = await _dbContext.Bags.ToListAsync();
return shirts.Concat(shoes).Concat(bags);
}
```
Similar example but witout casting to base class is shown in Enumerable.Concat documentation: [https://learn.microsoft.com/pl-pl/dotnet/api/system.linq.enumerable.concat?view=net-7.0](https://learn.microsoft.com/pl-pl/dotnet/api/system.linq.enumerable.concat?view=net-7.0)
| null | CC BY-SA 4.0 | null | 2023-01-13T09:04:13.370 | 2023-01-13T09:04:13.370 | null | null | 19,929,755 | null |
75,107,176 | 2 | null | 75,106,599 | 1 | null | [Troubleshooting discrepancies between Playground vs. the OpenAI API:](https://help.openai.com/en/articles/6643200-why-am-i-getting-different-completions-on-playground-vs-the-api)
1. Set the temperature parameter to 0. If the temperature parameter is set above 0, the model will likely produce different results each time - this is expected behavior.
2. Check that your prompt is exactly the same. Even slight differences, such as an extra space or newline character, can lead to different outputs.
3. Ensure you're using the same parameters in both cases. For example, the model parameter set to davinci and text-davinci-002 will produce different completions even with the same prompt, because text-davinci-002 is a newer and more capable instruction-following model.
4. Try to change the model from text-ada-001 to text-davinci-003 because it's the most capable GPT-3 model. It might be model related.
| null | CC BY-SA 4.0 | null | 2023-01-13T09:25:10.270 | 2023-02-15T12:08:20.307 | 2023-02-15T12:08:20.307 | 10,347,145 | 10,347,145 | null |
75,107,393 | 2 | null | 74,976,255 | 0 | null | From your description, after re-install VS the issue still exists, so the issue should come from the project level cache/settings instead of VS environment file lacking.
You can try to create a new project and writing your code as the simplest like this:
```
using System;
using System.Collections.Generic;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
List<Upgrade> upgrades = new List<Upgrade>();
var xxx = upgrades.cont;
}
}
class Upgrade
{
}
}
```
If the issue disappears in the new project, I suggest you delete '.vs' directory, '.vs' directory stores settings and caches, it will be created when you open the solution at the first time. This directory is under the same folder level of .sln file. After deleting it, when you open the solution next time, this directory will be re-generated. Intellisense caches are in this directory, that's why we suggest you to re-generate it.
If the issue doesn't disappear in the new project, please check your VS version, if it is not the lastest, please update it to the latest version.
| null | CC BY-SA 4.0 | null | 2023-01-13T09:44:24.470 | 2023-01-13T09:44:24.470 | null | null | 6,261,890 | null |
75,107,469 | 2 | null | 75,106,799 | 1 | null | > I have 3 table in Sqlsever. Each table has 4 column with same name,
same datatype. And I want to get data from 4 column "Id, Name,
Quantity, IdCategory" from 3 table into 1 list, I use .NET Core 6 Mvc - code first.
Well, lot of way around to handle this kind of scenario. Most easy and convenient way I would prefer to use [View model](https://learn.microsoft.com/en-us/aspnet/core/mvc/views/overview?view=aspnetcore-6.0#strongly-typed-data-viewmodel) or using [Linq query](https://learn.microsoft.com/en-us/dotnet/standard/linq/project-anonymous-type#example-project-an-anonymous-type-by-creating-objects-in-the-select-clause).
Lets assume you have below Models:
Models:
```
public class Bags
{
public int Id { get; set; }
public string Name { get; set; }
public int Quantity { get; set; }
public string Category { get; set; }
}
public class Shirts
{
public int Id { get; set; }
public string Name { get; set; }
public int Quantity { get; set; }
public string Category { get; set; }
}
public class Shoes
{
public int Id { get; set; }
public string Name { get; set; }
public int Quantity { get; set; }
public string Category { get; set; }
}
```
Seeds In Models:
```
List<Bags> listBags = new List<Bags>();
listBags.Add(new Bags() { Id = 101, Name = "Bag A", Quantity =10, Category = "Cat-A"});
listBags.Add(new Bags() { Id = 102, Name = "Bag B", Quantity =15, Category = "Cat-A"});
listBags.Add(new Bags() { Id = 103, Name = "Bag C", Quantity =20, Category = "Cat-A"});
List<Shirts> listShirts = new List<Shirts>();
listShirts.Add(new Shirts() { Id = 101, Name = "Shirt A", Quantity = 10, Category = "Cat-B" });
listShirts.Add(new Shirts() { Id = 102, Name = "Shirt B", Quantity = 15, Category = "Cat-B" });
listShirts.Add(new Shirts() { Id = 103, Name = "Shirt C", Quantity = 20, Category = "Cat-B" });
List<Shoes> listShoes = new List<Shoes>();
listShoes.Add(new Shoes() { Id = 101, Name = "Shirt A", Quantity = 10, Category = "Cat-S" });
listShoes.Add(new Shoes() { Id = 102, Name = "Shirt B", Quantity = 15, Category = "Cat-S" });
listShoes.Add(new Shoes() { Id = 103, Name = "Shirt C", Quantity = 20, Category = "Cat-S" });
```
```
public class AllViewModel
{
public List<Bags> Bags { get; set; }
public List<Shirts> Shirts { get; set; }
public List<Shoes> Shoes { get; set; }
}
```
Query Using ViewModel:
```
var allTableUsingViewModel = new AllViewModel();
allTableUsingViewModel.Bags = listBags;
allTableUsingViewModel.Shirts = listShirts;
allTableUsingViewModel.Shoes = listShoes;
```
Output Using ViewModel:
[](https://i.stack.imgur.com/9s4rt.png)
[](https://i.stack.imgur.com/olZ80.gif)
Query Using Linq Annonymous Type:
```
var AllTableListUsingLinq = from a in listBags
join b in listShirts on a.Id equals b.Id
join c in listShoes on b.Id equals c.Id
select new
{
FromBagsID = a.Id,
FromBagsName = a.Name,
FromBagsQuantity = a.Quantity,
FromBagsCategory = a.Category,
FromShirtsID = b.Id,
FromShirtsName = b.Name,
FromShirtsQuantity = b.Quantity,
FromShirtsCategory = b.Category,
FromShoesID = c.Id,
FromShoesName = c.Name,
FromShoesQuantity = c.Quantity,
FromShoesCategory = c.Category
};
```
Output Using Linq Annonymous Type:
[](https://i.stack.imgur.com/w9tT2.gif)
Full Controller:
```
[HttpGet("GetFrom3Tables")]
public IActionResult GetFrom3Tables()
{
List<Bags> listBags = new List<Bags>();
listBags.Add(new Bags() { Id = 101, Name = "Bag A", Quantity =10, Category = "Cat-A"});
listBags.Add(new Bags() { Id = 102, Name = "Bag B", Quantity =15, Category = "Cat-A"});
listBags.Add(new Bags() { Id = 103, Name = "Bag C", Quantity =20, Category = "Cat-A"});
List<Shirts> listShirts = new List<Shirts>();
listShirts.Add(new Shirts() { Id = 101, Name = "Shirt A", Quantity = 10, Category = "Cat-B" });
listShirts.Add(new Shirts() { Id = 102, Name = "Shirt B", Quantity = 15, Category = "Cat-B" });
listShirts.Add(new Shirts() { Id = 103, Name = "Shirt C", Quantity = 20, Category = "Cat-B" });
List<Shoes> listShoes = new List<Shoes>();
listShoes.Add(new Shoes() { Id = 101, Name = "Shirt A", Quantity = 10, Category = "Cat-S" });
listShoes.Add(new Shoes() { Id = 102, Name = "Shirt B", Quantity = 15, Category = "Cat-S" });
listShoes.Add(new Shoes() { Id = 103, Name = "Shirt C", Quantity = 20, Category = "Cat-S" });
//Way: 1 Linq Query
var AllTableListUsingLinq = from a in listBags
join b in listShirts on a.Id equals b.Id
join c in listShoes on b.Id equals c.Id
select new
{
FromBagsID = a.Id,
FromBagsName = a.Name,
FromBagsQuantity = a.Quantity,
FromBagsCategory = a.Category,
FromShirtsID = b.Id,
FromShirtsName = b.Name,
FromShirtsQuantity = b.Quantity,
FromShirtsCategory = b.Category,
FromShoesID = c.Id,
FromShoesName = c.Name,
FromShoesQuantity = c.Quantity,
FromShoesCategory = c.Category
};
//Way: 2 : ViewModel
var allTableUsingViewModel = new AllViewModel();
allTableUsingViewModel.Bags = listBags;
allTableUsingViewModel.Shirts = listShirts;
allTableUsingViewModel.Shoes = listShoes;
return Ok(AllTableListUsingLinq);
}
```
If you need more information you could check our official document for [View Model](https://learn.microsoft.com/en-us/aspnet/core/mvc/views/overview?view=aspnetcore-6.0#strongly-typed-data-viewmodel) and [Linq Projction](https://learn.microsoft.com/en-us/dotnet/standard/linq/project-anonymous-type#example-project-an-anonymous-type-by-creating-objects-in-the-select-clause) here
| null | CC BY-SA 4.0 | null | 2023-01-13T09:51:37.470 | 2023-01-13T09:51:37.470 | null | null | 9,663,070 | null |
75,107,518 | 2 | null | 75,101,192 | 0 | null | Not sure me too about the request but I'll try to answer, otherwise please provide a clearer example of the result you want to obtain...
```
backdrop-filter: blur(2px);
```
Your CSS will look like this:
```
<style>
div > div {
top: 0;
bottom: 0;
left: 0;
right: 0;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
/* comment blur filter, in this case not necessary*/
/* filter: blur(13px); */
opacity: 30%;
mask-image: linear-gradient(to top, transparent, black);
/* add filter to blur the objects behind the background */
backdrop-filter: blur(2px);
}
</style>
```
: to modulate the glass effect mantain the backdrop-filter at low values and change the opacity of the object you are applying the filter.
Here is a live example of the effect.
The codepen here:
[https://codepen.io/gesteves/pen/PwRPZa](https://codepen.io/gesteves/pen/PwRPZa)
Find the full explanation here, containing differences and usage of both blur filter and backdrop-filter and how to obtain the glass effect:
[https://css-tricks.com/almanac/properties/b/backdrop-filter/](https://css-tricks.com/almanac/properties/b/backdrop-filter/)
| null | CC BY-SA 4.0 | null | 2023-01-13T09:54:49.477 | 2023-01-13T10:05:56.943 | 2023-01-13T10:05:56.943 | 13,797,254 | 13,797,254 | null |
75,107,537 | 2 | null | 75,106,956 | 2 | null | You can do something like this:
```
WITH months AS
(
SELECT 1 AS MONTH
UNION ALL
SELECT MONTH + 1
FROM months
WHERE MONTH < 12
)
SELECT CAST(DATENAME(month, CONCAT("2022-" , months.MONTH, "-01")) AS CHAR(3)) AS 'MONTH' , DAY(EOMONTH(CONCAT("2022-" , months.MONTH, "-01"))) as DAY FROM months
```
Output:
| MONTH | DAY |
| ----- | --- |
| Jan | 31 |
| Feb | 28 |
| Mar | 31 |
| Apr | 30 |
| May | 31 |
| Jun | 30 |
| Jul | 31 |
| Aug | 31 |
| Sep | 30 |
| Oct | 31 |
| Nov | 30 |
| Dec | 31 |
Create a row generator from 1 to 12 using [WITH](https://learn.microsoft.com/en-us/sql/t-sql/queries/with-common-table-expression-transact-sql?view=sql-server-ver16) ,after that is just formating the output
You can view the result here: [https://onecompiler.com/sqlserver/3yurzpsnm](https://onecompiler.com/sqlserver/3yurzpsnm)
| null | CC BY-SA 4.0 | null | 2023-01-13T09:56:22.363 | 2023-01-13T10:02:40.407 | 2023-01-13T10:02:40.407 | 3,768,239 | 3,768,239 | null |
75,107,613 | 2 | null | 75,106,500 | 0 | null | I don't think the solution I'm telling you is a standard solution, but here it is:
With this code, I have a dataframe similar to your dataframe:
```
import pandas as pd
data = {
0 : ['RT:123425','VB:543557','JK:34542463','RT:365356'],
1 : ['VB:331245','PL:783557','VB:12342463','JK:965356'],
3 : ['PL:122345','JK:543557','PL:56542463','VB:465356'],
4 : ['PL:222345','RT:143557','JK:99542463','YR:995356']
}
df = pd.DataFrame(data)
print(df)
```
Output:
```
0 1 3 4
0 RT:123425 VB:331245 PL:122345 PL:222345
1 VB:543557 PL:783557 JK:543557 RT:143557
2 JK:34542463 VB:12342463 PL:56542463 JK:99542463
3 RT:365356 JK:965356 VB:465356 YR:995356
```
I create an empty dataframe that I want to fill later with appropriate values.
```
mycolumns = []
for index, row in df.iterrows():
for i in row:
if i.split(':')[0] not in mycolumns:
mycolumns.append(i.split(':')[0])
df1 = pd.DataFrame(columns = mycolumns, index = range(df.shape[0]))
print(df1)
```
Output:
```
RT VB PL JK YR
0 NaN NaN NaN NaN NaN
1 NaN NaN NaN NaN NaN
2 NaN NaN NaN NaN NaN
3 NaN NaN NaN NaN NaN
```
Then I replace every cell that should not be NaN with an empty list:
```
for index, row in df.iterrows():
for i in row:
df1[str(i.split(':')[0])][index] = []
print(df1)
```
Output:
```
RT VB PL JK YR
0 [] [] [] NaN NaN
1 [] [] [] [] NaN
2 NaN [] [] [] NaN
3 [] [] NaN [] []
```
I fill the dataframe with the following code:
```
for index, row in df.iterrows():
for i in row:
(df1[str(i.split(':')[0])][index]).append((i.split(':')[1]))
print(df1)
```
Output:
```
RT VB PL JK YR
0 [123425] [331245] [122345, 222345] NaN NaN
1 [143557] [543557] [783557] [543557] NaN
2 NaN [12342463] [56542463] [34542463, 99542463] NaN
3 [365356] [465356] NaN [965356] [995356]
```
| null | CC BY-SA 4.0 | null | 2023-01-13T10:03:39.513 | 2023-01-13T10:12:15.190 | 2023-01-13T10:12:15.190 | 20,986,801 | 20,986,801 | null |
75,108,442 | 2 | null | 46,966,413 | 0 | null | Give a classname to the textfield.
```
<TextField
className={styles.search_bar}
autoComplete={"off"}
InputProps={{
endAdornment: (
<Box className={'search_icon_container'} component={"span"}>
<IconButton>
<CiSearch fontSize={icon_default_size} />
</IconButton>
</Box>
),
}}
size={"small"}
placeholder="Search"
/>
```
Do this in your CSS file.
```
.search_bar div{
border-radius: 25px;
width: 45vw;
padding-right: 0;
}
```
It worked for me. :)
[Output](https://i.stack.imgur.com/aQWFa.png)
| null | CC BY-SA 4.0 | null | 2023-01-13T11:11:50.467 | 2023-01-13T11:11:50.467 | null | null | 20,999,445 | null |
75,108,761 | 2 | null | 8,946,307 | 0 | null | Just a quick remark: If you want to decode a path segment, you can use UriUtils (spring framework):
```
@Test
public void decodeUriPathSegment() {
String pathSegment = "some_text%2B"; // encoded path segment
String decodedText = UriUtils.decode(pathSegment, "UTF-8");
System.out.println(decodedText);
assertEquals("some_text+", decodedText);
}
```
Uri path segments are different from HTML escape chars (see [list](https://mateam.net/html-escape-characters/)). Here is an example:
```
@Test
public void decodeHTMLEscape() {
String someString = "some_text+";
String stringJsoup = org.jsoup.parser.Parser.unescapeEntities(someString, false);
String stringApacheCommons = StringEscapeUtils.unescapeHtml4(someString);
String stringSpring = htmlUnescape(someString);
assertEquals("some_text+", stringJsoup);
assertEquals("some_text+", stringApacheCommons);
assertEquals("some_text+", stringSpring);
}
```
| null | CC BY-SA 4.0 | null | 2023-01-13T11:45:08.307 | 2023-01-13T11:45:08.307 | null | null | 6,275,236 | null |
75,109,129 | 2 | null | 75,108,413 | 0 | null | So it's just a case of adding extra things into two strings, separated by newlines. So just loop over the products array to create two strings, one for the name and one for the quantity, and put those into variables. Then, you can just use those variables in the right places in your Fields array.
Heres the general idea:
```
$names = "";
$quantities = "";
foreach ($products as $product){
$names .= ($names != "" ? "\n" : "").$product["name"];
$quantities .= ($quantities != "" ? "\n" : "").$products_in_cart[$product['id']];
}
```
Then in the bit where you build the array:
```
...
"fields" => [
[
"name" => "Ordered Products",
"value" => $names,
"inline" => true
],
[
"name" => "Quantity",
"value" => $quantities,
"inline" => true
],
...
```
| null | CC BY-SA 4.0 | null | 2023-01-13T12:19:41.587 | 2023-01-13T12:19:41.587 | null | null | 5,947,043 | null |
75,109,273 | 2 | null | 75,109,172 | 1 | null | add overflow and change height of #popup-window
update style
```
#popup-window-inner {
margin: 5px;
max-height: 100%;
height: 76%;
position: relative;
overflow: hidden;
}
```
| null | CC BY-SA 4.0 | null | 2023-01-13T12:34:54.880 | 2023-01-13T12:34:54.880 | null | null | 6,391,256 | null |
75,109,258 | 2 | null | 75,109,172 | 1 | null | I would make your popup window flex with a direction of column, then you can make the inner flex grow (to take the remaining height of the popup after the title).
If you then make the inner relative, you can absolutely position your scroll div to fill the inner and then your overflow should work:
```
html {
height: 100vh;
}
#popup-window {
position: absolute;
height: 50%;
width: 50%;
background-color: #50ed77;
border: 1px solid #3E3B3B;
border-radius: 5px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 800px;
z-index: 2;
-webkit-box-shadow: 2px 2px #000;
box-shadow: 2px 2px #000;
display:flex; /* make this flex with a direction of column */
flex-direction:column;
}
#popup-window-titlebar {
background-color: #21522d;
color: white;
padding: 10px;
font-weight: bold;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
#popup-window-inner {
margin: 5px;
flex-grow: 1; /* make this grow to fill remaining space and also relative */
position:relative;
}
#popup-window-list {
position:absolute; /* absolutely position this to fill inner - 5px below replaces your margin */
top:5px;
left:5px;
right:5px;
bottom:5px;
padding: 10px;
overflow-y: auto;
}
.window-close-btn {
float: right;
color: #fff;
font-weight: bold;
transition-duration: .5s;
}
.window-close-btn:hover {
cursor: pointer;
color: #ff115c;
}
```
```
<div id="popup-window">
<div id="popup-window-titlebar">
<b>Funny Title</b>
<div class="window-close-btn">
X
</div>
</div>
<div id="popup-window-inner">
<div id="popup-window-list">
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
</div>
</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2023-01-13T12:33:41.353 | 2023-01-13T12:33:41.353 | null | null | 1,790,982 | null |
75,109,328 | 2 | null | 75,109,232 | 0 | null | Based on the error image, I believe your issue is coming from here:
```
List<DocumentSnapshot?>? items2 = snap2?.docs; // List of Documents
DocumentSnapshot? item2 = items2?[0];
```
You are assuming that there will always be a document in the list. You need to consider an empty list scenario.
| null | CC BY-SA 4.0 | null | 2023-01-13T12:39:07.797 | 2023-01-13T12:39:07.797 | null | null | 19,801,869 | null |
75,109,308 | 2 | null | 75,109,172 | 1 | null | ```
html {
height: 100vh;
}
#popup-window {
position: absolute;
height: 50%;
width: 50%;
background-color: #50ed77;
border: 1px solid #3E3B3B;
border-radius: 5px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 800px;
z-index: 2;
-webkit-box-shadow: 2px 2px #000;
box-shadow: 2px 2px #000;
overflow-y: auto;
}
#popup-window-titlebar {
background-color: #21522d;
color: white;
padding: 10px;
font-weight: bold;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
position: sticky;
top: 0
}
#popup-window-inner {
margin: 5px;
max-height: 100%;
height: 100%;
}
#popup-window-list {
margin: 5px;
padding: 10px;
height: 100%;
max-width: 100%;
max-height: 100%;
}
.window-close-btn {
float: right;
color: #fff;
font-weight: bold;
transition-duration: .5s;
}
.window-close-btn:hover {
cursor: pointer;
color: #ff115c;
}
```
```
<div id="popup-window">
<div id="popup-window-titlebar">
<b>Funny Title</b>
<div class="window-close-btn">
X
</div>
</div>
<div id="popup-window-inner">
<div id="popup-window-list">
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
<div>Entry</div>
</div>
</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2023-01-13T12:37:34.693 | 2023-01-13T12:37:34.693 | null | null | 13,829,821 | null |
75,109,390 | 2 | null | 75,107,566 | 0 | null | This list comprehension takes significant amount of time:
```
x_list = [(i, j, k, l, m) for (i, j, k) in model.IJK
for (jj, kk, l) in model.JKL if (jj == j) and (kk == k)
for (kkk, ll, m) in model.KLM if (kkk == k) and (ll == l)]
```
It can be improved if you takes dicts instead of sets/lists.
```
IJK = [tuple(x) for x in ijk.loc[ijk['value'] == 1]
[['i', 'j', 'k']].to_dict('split')['data']]
JKL = defaultdict(list)
for x in jkl.loc[jkl['value'] == 1][['j', 'k', 'l']].to_dict('split')['data']:
JKL[tuple(x[:2])].append(x[2])
KLM = defaultdict(list)
for x in klm.loc[klm['value'] == 1][['k', 'l', 'm']].to_dict('split')['data']:
KLM[tuple(x[:2])].append(x[2])
```
and build `x_list` as
```
x_list = [(i, j, k, l, m) for (i, j, k) in IJK
for l in JKL[j, k]
for m in KLM[k, l]]
```
Same with
```
def ei_rule(model, i):
lhs = [model.x[k] for k in model.x_list if k[0] == i]
if len(lhs) == 0:
return pyo.Constraint.Skip
else:
return sum(lhs) >= 0
```
It seesm to be faster to generate such thing manually.
```
x_dict = defaultdict(list)
for x in x_list:
x_dict[x[0]].append(x)
model.ei = pyo.ConstraintList()
for x_values in x_dict.values():
model.ei.add(sum(model.x[k] for k in x_values) >= 0)
```
Also, why do not you skip `len(lhs) == 1`? You are already have these constraints. This would give additional speed up.
With all tricks above I got about 4x speed up. I did not check with larger data. It can be worse or better. But I believe that you need to compare with solving time. And start to worry if modeling is slower than solving time.
| null | CC BY-SA 4.0 | null | 2023-01-13T12:43:30.743 | 2023-01-13T12:43:30.743 | null | null | 3,219,777 | null |
75,109,406 | 2 | null | 75,109,232 | 0 | null | why can you use `combinestream` using [rxdart](https://pub.dev/packages/rxdart)
```
StreamBuilder(
stream: CombineLatestStream.list([
stream0,
stream1,
]),
builder: (context, snapshot) {
final data0 = snapshot.data[0];
final data1 = snapshot.data[1];
})
```
| null | CC BY-SA 4.0 | null | 2023-01-13T12:44:44.587 | 2023-01-13T12:44:44.587 | null | null | 15,708,401 | null |
75,109,541 | 2 | null | 75,109,456 | 0 | null | This error message...
```
PS E:*my path*1> & E:/Python/python.exe e:*my path*/1/main.py
e:*my path*1\main.py:32: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
```
...indicates that the argument [executable_path has been deprecated](https://stackoverflow.com/a/70099102/7429447), instead you need to [pass in a Service object](https://stackoverflow.com/a/69918489/7429447)
---
## Solution
Effectively you need to replace:
```
self.browser = webdriver.Chrome(ChromeDriverManager().install(), options=options)
```
with:
```
from selenium.webdriver.chrome.service import Service
self.browser = webdriver.Chrome(service=ChromeDriverManager().install(), options=options)
```
| null | CC BY-SA 4.0 | null | 2023-01-13T12:57:30.180 | 2023-01-13T12:57:30.180 | null | null | 7,429,447 | null |
75,109,613 | 2 | null | 75,109,557 | 1 | null | I see that `$request->getPost()` has a signature of `mixed|null`.
And `password_verify` a a signature of `string`.
You can cast it to string and the warning will dissapear.
```
$password = (string) $this->request->getPost('password')
```
| null | CC BY-SA 4.0 | null | 2023-01-13T13:05:02.417 | 2023-01-13T13:05:02.417 | null | null | 4,289,649 | null |
75,109,771 | 2 | null | 75,108,629 | 0 | null |
### Herer i have change your upload_to = profile_pictures
```
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete = models.CASCADE, primary_key=True)
picture = models.ImageField(blank = True, null = True, upload_to = profile_pictures)
whatsapp = models.PositiveIntegerField(blank = True, null = True)
```
### I have also change settings as given below
```
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
```
### In your main project app you can add urlpatterns as given below if you have to
```
urlpatterns = urlpatterns + static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
```
| null | CC BY-SA 4.0 | null | 2023-01-13T13:20:12.160 | 2023-01-13T13:20:12.160 | null | null | 20,297,992 | null |
75,110,062 | 2 | null | 36,930,310 | 1 | null | It is working with gollum 5.3.0 when gollum is started with command line option --allow-uploads (in case you use gollum from within a docker container, you have to put it after the container image so that it is interpreted as parameter for gollum).
After this, you can drag and drop the image on the edit field of gollum.
No reason to copy the image files manually to your repo. The repo should be managed by git alone.
Details on command line options can be found here: [https://github.com/gollum/gollum#configuration](https://github.com/gollum/gollum#configuration)
| null | CC BY-SA 4.0 | null | 2023-01-13T13:47:04.250 | 2023-01-13T13:47:04.250 | null | null | 7,734,839 | null |
75,110,103 | 2 | null | 72,613,038 | 0 | null | It uses Typescript and your error looks like you don't have TypeScript installed.
| null | CC BY-SA 4.0 | null | 2023-01-13T13:50:21.323 | 2023-01-13T13:50:21.323 | null | null | 1,809,053 | null |
75,110,888 | 2 | null | 72,006,995 | 1 | null | The error says "duplicate chunk label". All chunks must have unique names so try putting another label to the duplicate chunk :)
| null | CC BY-SA 4.0 | null | 2023-01-13T15:00:50.263 | 2023-01-13T15:00:50.263 | null | null | 21,001,149 | null |
75,110,925 | 2 | null | 75,109,410 | 0 | null | I can't see without a for loop in some place, but you can use `itertools.groupby`:
[](https://i.stack.imgur.com/lH8Lr.png)
```
from itertools import groupby
import numpy as np
# Generate data
np.random.seed(34)
data = np.random.choice([0, 1], p=[0.8, 0.2], size=(32, 32))
# Rotate the array because we want to search from "bottom"
# and we will use the fact that np.where sort indices on axis 0
# but axis 0 is the one on the "left"
result = data.copy()
result = np.rot90(result, k=-1)
# Get indices of obstacle
idxs_true = np.where(result == 1)
# Get only one pair for each value column
idxs = [next(grp) for _, grp in groupby(zip(*idxs_true), key=lambda x: x[0])]
idxs = tuple(zip(*idxs))
# Hihglight them
result[idxs] = 2
# Come back to orignal orientation
result = np.rot90(result, k=1)
# Plot
fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.imshow(data, cmap="gray")
ax2.imshow(result, cmap="gray")
plt.show()
```
| null | CC BY-SA 4.0 | null | 2023-01-13T15:04:41.107 | 2023-01-13T15:04:41.107 | null | null | 13,636,407 | null |
75,110,982 | 2 | null | 75,097,607 | 0 | null | When I attempted to use your code, it didn't work. However, based on the current type of graph and graph options you've called, this should work.
The legend title
I suggest you run this line and ensure it returns `Subgroup` before using it to change anything.
```
# assign the plot to an object
plt <- plot(opt_cut_b_cycle.type)
# printing this should return "Subgroup" - current legend title
plt$grobs[[2]]$grobs[[1]]$grobs[[2]][[4]][[1]][[6]][[1]][[1]]
# change the legend title
plt$grobs[[2]]$grobs[[1]]$grobs[[2]][[4]][[1]][[6]][[1]][[1]] <- "Oocyte"
```
Legend entries
The easiest method to change the legend entries is probably to rename the factors in your data. Alternatively, you can change these labels the same way you changed the legend title.
Note that the colors will swap between the two options when you change the factor levels. (That's because it is alphabetized.)
```
#### Option 1 - - Recommended method
# change the legend entries-- factor levels
# in your image, you have "EDET", but your data has "edet"
# make sure this has the capitalization used in your data
hcgdf_v2$cycle2 <- ifelse(hcgdf_v2$cycletype == "edet", "Donor", "Autologous")
# now rerun plot with alternate subgroup
opt_cut_b_cycle.type<- cutpointr(hcgdf_v2, beta.hcg, livebirth.factor, cycle2,
method = maximize_boot_metric,
metric = youden, boot_runs = 1000,
boot_stratify = TRUE,
na.rm = TRUE) %>%
add_metric(list(ppv, npv, odds_ratio, risk_ratio, p_chisquared))
#### Option 2 - - Not recommended due to legend spacing
# alternative to rename legend entry labels
# this should return "EDET"
plt$grobs[[2]]$grobs[[1]]$grobs[[7]][[4]][[1]][[6]][[1]][[1]]
# this should return "IVFET"
plt$grobs[[2]]$grobs[[1]]$grobs[[8]][[4]][[1]][[6]][[1]][[1]]
plt$grobs[[2]]$grobs[[1]]$grobs[[7]][[4]][[1]][[6]][[1]][[1]] <- "Donor"
plt$grobs[[2]]$grobs[[1]]$grobs[[8]][[4]][[1]][[6]][[1]][[1]] <- "Autologous"
```
To see your modified plot, use `plot`.
```
plot(plt)
```
When I ran it this code, changing the legend title causes some odd behavior where the plot background isn't entirely white, if that happens in your plot do the following.
This requires the library `gridExtra`.
```
# clear the plot
plot.new()
# recreate the grid
plt2 <- grid.arrange(plt$grobs[[1]]$grobs[[1]], # 2 small graphs top left
plt$grobs[[1]]$grobs[[2]], # ROC curve graph (top right)
plt$grobs[[1]]$grobs[[3]], # distro of optimal cut
plt$grobs[[1]]$grobs[[4]], nrow = 2) # out-of-bag estimates
plot.new()
# graphs and legend set to 4:1 ratio of space graphs to legend
grid.arrange(plt2, plt$grobs[[2]], ncol = 2, widths = c(4, 1))
```
```
| null | CC BY-SA 4.0 | null | 2023-01-13T15:09:54.353 | 2023-01-13T15:09:54.353 | null | null | 5,329,073 | null |
75,111,092 | 2 | null | 31,510,642 | 0 | null | While browsing for a code, I recently have learnt a new code, using this code which takes a window object as input and (including multiple levels of nesting). This function however is an efficient/elegant way that can be used to grab a reference to all the windows (objects) and all the child windows (objects). I have checked this function and found that it works well, it could be understood that making/writing this function completely recursively, as the DOM object tree is actually an n-ary, not binary.
```
function getAllNestedWindows(window) {
var windows = [window];
if (window.length === 0) {
return windows;
} else {
for (var i = 0; i < window.length; i++) {
windows = windows.concat(getAllNestedWindows(window[i]));
}
}
return windows;
}
```
| null | CC BY-SA 4.0 | null | 2023-01-13T15:17:52.227 | 2023-01-13T15:17:52.227 | null | null | 3,972,731 | null |
75,111,194 | 2 | null | 20,753,782 | 0 | null | List of possible fonts for python 3+
```
from matplotlib.font_manager import get_font_names
print(get_font_names())
```
| null | CC BY-SA 4.0 | null | 2023-01-13T15:26:27.923 | 2023-01-13T15:26:27.923 | null | null | 7,775,334 | null |
75,111,237 | 2 | null | 75,106,208 | 0 | null | Please try this
```
library(stringr)
data <- c('t1 waiting 1234', 'waiting 1234.5')
data <- trimws(str_extract_all(data, '\\s\\d.*'))
data
```
| null | CC BY-SA 4.0 | null | 2023-01-13T15:30:37.803 | 2023-01-13T15:30:37.803 | null | null | 14,454,397 | null |
75,111,817 | 2 | null | 75,109,148 | 0 | null | Found the answer myself. Using WritableArray this can be accomplished.
```
WritableArray data = Arguments.createArray();
List<LinkedTreeMap> accessLogList = (ArrayList) response.get("event_logs");
for (LinkedTreeMap accessLog : accessLogList) {
WritableMap accessMap = Arguments.createMap();
accessMap.putString("dateTime", String.valueOf(accessLog.get("datetime")));
accessMap.putString("serial", String.valueOf(accessLog.get("device_serial")));
accessMap.putString("code", getCode(String.valueOf(accessLog.get("code"))));
data.pushMap(accessMap);
}
```
| null | CC BY-SA 4.0 | null | 2023-01-13T16:18:03.703 | 2023-01-17T10:01:33.503 | 2023-01-17T10:01:33.503 | 3,475,325 | 9,585,575 | null |
75,112,103 | 2 | null | 75,111,477 | 0 | null | Your settings for the template dirs is os.path.join(BASE_DIR,"templates"), but your folder structure shows plantillas/registrar/iniciar_session.html.
change the templates to plantillas in the DIRS:
```
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR,"plantillas")],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
```
In the future, when Django cannot find your templates, use the Template-loader postmortem which is the first gray section under the yellow bar saying TemplateDoesNotExist at /. It will tell you where it is trying to look and you can compare it to where it should be looking.
Hope this helps!
| null | CC BY-SA 4.0 | null | 2023-01-13T16:46:56.697 | 2023-01-13T16:46:56.697 | null | null | 11,570,433 | null |
75,112,425 | 2 | null | 75,025,556 | 0 | null | Confirmed with the Product Managers, you should leave empty fields unlabeled when creating training data for a Custom Processor (Uptraining or Custom Document Extractor)
| null | CC BY-SA 4.0 | null | 2023-01-13T17:16:37.373 | 2023-01-13T17:16:37.373 | null | null | 6,216,983 | null |
75,112,789 | 2 | null | 70,495,087 | 0 | null | My problem was identical to the post after porting my MSTest suite from VS 2019 to VS 2022. Updating these nuget updates for MSTest is what worked in my case. One more thing to have on the list of possible solutions.
[](https://i.stack.imgur.com/lrZAB.png)
| null | CC BY-SA 4.0 | null | 2023-01-13T17:51:00.227 | 2023-01-13T17:51:00.227 | null | null | 5,438,626 | null |
75,112,859 | 2 | null | 74,871,121 | 0 | null | You have a typo in your exclude entry.
If you want to exclude the `Program.cs` file you need to insert `**/Program.cs`.
| null | CC BY-SA 4.0 | null | 2023-01-13T17:57:34.357 | 2023-01-13T17:57:34.357 | null | null | 16,540,808 | null |
75,112,950 | 2 | null | 75,112,912 | 0 | null | You have to have "requirements.txt" file in the same folder where you run this command "`pip3 install -r requirements.txt`"
Try to type "`ls -lah`" and provide output here.
| null | CC BY-SA 4.0 | null | 2023-01-13T18:05:42.803 | 2023-01-13T18:05:42.803 | null | null | 8,825,754 | null |
75,113,357 | 2 | null | 75,039,009 | 1 | null | The default alignment behaviour of `cases` is `l`eft-`l`eft for the value and domain components. In this specific case (for aesthetic reasons), you can insert a `\phantom` negation to align the values:
[](https://i.stack.imgur.com/D0He2.png)
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\lvert x \rvert = \begin{cases}
x, & x \geq 0 \\
-x, & x < 0
\end{cases}
\]
\[
\lvert x \rvert = \begin{cases}
\phantom{-}x, & x \geq 0 \\
-x, & x < 0
\end{cases}
\]
\end{document}
```
| null | CC BY-SA 4.0 | null | 2023-01-13T18:49:23.923 | 2023-01-13T18:49:23.923 | null | null | 914,686 | null |
75,113,443 | 2 | null | 75,111,356 | 1 | null | Rather than use `stringsDict` you should probably use localisation provided by the built-in Formatters. In this case `DateComponentsFormatter` probably does what you need:
```
struct ContentView: View {
var body: some View {
List {
ForEach(["en", "ru", "el", "th"], id: \.self) { localeId in
Section(localeId) {
ForEach(0..<3, id: \.self) { i in
HStack {
Text(formatter(localeId).string(from: DateComponents(minute: i))!)
Spacer()
Text(formatter(localeId).string(from: DateComponents(second: i))!)
}
}
}
}
}
}
func formatter(_ localeId: String) -> DateComponentsFormatter {
var calendar = Calendar.current
calendar.locale = Locale(identifier: localeId)
let formatter = DateComponentsFormatter()
formatter.calendar = calendar
formatter.unitsStyle = .full
return formatter
}
}
```
[](https://i.stack.imgur.com/gVigal.png)
It's even simpler if you just want to format for the device's current locale:
```
struct ContentView: View {
var body: some View {
List {
ForEach(0..<3, id: \.self) { i in
HStack {
Text(DateComponents(minute: i), formatter: Self.formatter)
Spacer()
Text(DateComponents(second: i), formatter: Self.formatter)
}
}
}
}
static var formatter: DateComponentsFormatter {
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .full
return formatter
}
}
```
| null | CC BY-SA 4.0 | null | 2023-01-13T18:59:25.910 | 2023-01-13T19:04:53.730 | 2023-01-13T19:04:53.730 | 123,632 | 123,632 | null |
75,113,601 | 2 | null | 75,111,905 | 0 | null | If you are specifying the user-name and password...you should remove:
Integrated Security=true;
the "identity" can be different .... and is probably changing the user you are specifying.
Integrated Security (under windows) means "use the identity that is connected to the PROCESS that is running the code".
Most times, when you are logged into your windows machine, the identity is "you". If you pull up "Windows Services", you can see some deviations from this in-general rule.
See
[https://www.connectionstrings.com/postgresql/](https://www.connectionstrings.com/postgresql/)
it goes through some of the concepts.
You'll note (at the URL I just mentioned), the "Integrated Security example (seen below) contains no user-name or password.
```
Using windows security
Server=127.0.0.1;Port=5432;Database=myDataBase;Integrated Security=true;
```
| null | CC BY-SA 4.0 | null | 2023-01-13T19:15:54.587 | 2023-01-13T19:15:54.587 | null | null | 214,977 | null |
75,113,743 | 2 | null | 19,522,897 | 0 | null | I solved this problem like this: Project -> Clean -> %YOURPROJECT%
[Click Here for image](https://i.stack.imgur.com/lMram.jpg)
| null | CC BY-SA 4.0 | null | 2023-01-13T19:33:04.303 | 2023-01-13T19:36:33.170 | 2023-01-13T19:36:33.170 | 19,587,963 | 19,587,963 | null |
75,113,943 | 2 | null | 75,113,827 | 0 | null | The problem does not come from the stringify function. Since you are filling your array asynchronously (when the reader callback is executed) but returning your data first, it is empty.
You could wrap your function with a Promise that resolves when the reader callback function is finally executed, like so:
```
function parseCSV(file) {
return new Promise((resolve, reject) => {
let filename = file.name;
let extension = filename.substring(filename.lastIndexOf('.')).toUpperCase();
if(extension !== '.CSV')
return reject('PLEASE UPLOAD A VALID CSV FILE')
try {
let reader = new FileReader();
let jsonData = [];
let headers = [];
reader.readAsBinaryString(file);
reader.onload = function(e) {
let rows = e.target.result.split('\n');
for(let i = 0; i < rows.length; i++) {
let cells = rows[i].split(',');
let rowData = {};
for(let j = 0; j < cells.length; j++) {
if(i == 0) headers.push(cells[j].trim());
else {
if(headers[j]) rowData[headers[j]] = cells[j].trim();
}
}
if(i != 0 && rowData['date'] != '') jsonData.push(rowData);
}
return resolve(jsonData);
}
} catch(err) {
return reject('!! ERROR READING CSV FILE', err);
}
})
}
// calling the function
const data = await parseCSV(file)
```
| null | CC BY-SA 4.0 | null | 2023-01-13T19:58:13.660 | 2023-01-13T20:44:00.433 | 2023-01-13T20:44:00.433 | 8,031,029 | 8,031,029 | null |
75,113,957 | 2 | null | 71,103,864 | 0 | null | I had this issue in one of our monorepo and it was caused by the fact that one of our library's name wasn't valid. We had something like @organisation/test-utils/e2e which we ended up renaming to @organisation/test-utils-e2e (take note of the / usage).
| null | CC BY-SA 4.0 | null | 2023-01-13T20:00:12.777 | 2023-01-13T20:00:12.777 | null | null | 7,817,501 | null |
75,114,188 | 2 | null | 75,108,117 | 0 | null | You can do this with an additional unconnected SupportTable, where you need to store range Label, Min and Max value per range:
[](https://i.stack.imgur.com/0460n.png)
```
CountOfIDs = var _rangeMin = SELECTEDVALUE(SupportLabel[MinVal]) var
_rangeMax = SELECTEDVALUE(SupportLabel[MaxVal]) return COUNTROWS( FILTER( SUMMARIZE('Workload','Workload'[ID],"distvalperid", calculate(DISTINCTCOUNT(Workload[CTRG]) )), [distvalperid] <=
_rangeMax && [distvalperid] >= _rangeMin) )
```
| null | CC BY-SA 4.0 | null | 2023-01-13T20:29:06.053 | 2023-01-13T20:29:06.053 | null | null | 14,366,538 | null |
75,114,272 | 2 | null | 75,113,998 | 0 | null | I don't think this is possible for all kinds of logs that are triggered from different platforms inside a flutter app when it's released, there are many reasons such as when the `log()` from the `dart:developer` shows a statement in the console log only in the debug mode, not the release mode.
However, you can make it happen for your project's `print()`, `debugPrint()` by combining these methods with a `StreamController`, `Stream` like this :
`StreamController`
```
StreamController streamController = StreamController<String>();
```
`print``debugPrint``streamController`
```
void customPrint(Object? object) {
streamController.add(object.toString());
print(object);
}
```
`Stream``StreamController`
```
StreamBuilder<List<String>>(
stream: streamController.stream, // the stream of the controller
builder: (context, snapshot) {
if (snapshot.hasData) {
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(snapshot.data[index]),
);
});
} else {
return Container();
}
}
),
```
now you can change all your `print()` calls with the `customPrint()`, and every time it's called, it will be printed in the console log, and also be shown in the UI of the Flutter app.
| null | CC BY-SA 4.0 | null | 2023-01-13T20:40:51.733 | 2023-01-13T20:40:51.733 | null | null | 18,670,641 | null |
75,114,354 | 2 | null | 29,566,115 | 0 | null | I'm using itext 7 and I change the space between items with `ListItem` bottom margin.
In my case I wanted the items closer I do this:
```
listItem.SetMarginBottom(-5);
```
| null | CC BY-SA 4.0 | null | 2023-01-13T20:49:52.040 | 2023-01-13T20:49:52.040 | null | null | 7,613,743 | null |
75,114,414 | 2 | null | 74,696,243 | 0 | null | To put a main title, you have to use the [plt.suptitle()](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.suptitle.html) or [fig.suptitle()](https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure.suptitle):
```
plt.suptitle('Average Seasonal Precipiation Jan. 1979 - Dec. 2021 ')
```
You can see this question for more details: [How to position suptitle](https://stackoverflow.com/questions/55767312/how-to-position-suptitle)
It looks like you're plotting your data twice, as you do two calls to `Seas_NHNA.plot.contourf(...)` with the same data, while creating a new figure in the middle, so maybe you want it on two different figures?
If you want to work with multiple figures, you should name them, and then use fig1.suptitle() to make sure your title goes on the correct one.
| null | CC BY-SA 4.0 | null | 2023-01-13T20:57:47.483 | 2023-01-13T20:57:47.483 | null | null | 19,885,851 | null |
75,114,670 | 2 | null | 75,114,339 | 1 | null | Here's a starting point: to get this to work properly I'd have to spend more time reading the documentation and the relevant papers to figure out what the parameterizations are.
Start with `library("sos"); findFn("{multivariate skew-normal}")` to find the `sn` package. Then look at the examples in `?rmsn`. This leads us to `?cp2dp`:
> For a multivariate
distribution, there exists an extension based on the same logic;
its components represent the vector mean value, the variance
matrix, the vector of marginal coefficients of skewness ...
```
mean_v <- c(20, 10)
sd_v <- c(10, 10)
correlation <- 0.3
## from SD, cor to covariance matrix
vv <- outer(sd_v, sd_v) * matrix(c(1, correlation, correlation, 1), 2, 2)
xi_v <- c(10, 10)
n <- 10000
## note different notation in sn vs fGarch: xi is location
## n.b. I haven't checked that sn 'alpha' is actually
## equivalent to fGarch 'xi' ...
op_pars <- list(xi=mean_v, Omega=vv, alpha=xi_v)
dp_pars <- op2dp(op_pars, family = "SN")
set.seed(101)
y <- rmsn(n = n, dp = dp_pars)
colMeans(y)
```
| null | CC BY-SA 4.0 | null | 2023-01-13T21:35:07.413 | 2023-01-13T21:35:07.413 | null | null | 190,277 | null |
75,114,676 | 2 | null | 75,114,339 | 1 | null | Let's recreate your example but with a reproducible random seed
```
set.seed(1)
correlation <- 0.3
mean_1 <- 20
mean_2 <- 10
sd_1 <- 10
sd_2 <- 10
xi_1 <- 10
xi_2 <- 10
n <- 10000
x <- abs(fGarch::rsnorm(n, mean = mean_1, sd = sd_1, xi = xi_1))
y <- abs(fGarch::rsnorm(n, mean = mean_2, sd = sd_2, xi = xi_2))
```
Now of course x and y are effectively completely uncorrelated:
```
cor(x, y)
#> [1] -0.003209725
```
But if we sort both vectors, they become almost perfectly correlated.
```
x <- sort(x)
y <- sort(y)
cor(x, y)
#> [1] 0.9967296
```
But we want something in between, so let's shuffle `x` randomly, one pair at a time, and keep doing this until the correlation falls below our target correlation:
```
while(cor(x, y) > correlation) {
ij <- sample(n, 2)
tmpx <- x[ij[1]]
x[ij[1]] <- x[ij[2]]
x[ij[2]] <- tmpx
}
```
Of course, we haven't changed the actual value of x or y, so their parameters are unchanged:
```
hist(x)
```

```
hist(y)
```

```
mean(x)
#> [1] 19.87497
mean(y)
#> [1] 10.60162
```
But now their correlation matches our target value:
```
cor(x, y)
#> [1] 0.2997019
```
[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2023-01-13T21:36:33.923 | 2023-01-13T21:36:33.923 | null | null | 12,500,315 | null |
75,114,726 | 2 | null | 75,114,541 | 0 | null | We may loop `across` the columns of interest, `paste` (`str_c`) the column name (`cur_column()`) with the values in the column, then `unite` the columns into a single column with `sep = ", "` (or if we need new line use (`\n`)
```
library(dplyr)
library(stringr)
library(tidyr)
dat1 %>%
transmute(across(Arson:`Crimes against children`,
~ str_c(cur_column(), ": ", .x))) %>%
unite(keyval, everything(), sep = ", ", na.rm = TRUE)
```
-output
```
# A tibble: 2 Γ 1
keyval
<chr>
1 Arson: 133, Assault/battery: 11330, Bomb/guns: 604, Crimes against children: 504
2 Arson: 152, Assault/battery: 10090, Bomb/guns: 156, Crimes against children: 113
```
### data
```
dat1 <- structure(list(Arson = c(133, 152), `Assault/battery` = c(11330,
10090), `Bomb/guns` = c(604, 156), `Crimes against children` = c(504,
113)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-2L))
```
| null | CC BY-SA 4.0 | null | 2023-01-13T21:44:04.257 | 2023-01-13T21:44:04.257 | null | null | 3,732,271 | null |
75,115,044 | 2 | null | 75,106,049 | 0 | null |
1. The diagnosis defrule is missing an opening parenthesis.
2. The diagnosis defrule references the disease defclass before the class is defined.
3. Classes automatically have a name slot defined.
4. You have two ask-symptoms rules.
5. The conditions of the ask-symptoms-2 rule will never be satisfied. Any fact matching the first pattern will cause the following pattern to fail.
6. If you want to read multiple symptoms, use the readline function along with the explode$ function.
7. In the diagnosis rule, you need to use the object keyword to match an instance of a defclass.
8. In the diagnosis rule, the disease pattern can only be matched by diseases with exactly one symptom.
For example:
```
CLIPS (6.4 2/9/21)
CLIPS>
(defclass disease
(is-a USER)
(role concrete)
(multislot symptoms)
(slot text))
CLIPS>
(defrule diagnosis
(object (is-a disease) (name ?name) (text ?d))
(exists
(symptoms $? ?s $?)
(object (is-a disease) (name ?name) (symptoms $? ?s $?)))
=>
(printout t "The patient may have " ?d "." crlf))
CLIPS>
(defrule ask-symptoms
=>
(printout t "What are the patient's symptoms? ")
(bind ?symptoms (readline))
(assert (symptoms (explode$ ?symptoms))))
CLIPS>
(definstances diseases
(influenza of disease (symptoms fever headache) (text "influenza"))
(strep-throat of disease (symptoms fever sorethroat) (text "strep throat"))
(pneumonia of disease (symptoms cough shortness-of-breath) (text "pneumonia"))
(food-poisoning of disease (symptoms stomachache nausea) (text "food poisoning")))
CLIPS> (reset)
CLIPS> (run)
What are the patient's symptoms? cough nausea
The patient may have pneumonia.
The patient may have food poisoning.
CLIPS>
```
| null | CC BY-SA 4.0 | null | 2023-01-13T22:32:17.290 | 2023-01-13T22:32:17.290 | null | null | 232,642 | null |
75,115,374 | 2 | null | 16,797,730 | 0 | null | I had exactly this same issue and after hours of banging my head against the wall I found that something with Chrome's HTTP caching mechanism prevents the `Origin` header from being sent. This is a Chrome-specific issue as I could not reproduce it with Safari. You can check whether this is the case for you as well by toggling the "Disable Cache" option under the [Network tab of Chrome developer tools](https://i.stack.imgur.com/RucVP.png).
To force your request to ignore the cache, use appropriate `cache` option ([documentation](https://developer.mozilla.org/en-US/docs/Web/API/fetch)). This is my final working code:
```
fetch(url, {
method: 'GET',
mode: 'cors',
cache: 'no-store', // for some reason Chrome's caching doesn't send Origin
})
```
| null | CC BY-SA 4.0 | null | 2023-01-14T02:28:53.090 | 2023-01-14T02:28:53.090 | null | null | 6,186,314 | null |
75,115,427 | 2 | null | 75,112,102 | 0 | null | You can try [io.BytesIO](https://docs.python.org/3/library/io.html#binary-i-o). For example:
```
# import io, tabula
pdfUrl = 'https://www.premera.com/documents/052166_2023.pdf'
r = requests.get(pdfUrl, headers={'user-agent': 'Mozilla/5.0'})
r.raise_for_status()
tabula.read_pdf(io.BytesIO(r.content), pages='6')[0]
```
I'm not sure the page link will work as `pdfUrl` since it's embedded, so if `tabula.io` raises some error, try the download link of the pdf instead.
| null | CC BY-SA 4.0 | null | 2023-01-14T02:45:28.727 | 2023-01-14T02:45:28.727 | null | null | 6,146,136 | null |
75,115,545 | 2 | null | 75,113,647 | 1 | null | Change the label color / font using CSS. For pie chart, class is `.jqplot-data-label`.
```
#gender_chart .jqplot-data-label {
font-weight: bold;
font-size: large;
color: white;
}
```
Change jqPlot label CSS as per your requirement via class.
To remove decimal value remove line `dataLabelFormatString: '%#.2f%'` from your code.
`%#.2f` instructs chart to display the value with two decimal places, and the `%` at the end adds a percent sign to the end of the value.
Example:
```
var data = [
['M', 59],
['F', 41],
];
var plot1 = jQuery.jqplot('gender_chart', [data], {
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
showDataLabels: true,
textColor: 'white'
}
},
legend: {
reverse: true,
position: 'top',
show: true,
location: 'e',
labels: {
fontColor: 'white',
textColor: 'white',
},
},
seriesColors: ['#fb7601', '#365D98']
});
```
```
#gender_chart .jqplot-data-label {
color: white;
font-size: 35px;
font-family: Garamond, serif;
}
```
```
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/jquery.jqplot.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/jquery.jqplot.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.pieRenderer.min.js"></script>
<div id="gender_chart" style="width:400px; height: 300px;"></div>
```
| null | CC BY-SA 4.0 | null | 2023-01-14T03:21:14.693 | 2023-01-14T04:25:58.993 | 2023-01-14T04:25:58.993 | 965,146 | 965,146 | null |
75,115,646 | 2 | null | 52,109,920 | 0 | null | I'm running a microsoft sql server in a docker container on my macbook pro from 2015, was getting this error when running my C# VS2022 API and trying to connect to the db, had to put `Encrypt=True` in my connection string like so: `"DefaultConnection": "server=localhost;database=newcomparer;trusted_connection=false;User Id=sa;Password=reallyStrongPwd123;Persist Security Info=False;Encrypt=True"`
| null | CC BY-SA 4.0 | null | 2023-01-14T03:48:45.513 | 2023-01-14T03:48:45.513 | null | null | 2,559,126 | null |
75,115,672 | 2 | null | 75,107,730 | 0 | null | You should load the `.env` file inside your settings, not PyCharm.
One way to do this is to use [django-environ](https://django-environ.readthedocs.io/en/latest/index.html).
Here's how you would use it in your `settings.py`:
```
import environ
import os
env = environ.Env()
# Set the project base directory
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Take environment variables from .env file
environ.Env.read_env(os.path.join(BASE_DIR, '.env'))
# Load the environment variables
DATABASES = {
'default': {
'ENGINE': env('DB_ENGINE'),
'NAME': env('DB_NAME'),
'USER': env('DB_USER'),
'PASSWORD': env('DB_PASSWORD'),
'HOST': env('DB_HOST'),
'PORT': env('DB_PORT'),
}
}
```
Be sure to [install the package](https://django-environ.readthedocs.io/en/latest/install.html) first.
Check out the [quick start](https://django-environ.readthedocs.io/en/latest/quickstart.html#quick-start) or [this Medium article](https://alicecampkin.medium.com/how-to-set-up-environment-variables-in-django-f3c4db78c55f) for more examples.
| null | CC BY-SA 4.0 | null | 2023-01-14T03:57:46.877 | 2023-01-14T03:57:46.877 | null | null | 3,694,363 | null |
75,116,056 | 2 | null | 75,043,248 | 1 | null | It seems as if [XWPFTable.createRow](https://poi.apache.org/apidocs/dev/org/apache/poi/xwpf/usermodel/XWPFTable.html#createRow--) messes the table's row array, at least for tables in tables. My debugging had shown that `XWPFTable.getRow(0)` gets the second row when `XWPFTable` is a table in a table and the row was added using `XWPFTable.createRow`. `XWPFTable.getRow(1)` gets the third row then and the first row is not reachable using `XWPFTable.getRow`.
If [XWPFTable.insertNewTableRow](https://poi.apache.org/apidocs/dev/org/apache/poi/xwpf/usermodel/XWPFTable.html#insertNewTableRow-int-) is used to add the rows, then `XWPFTable.getRow` works correctly.
Complete example:
```
import java.io.*;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
public class CreateWordTableInTable2 {
public static void main(String[] args) {
try {
XWPFDocument doc = new XWPFDocument();
// create main table
XWPFTable table = doc.createTable();
// create rows and cells
XWPFTableRow row = table.getRow(0);
row.getCell(0).setText("Main table A1");
row.addNewTableCell().setText("Main table B1");
row.addNewTableCell().setText("Main table C1");
row = table.createRow();
row.setHeight(2000);
row.getCell(0).setText("Main table A2");
row.getCell(1).setText("Main table B2");
row.getCell(2).setText("Main table C2");
row = table.createRow();
row.setHeight(2000);
row.getCell(0).setText("Main table d2");
row.getCell(1).setText("Main table d2");
row.getCell(2).setText("Main table d2");
// 1
row = table.getRow(0);
XWPFTableCell cell = row.getTableCells().get(0);
XWPFParagraph paragraph = cell.addParagraph();
// 2
org.apache.xmlbeans.XmlCursor cursor = paragraph.getCTP().newCursor();
XWPFTable innerTable = cell.insertNewTbl(cursor);
// 3
innerTable.setTopBorder(XWPFTable.XWPFBorderType.SINGLE, 4, 0, "000000");
innerTable.setRightBorder(XWPFTable.XWPFBorderType.SINGLE, 4, 0, "000000");
innerTable.setBottomBorder(XWPFTable.XWPFBorderType.SINGLE, 4, 0, "000000");
innerTable.setLeftBorder(XWPFTable.XWPFBorderType.SINGLE, 4, 0, "000000");
innerTable.setInsideHBorder(XWPFTable.XWPFBorderType.SINGLE, 4, 0, "000000");
innerTable.setInsideVBorder(XWPFTable.XWPFBorderType.SINGLE, 4, 0, "000000");
// 4
//XWPFTableRow rowInInnerTable = innerTable.createRow();
XWPFTableRow rowInInnerTable = innerTable.insertNewTableRow(0);
rowInInnerTable.setHeight(1000);
XWPFTableCell cellInInnerTable = rowInInnerTable.createCell();
cellInInnerTable.setColor("FF00FF");
rowInInnerTable.getCell(0).setWidth("700");
rowInInnerTable.getCell(0).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
XWPFParagraph p5 = rowInInnerTable.getCell(0).getParagraphs().get(0);
p5.setAlignment(ParagraphAlignment.CENTER);
XWPFRun r5 = p5.createRun();
r5.setFontSize(10);
r5.setText("SUB_TAB1");
cellInInnerTable = rowInInnerTable.createCell();
rowInInnerTable.getCell(1).setWidth("300"); // ??? ??
rowInInnerTable.getCell(1).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
cellInInnerTable.setColor("FF00FF"); // ??
p5 = rowInInnerTable.getCell(1).getParagraphs().get(0);
p5.setAlignment(ParagraphAlignment.CENTER);
r5 = p5.createRun();
r5.setFontSize(10);
r5.setText("SUB_TAB3");
cellInInnerTable = rowInInnerTable.createCell();
cellInInnerTable.setColor("FF00FF"); // ??
rowInInnerTable.getCell(2).setWidth("2000"); // ??? ??
rowInInnerTable.getCell(2).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
p5 = rowInInnerTable.getCell(2).getParagraphs().get(0);
p5.setAlignment(ParagraphAlignment.CENTER);
r5 = p5.createRun();
r5.setText("SUB_TAB4");
//rowInInnerTable = innerTable.createRow();
//cellInInnerTable = rowInInnerTable.getCell(0);
rowInInnerTable = innerTable.insertNewTableRow(1);
cellInInnerTable = rowInInnerTable.createCell();
p5 = rowInInnerTable.getCell(0).getParagraphs().get(0);
p5.setAlignment(ParagraphAlignment.CENTER);
r5 = p5.createRun();
r5.setText("AA");
//cellInInnerTable = rowInInnerTable.getCell(1);
cellInInnerTable = rowInInnerTable.createCell();
p5 = rowInInnerTable.getCell(1).getParagraphs().get(0);
p5.setAlignment(ParagraphAlignment.CENTER);
r5 = p5.createRun();
r5.setText("BB1");
//cellInInnerTable = rowInInnerTable.getCell(2);
cellInInnerTable = rowInInnerTable.createCell();
p5 = rowInInnerTable.getCell(2).getParagraphs().get(0);
p5.setAlignment(ParagraphAlignment.CENTER);
r5 = p5.createRun();
r5.setText("CC");
//rowInInnerTable = innerTable.createRow();
//cellInInnerTable = rowInInnerTable.getCell(0);
rowInInnerTable = innerTable.insertNewTableRow(2);
cellInInnerTable = rowInInnerTable.createCell();
p5 = rowInInnerTable.getCell(0).getParagraphs().get(0);
p5.setAlignment(ParagraphAlignment.CENTER);
r5 = p5.createRun();
r5.setText("AA_2");
//cellInInnerTable = rowInInnerTable.getCell(1);
cellInInnerTable = rowInInnerTable.createCell();
//cellInInnerTable = rowInInnerTable.getCell(2);
cellInInnerTable = rowInInnerTable.createCell();
setColumnWidth(table, 0, 0, 4500);
setColumnWidth(table, 0, 1, 2000);
setColumnWidth(table, 0, 2, 2000);
mergeCellVertically(table, 1, 1, 2);
mergeCellVertically(innerTable, 1, 1, 2); // ????????????????????????????
// save to .docx file
try (FileOutputStream out = new FileOutputStream("./MAIN_table.docx")) {
doc.write(out);
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void setColumnWidth(XWPFTable table, int row, int col, int width) {
CTTblWidth tblWidth = CTTblWidth.Factory.newInstance();
tblWidth.setW(java.math.BigInteger.valueOf(width));
tblWidth.setType(STTblWidth.DXA);
CTTcPr tcPr = table.getRow(row).getCell(col).getCTTc().getTcPr();
if (tcPr != null) {
tcPr.setTcW(tblWidth);
} else {
tcPr = CTTcPr.Factory.newInstance();
tcPr.setTcW(tblWidth);
table.getRow(row).getCell(col).getCTTc().setTcPr(tcPr);
}
}
static void mergeCellVertically(XWPFTable table, int col, int fromRow, int toRow) {
for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {
XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
//System.out.println(cell.getTableRow().getCtRow()); // wrong row in inner table when XWPFTable.createRow was used
CTVMerge vmerge = CTVMerge.Factory.newInstance();
if (rowIndex == fromRow) {
vmerge.setVal(STMerge.RESTART);
} else {
vmerge.setVal(STMerge.CONTINUE);
for (int i = cell.getParagraphs().size(); i > 0; i--) {
cell.removeParagraph(0);
}
cell.addParagraph();
}
CTTcPr tcPr = cell.getCTTc().getTcPr();
if (tcPr == null) {
tcPr = cell.getCTTc().addNewTcPr();
}
tcPr.setVMerge(vmerge);
}
}
}
```
Result:
[](https://i.stack.imgur.com/EHf2U.png)
If it comes to the question why this happens, then my suspicion is that [XWPFTable.addColumn](https://svn.apache.org/viewvc/poi/tags/REL_5_2_3/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTable.java?view=markup#l426) is the guilty. This is the main differnce between `XWPFTable.createRow` and `XWPFTable.insertNewTableRow`. The first tries filling the new added row with as much cells as columns are in the table already. The second does not and adds an empty row.
Me never understood that behavior of `XWPFTable.createRow`. Why should it be necessary to fill the new added row with as much cells as columns are in the table already? Why not simply let the programmer add cells to the row?
| null | CC BY-SA 4.0 | null | 2023-01-14T05:45:14.377 | 2023-01-14T06:05:42.087 | 2023-01-14T06:05:42.087 | 3,915,431 | 3,915,431 | null |
75,116,112 | 2 | null | 65,011,204 | 0 | null | At times the resources folder might not be there by default on eclipse , then you would need to create a folder under src/test by the name 'resources' and the create 2 sub-folders under that folder named 'cucumber.properties' and 'junit-platform.properties' and add that declaration under both.
cucumber.publish.quiet=true
| null | CC BY-SA 4.0 | null | 2023-01-14T05:58:51.627 | 2023-01-14T05:59:31.263 | 2023-01-14T05:59:31.263 | 17,597,185 | 17,597,185 | null |
75,116,485 | 2 | null | 75,116,387 | 1 | null | You need to set the `DataPropertyName` of each grid column to the name of the data source property or column you want it to bind to. If your data source columns are named "F1", "F2", etc, then that's what you need to set as the `DataPropertyName` of the grid columns. If you created those grid columns in the designer, that's where you should set that property.
If you don't want to display every column from the data source then you'll also need to set `AutoGenerateColumns` to `False` in code before setting the `DataSource`, so no extra columns are generated.
| null | CC BY-SA 4.0 | null | 2023-01-14T07:39:40.820 | 2023-01-14T07:39:40.820 | null | null | 584,183 | null |
75,116,557 | 2 | null | 75,073,057 | 2 | null | @H.H, you're right. Using the url property of the @import rule and fixing some wrong CSS's relative paths, it's now working as a charm:
```
@layer vendor, blazor;
@import url('bootstrap/bootstrap.min.css') layer(vendor.bootstrap);
@import url('https://fonts.googleapis.com/icon?family=Material+Icons') layer(vendor.material-icons);
@import url('../_content/Radzen.Blazor/css/material-base.css') layer(vendor.radzen);
@import url('app.css') layer(blazor.app);
```
Now the 3rd party CSS are layerd as expected and my custom.css (unlayerd) takes the precedence.
| null | CC BY-SA 4.0 | null | 2023-01-14T07:57:33.383 | 2023-01-21T15:57:32.027 | 2023-01-21T15:57:32.027 | 20,975,777 | 20,975,777 | null |
75,116,909 | 2 | null | 75,116,838 | 3 | null | Instead of short form `cy.get('input').should('have.value', '17,169.00')` use callback form.
Something like
```
cy.get('input')
.should($el => {
const price = "17,169.00";
const message = `expected #buy-price-field to have value ${price}`;
expect($el.val(), message).to.eq(price);
})
```
| null | CC BY-SA 4.0 | null | 2023-01-14T09:17:15.330 | 2023-01-14T20:23:23.307 | 2023-01-14T20:23:23.307 | 21,005,442 | 20,968,911 | null |
75,117,013 | 2 | null | 75,114,815 | 3 | null | This is because the compatible version of '' is not yet released. The latest '' version is v108 which is compatible with Chrome version .
You can refer the below repository for all the versions:
[https://repo1.maven.org/maven2/org/seleniumhq/selenium/](https://repo1.maven.org/maven2/org/seleniumhq/selenium/)
I checked with with and with the , got the below same warning:
[](https://i.stack.imgur.com/D7m01.jpg)
Then I downgraded Chrome browser to , checked with and , this time didn't get the warning:
[](https://i.stack.imgur.com/us1NJ.jpg)
The next version may be released with the next Selenium upgrade.
You can also install Selenium Dev-Tools separately from Maven respository: [https://mvnrepository.com/search?q=Selenium+DevTools+V108](https://mvnrepository.com/search?q=Selenium+DevTools+V108)
Anyway, this is just a warning.
| null | CC BY-SA 4.0 | null | 2023-01-14T09:40:37.020 | 2023-01-14T09:40:37.020 | null | null | 7,671,727 | null |
75,117,192 | 2 | null | 24,459,352 | 0 | null | [enter image description here](https://i.stack.imgur.com/PUtGA.png)
```
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:background="@drawable/bg_gradient"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@android:color/white"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.498"
tools:layout_editor_absoluteX="69dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_quote" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:textColor="@android:color/black"
android:textSize="20sp" />
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
app:layout_constraintBottom_toBottomOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="@+id/linearLayout"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>
```
| null | CC BY-SA 4.0 | null | 2023-01-14T10:19:02.067 | 2023-01-14T10:19:02.067 | null | null | 21,005,870 | null |
75,117,555 | 2 | null | 10,062,887 | 0 | null | I have wrote a detailed article on how to generate a grid of hexagon shapes with a little code: [https://css-tricks.com/hexagons-and-beyond-flexible-responsive-grid-patterns-sans-media-queries/](https://css-tricks.com/hexagons-and-beyond-flexible-responsive-grid-patterns-sans-media-queries/)
All you have to do is to update a few CSS variables to control the grid:
```
.main {
display:flex;
--s: 100px; /* size */
--m: 4px; /* margin */
--f: calc(1.732 * var(--s) + 4 * var(--m) - 1px);
}
.container {
font-size: 0; /*disable white space between inline block element */
}
.container div {
width: var(--s);
margin: var(--m);
height: calc(var(--s)*1.1547);
display: inline-block;
font-size:initial;
clip-path: polygon(0% 25%, 0% 75%, 50% 100%, 100% 75%, 100% 25%, 50% 0%);
background: red;
margin-bottom: calc(var(--m) - var(--s)*0.2885);
}
.container div:nth-child(odd) {
background:green;
}
.container::before {
content: "";
width: calc(var(--s)/2 + var(--m));
float: left;
height: 120%;
shape-outside: repeating-linear-gradient(
#0000 0 calc(var(--f) - 3px),
#000 0 var(--f));
}
```
```
<div class="main">
<div class="container">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
```
[](https://i.stack.imgur.com/VyCAj.png)
Find the project on Github as well: [https://github.com/Afif13/responsive-grid-shapes](https://github.com/Afif13/responsive-grid-shapes)
| null | CC BY-SA 4.0 | null | 2023-01-14T11:22:22.063 | 2023-01-14T11:22:22.063 | null | null | 8,620,333 | null |
75,117,895 | 2 | null | 75,115,282 | 0 | null | I solved issue with giving type _text to wallet_addresses parameter and converted string array to array literal.
doc: [https://hasura.io/docs/latest/mutations/postgres/insert/#insert-an-object-with-an-array-field](https://hasura.io/docs/latest/mutations/postgres/insert/#insert-an-object-with-an-array-field)
```
const toArrayLiteral = (arr: string[]) =>
JSON.stringify(arr)?.replace('[', '{')?.replace(']', '}')?.replaceAll('"', '');
```
| null | CC BY-SA 4.0 | null | 2023-01-14T12:23:58.437 | 2023-01-19T23:53:32.230 | 2023-01-19T23:53:32.230 | 17,895,339 | 17,895,339 | null |
75,118,147 | 2 | null | 75,117,818 | 1 | null | The solution turned out to be quite obvious. Just embed the youtube video using iframe like so
```
<iframe width="560" height="315" src="https://www.youtube.com/embed/jg91ikK0OCI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
```
| null | CC BY-SA 4.0 | null | 2023-01-14T13:04:56.747 | 2023-01-14T13:04:56.747 | null | null | 3,900,373 | null |
75,118,517 | 2 | null | 71,052,416 | 0 | null | The latest provided windows-images should come with the CosmosDB emulator pre-installed on the device. See [the docs](https://github.com/actions/runner-images/blob/main/images/win/Windows2019-Readme.md#database-tools) on pre-installed software for a list of what's available.
| null | CC BY-SA 4.0 | null | 2023-01-14T14:07:40.897 | 2023-01-14T14:07:40.897 | null | null | 7,176,908 | null |
75,118,779 | 2 | null | 75,112,614 | 1 | null | `Contacts` is a relationship on `User` resource type.
If you want to include some relationship in the response, you need to specify the relationship in `Expand`.
Not all relationships and resources support the expand. According to the [documentation](https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#relationships) there is no mention that `contacts` supports expand, so probably this code won't work.
```
var graphResult = graphClient.Users
.Request()
.Expand("contacts")
.GetAsync().Result();
Console.WriteLine(graphResult[0].Contacts[0]);
```
In that case you need to make a separate call for each user to get contacts.
```
var contacts = await graphClient.Users["{user_id}"].Contacts
.Request()
.GetAsync();
```
[Users relationships](https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#relationships)
| null | CC BY-SA 4.0 | null | 2023-01-14T14:45:04.283 | 2023-01-14T14:45:04.283 | null | null | 2,250,152 | null |
75,118,849 | 2 | null | 75,115,767 | 0 | null | if you get line color from sns and add it to legend with Line2D it will work.
```
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.lines as mlines
df = pd.read_csv(r'C:\Users\ASUS\Downloads\number-of-natural-disaster-events.csv')
df.drop(['Code'], axis = 1)
df_pivot = df.pivot(index='Year',columns='Entity',values='Number of reported natural disasters (reported disasters)')
df_pivot = df_pivot.drop(['Impact'],axis=1)
df_pivot = df_pivot.fillna(0)
df_pivot = df_pivot.reset_index()
df_pivot
fig, ax = plt.subplots(1, 1, sharey=True, sharex=True, figsize=(20, 10))
legend = []
for col in df_pivot.columns:
if col != "Year":
sns_ax = sns.regplot(ax=ax,data=df_pivot,x="Year", y=col)
color = sns_ax.lines[-1].get_color()
line = mlines.Line2D([], [],color = color, linewidth = 7,
markersize=15, label=col)
legend.append(line)
ax.legend(handles=legend,bbox_to_anchor=(0.5, -0.1),fancybox=True,loc='upper center',shadow=True,ncol=2)
```
| null | CC BY-SA 4.0 | null | 2023-01-14T14:55:50.893 | 2023-01-14T16:07:59.097 | 2023-01-14T16:07:59.097 | 20,974,173 | 20,974,173 | null |
75,119,088 | 2 | null | 74,348,766 | 0 | null | maybe you have found a solution to this issue
anyway I will write the correct solution for others who are facing such issues
you have to use isolate to reading data as bytes so that it has not affected on UI
with isolate, you send expensive operations to the background which means you made a new thread so that you catch the result after it done
by the way, remember your function (in this case read data as bytes) should be high-level method
here is the sample code
```
import 'dart:io';
import 'dart:isolate';
import 'package:dio/dio.dart' as dio;
import 'package:encrypt/encrypt.dart';
import 'package:path_provider/path_provider.dart';
class DownloadFileModel {
final SendPort sendPort;
final dio.Response<dynamic> response;
final String savePath;
DownloadVideoModel({
required this.response,
required this.sendPort,
required this.savePath,
});
}
class DownloadFile {
dio.Dio request = dio.Dio();
void downloadNewFile(String url) async {
final dir = await getApplicationDocumentsDirectory();
String appDocPath = dir.path;
var resp = await request.get(
url,
options: dio.Options(
responseType: dio.ResponseType.bytes,
followRedirects: false,
),
onReceiveProgress: (receivedBytes, totalBytes) {
print(receivedBytes / totalBytes);
},
);
ReceivePort port = ReceivePort();
Isolate.spawn(
whenDownloadCompleted,
DownloadFileModel(
response: resp, sendPort: port.sendPort, savePath: appDocPath),
);
port.listen((encryptedFilePath) {
print(encryptedFilePath);
port.close();
});
}
}
class MyEncrypt {
static final myKey = Key.fromUtf8('TechWithVPTechWithVPTechWithVP12');
static final myIv = IV.fromUtf8('VivekPanacha1122');
static final myEncrypt = Encrypter(AES(myKey));
}
void whenDownloadCompleted(DownloadVideoModel model) async {
SendPort sendPort = model.sendPort;
var encryptResult =
MyEncrypt.myEncrypt.encryptBytes(iv: MyEncrypt.myIv, model.response.data);
File encryptedFile = File("${model.savePath}/myFile.aes");
encryptedFile.writeAsBytes(encryptResult.bytes);
sendPort.send(encryptedFile.absolute.path);
}
```
For more info head over to flutter official document site
[https://api.flutter.dev/flutter/dart-isolate/Isolate-class.html](https://api.flutter.dev/flutter/dart-isolate/Isolate-class.html)
| null | CC BY-SA 4.0 | null | 2023-01-14T15:34:23.580 | 2023-01-14T15:34:23.580 | null | null | 11,051,598 | null |
75,119,341 | 2 | null | 58,809,357 | 0 | null | I love this answer: [https://stackoverflow.com/a/63996814/1695772](https://stackoverflow.com/a/63996814/1695772), so if you upvote this, give him/her an upvote, too. ;)
```
import SwiftUI
struct AlphabetSidebarView: View {
var listView: AnyView
var lookup: (String) -> (any Hashable)?
let alphabet: [String] = {
(65...90).map { String(UnicodeScalar($0)!) }
}()
var body: some View {
ScrollViewReader { scrollProxy in
ZStack {
listView
HStack(alignment: .center) {
Spacer()
VStack(alignment: .center) {
ForEach(alphabet, id: \.self) { letter in
Button(action: {
if let found = lookup(letter) {
withAnimation {
scrollProxy.scrollTo(found, anchor: .top)
}
}
}, label: {
Text(letter)
.foregroundColor(.label)
.minimumScaleFactor(0.5)
.font(.subheadline)
.padding(.trailing, 4)
})
}
}
}
}
}
}
}
```
Use it like this:
```
AlphabetSidebarView(listView: AnyView(contactsListView)) { letter in
// contacts: Array, name: String
contacts.first { $0.name.prefix(1) == letter }
}
```
| null | CC BY-SA 4.0 | null | 2023-01-14T16:12:47.747 | 2023-01-30T14:57:47.080 | 2023-01-30T14:57:47.080 | 1,695,772 | 1,695,772 | null |
75,119,438 | 2 | null | 75,107,566 | 0 | null | Aside from the suggestions in the other solution which are great in reducing the large comprehensions, you should also consider using an indexed set in the construction of your constraint. By doing so, you can remove all of the list comprehensions you are doing "on the fly" inside the constraint construction and this should have a significant speedup on the model construction, somewhat proportional to `|I|`. This:
```
i_ijklm = {ii: ((i, j, k, l, m) for (i, j, k, l, m) in x_list if i==ii) for ii in I}
model.i_ijklm = pyo.Set(model.I, initialize=i_ijklm)
def ei_rule(model, i):
return sum(model.x[ijklm] for ijklm in model.i_ijklm[i]) >= 0
```
You could tinker with the dictionary vs. nested comprehension on this part as well
| null | CC BY-SA 4.0 | null | 2023-01-14T16:25:27.033 | 2023-01-14T16:25:27.033 | null | null | 10,789,207 | null |
75,119,469 | 2 | null | 75,119,402 | 1 | null | Well, the ImageView will work without `contentDescription` however, you probably should know what it is used for:
> Users of accessibility services, such as screen readers, rely on content labels to understand the meaning of elements in an interface.
In some cases, such as when information is conveyed graphically within an element, content labels can provide a text description of the meaning or action associated with the element.
If elements in a user interface don't provide content labels, it can be difficult for some users to understand the information presented to them or to perform actions in the interface.
So you probably should include one if you want your app to work on screen readers.
| null | CC BY-SA 4.0 | null | 2023-01-14T16:28:41.760 | 2023-01-14T16:28:41.760 | null | null | 15,749,574 | null |
75,119,581 | 2 | null | 69,733,638 | 0 | null | Just add 'cut':3 to kde_kws
for example, kde_kws = {"bw": 0.35,'cut': 3}
| null | CC BY-SA 4.0 | null | 2023-01-14T16:42:34.477 | 2023-01-14T16:42:34.477 | null | null | 12,981,372 | null |
75,119,623 | 2 | null | 75,110,212 | 0 | null | You could use the [bootstrap grid options](https://getbootstrap.com/docs/4.1/layout/grid/), i.e. each row is composed of twelve units which you can divide according to your liking, e.g.
```
---
title: Report of analyses
output:
html_document:
theme: yeti
---
<div class = "row">
<div class = "col-md-1">
{}
</div>
<div class = "col-md-11">
Department of Clinical Therapeutics,
<br> *Report author: Jane Doe, PharmD, PhD*
</div>
</div>
<div class = "row">
<div class = "col-md-8" style="padding-right:50px;">
*I want both these paragraphs 1.&2. to be wider, like 70% of the total width.*
### 1. Pathology interpretation
**Technical summary**: Lorem ipsum dolor sit amet
### 2. Case details and history
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
<div class = "col-md-4">
*I want this table to be more narrow to the right, like 30% of the total width.*
### 3. Information
```{r echo = FALSE}
library(kableExtra)
kbl(iris[1:10,])
```
[](https://i.stack.imgur.com/n1sEb.png)
---
Even simpler when you can switch to quarto, see here for quarto's [css grid](https://quarto.org/docs/output-formats/page-layout.html#css-grid).
| null | CC BY-SA 4.0 | null | 2023-01-14T16:47:22.040 | 2023-01-14T16:47:22.040 | null | null | 14,137,004 | null |
75,119,751 | 2 | null | 75,119,508 | 0 | null | I copied the entire 33.0.1 to 33.0.0 and it seems to work idk why
| null | CC BY-SA 4.0 | null | 2023-01-14T17:04:41.583 | 2023-01-14T17:04:41.583 | null | null | 11,488,820 | null |
75,119,901 | 2 | null | 71,674,803 | 0 | null | Using DvdRom answer, I fixed this issue with Javascript and CSS variable to get a 1px border-spacing.
Looks like it's working on Firefox, Chrome, Edge, Opera and Brave.
```
let cssRoot = document.querySelector(':root');
cssRoot.style.setProperty
(
'--table-border-spacing',
`${1 / window.devicePixelRatio}px`
);
```
```
:root {
--table-border-spacing: 1px;
}
table {
border-collapse: separate;
border-spacing: var(--table-border-spacing);
}
```
| null | CC BY-SA 4.0 | null | 2023-01-14T17:23:50.843 | 2023-01-14T17:23:50.843 | null | null | 2,573,194 | null |
75,120,193 | 2 | null | 75,120,156 | 1 | null | I believe you're referring to the setting for:
This can be found in `Tools\Options\Projects and Solutions\Build and Run`:
[](https://i.stack.imgur.com/khI54.png)
| null | CC BY-SA 4.0 | null | 2023-01-14T18:07:03.230 | 2023-01-14T18:07:03.230 | null | null | 5,438,626 | null |
75,120,342 | 2 | null | 75,110,529 | 0 | null | To adjust cell spacing in HTML tables you can play mostly with two properties:
- `border-spacing`- `padding``td`
```
table {
background: #333;
color: #fff;
padding: 10px;
border-spacing: 5px;
border-radius: 10px;
}
tr:not(:first-child) td {
padding-top: 20px;
}
```
```
<table>
<tr>
<td>1</td>
<td>command1</td>
<td>image1</td>
</tr>
<tr>
<td>2</td>
<td>command2</td>
<td>image2</td>
</tr>
<tr>
<td>3</td>
<td>command3</td>
<td>image3</td>
</tr>
</table>
```
| null | CC BY-SA 4.0 | null | 2023-01-14T18:27:48.627 | 2023-01-14T18:27:48.627 | null | null | 16,529,391 | null |
75,120,419 | 2 | null | 75,119,736 | 1 | null | The desired element is within an [iframe](https://stackoverflow.com/a/53276478/7429447) so first you have to induce [WebDriverWait](https://stackoverflow.com/a/52607451/7429447) for the [frameToBeAvailableAndSwitchToIt](https://stackoverflow.com/a/63831871/7429447) as follows:
```
WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe.embedded-electron-webview.embedded-page-content")))
driver.execute_script('document.querySelector(".ck-placeholder").innerHTML = "TEST";')
```
: You have to add the following imports :
```
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
```
| null | CC BY-SA 4.0 | null | 2023-01-14T18:41:03.803 | 2023-01-14T18:41:03.803 | null | null | 7,429,447 | null |
75,120,616 | 2 | null | 75,119,697 | 1 | null | The issue is with your if condition in your template. You are getting your employees data with for loop and using variable emp not venue. Use this if condition and your image url will be displayed
```
{% if emp.venue_image %}
{{emp.venue_image.url}}
{% endif %}
```
If you want to display the image you need to use image tag like this
```
{% if emp.venue_image %}
<img src="{{emp.venue_image.url}}">
{% endif %}
```
| null | CC BY-SA 4.0 | null | 2023-01-14T19:15:41.737 | 2023-01-14T19:15:41.737 | null | null | 13,992,590 | null |
75,120,818 | 2 | null | 75,120,402 | 0 | null | [](https://i.stack.imgur.com/ORMTR.jpg)
- - -
```
import 'package:flutter/material.dart';
class MyWidget extends StatefulWidget {
const MyWidget({super.key});
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
List<Team> dataList = [
Team(id_pes: '1', amount: '10', paid_date: DateTime.now()),
Team(id_pes: '2', amount: '20', paid_date: DateTime.now()),
Team(id_pes: '3', amount: '30', paid_date: DateTime.now()),
Team(id_pes: '4', amount: '40', paid_date: DateTime.now()),
Team(id_pes: '5', amount: '50', paid_date: DateTime.now()),
Team(id_pes: '6', amount: '60', paid_date: DateTime.now()),
];
Widget _buildListItem(int index) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
height: 80,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
),
color: Colors.grey[50],
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Checkbox(
checkColor: Colors.white,
value: dataList[index].isChecked ?? false,
onChanged: (bool? value) {
setState(() {
dataList[index].isChecked = value;
});
print(value);
},
),
Text(
'GHS ' + dataList[index].amount,
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
var checkedList = dataList.where((data) => data.isChecked ?? false);
var totalAmount = checkedList.isNotEmpty
? 'TotalAmount:${checkedList.reduce((before, after) => Team(amount: '${double.parse(before.amount) + double.parse(after.amount)}', id_pes: '_', paid_date: DateTime.now())).amount} '
: '';
return Scaffold(
body: ListView.builder(
shrinkWrap: true,
itemCount: dataList.length,
itemBuilder: (context, index) {
return Tooltip(
message: totalAmount, child: _buildListItem(index));
}));
}
}
class Team {
final String id_pes;
final String amount;
final DateTime paid_date;
bool? isChecked;
Team({
required this.id_pes,
required this.amount,
required this.paid_date,
this.isChecked,
});
}
```
| null | CC BY-SA 4.0 | null | 2023-01-14T19:52:11.137 | 2023-01-14T20:05:16.377 | 2023-01-14T20:05:16.377 | 9,251,541 | 9,251,541 | null |
75,121,058 | 2 | null | 75,119,837 | 0 | null | Both `.toolbar` and `.searchable` find the nearest enclosing `NavigationView` automatically. You do not need a `NavigationView` in your list view.
Here's a self-contained demo. It looks like this:
[](https://i.stack.imgur.com/wPYug.gif)
Here's the code:
```
import SwiftUI
import PlaygroundSupport
struct HomeScreen: View {
var body: some View {
NavigationView {
List {
NavigationLink("Cheese Map") { Text("Map") }
NavigationLink("Cheese List") { ListView() }
}
.navigationTitle("Home Screen")
}
.navigationViewStyle(.stack)
}
}
struct ListView: View {
@State var items = ["Cheddar", "Swiss", "Edam"]
@State var search: String = ""
var filteredItems: [String] {
return items.filter {
search.isEmpty
|| $0.localizedCaseInsensitiveContains(search)
}
}
var body: some View {
List(filteredItems, id: \.self) {
Text($0)
}
.searchable(text: $search)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button {
withAnimation {
items.append("Gouda")
}
} label: {
Label("Add Item", systemImage: "plus")
}
.disabled(items.contains("Gouda"))
}
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Menu("Sort") {
Button("Ascending") {
withAnimation {
items.sort()
}
}
Button("Descending") {
withAnimation {
items.sort()
items.reverse()
}
}
}
}
}
.navigationTitle("Cheese List")
}
}
PlaygroundPage.current.setLiveView(HomeScreen())
```
| null | CC BY-SA 4.0 | null | 2023-01-14T20:36:47.573 | 2023-01-14T20:36:47.573 | null | null | 77,567 | null |
75,121,084 | 2 | null | 75,120,179 | 1 | null | Here's one possible solution which creates a new "alpha" legend, labels it, then overrides the display to make it look like "no data = grey":
```
library(ggplot2)
library(ggmap)
library(ggthemes)
library(gapminder)
library(dplyr)
world <- map_data("world")
world |> left_join(gapminder |>
filter(year == 2007),
by = c("region" = "country")) |>
ggplot(aes(long, lat, group = group, alpha = "No data")) +
geom_polygon(aes(fill = gdpPercap), colour = "white") +
scale_fill_viridis_b(breaks = c(0, 1000, 2000, 5000, 10000, 20000, 50000),
na.value = "grey") +
labs(fill = "GDP per \ncapita ",
title = "GDP per capita in 21st century",
na.value = "No data") + theme_map() +
scale_alpha_manual("", values = 1) +
guides(
fill = guide_colorsteps(order = 1),
alpha = guide_legend(order = 2, override.aes = list(fill = "grey"))
)
```

| null | CC BY-SA 4.0 | null | 2023-01-14T20:40:29.390 | 2023-01-14T20:40:29.390 | null | null | 10,744,082 | null |
75,121,250 | 2 | null | 75,115,767 | 0 | null | You could add a label to the line keywords to make the line automatically appear into the legend. The code could also be simplified a little bit without resetting the index and using the index as `x=`.
The following code uses seaborn's flights dataset for easy reproducibility:
```
from matplotlib import pyplot as plt
import seaborn as sns
df = sns.load_dataset('flights')
df_pivot = df.pivot(index='year', columns='month', values='passengers')
df_pivot = df_pivot[['Mar', 'Jun', 'Sep', 'Dec']] # take only 4 months for a simpler example
df_pivot = df_pivot.fillna(0)
fig, ax = plt.subplots(figsize=(12, 7))
for col in df_pivot.columns:
sns.regplot(ax=ax, data=df_pivot, x=df_pivot.index, y=col, line_kws={'label': col})
ax.legend(bbox_to_anchor=(0.5, -0.1), fancybox=True, loc='upper center', shadow=True, ncol=2)
plt.tight_layout()
plt.show()
```
[](https://i.stack.imgur.com/NuMar.png)
If you want both the line and the marker, you can add two labels per `regplot`. With `ax.get_legend_handles_labels()` you can fetch all the andles and labels to be put into the legend. And then combine them as tuples.
```
fig, ax = plt.subplots(figsize=(12, 7))
for col in df_pivot.columns:
sns.regplot(ax=ax, data=df_pivot, x=df_pivot.index, y=col, label=col, line_kws={'label': col})
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles=[(h1, h2) for h1, h2 in zip(handles[::2], handles[1::2])],
labels=labels[::2],
bbox_to_anchor=(0.5, -0.1), fancybox=True, loc='upper center', shadow=True, ncol=2)
```
[](https://i.stack.imgur.com/MkeTZ.png)
| null | CC BY-SA 4.0 | null | 2023-01-14T21:08:06.140 | 2023-01-14T21:25:59.880 | 2023-01-14T21:25:59.880 | 12,046,409 | 12,046,409 | null |
75,121,396 | 2 | null | 75,121,207 | 0 | null | It seems so me, that you compare `false` value with `== "false"` and so with `true` is a problem, as i remember JQuery gives you here real boolean automatically after data-attr reading
| null | CC BY-SA 4.0 | null | 2023-01-14T21:32:44.933 | 2023-01-14T21:32:44.933 | null | null | 19,100,691 | null |
75,121,605 | 2 | null | 75,120,367 | 1 | null | This is caused by the non-determined order in which a set is iterated. And this impacts in which order `for i in adj[node]` is iterating.
For the example input you provided, the following edges are defined that relate to the letter "a" (which is the first letter for which the DFS search is performed):
```
r βββ c
β
a βββ o βββ e
β
s
```
The adjacency set for "a" has only one entry ("o") so no surprises there, but "o" has two neighbors, and "e" three, ...etc. The order affects the result.
Let's assume this order (adding assignments to `map` keys as they occur):
```
DFSMap("a")
DFSMap("o")
DFSMap("a")
map["o"] = "a"
DFSMap("e")
DFSMap("r")
DFSMap("e")
map["r"] = "e"
DFSMap("c")
DFSMap("r")
map["c"] = "c"
map["r"] = "c"
map["e"] = "c"
DFSMap("s")
DFSMap("e")
map["s"] = "c"
map["e"] = "c"
DFSMap("o")
map["e"] = "a"
map["o"] = "a"
map["a"] = "a"
```
Note how not all "nodes" in this connected component get associated with the value "a". In this particular traversal, the letters "c", "r" and "s" remain associated with "c", instead of "a". In another order of traversal the anomalies could be elsewhere.
The random results illustrate that the algorithm is not correct. Typically when the lexical minimum letter is visited first before lots of other connected nodes, the results will incorrect, as this least letter is not propagated to nodes that are further away.
Here is a correction of your dfs-code. It takes an extra `least` argument to allow for that propagation:
```
def DFSMap(self, node, mp, adj, visited, least="z"):
least = min(least, mp[node] or node)
if node not in visited:
visited.add(node)
for i in adj[node]:
least = self.DFSMap(i, mp, adj, visited, least)
mp[node] = least
return least
```
NB: renamed `map` to `mp`, as the first is already used by Python for a native function.
NB: This algorithm relies on the fact that the main loop in `smallestEquivalentString` visits the letters in lexical order (which is the case), so that the first visited letter in a connected component is also the in that component.
| null | CC BY-SA 4.0 | null | 2023-01-14T22:12:13.427 | 2023-01-14T22:21:40.763 | 2023-01-14T22:21:40.763 | 5,459,839 | 5,459,839 | null |
75,121,735 | 2 | null | 75,102,511 | 1 | null | You can use a combination of JSON functions, and array functions to manipulate this kind of data.
[JSON_EXTRACT_ARRAY](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_extract_array) can convert the JSON formatted string into an array, [UNNEST](https://cloud.google.com/bigquery/docs/reference/standard-sql/arrays#flattening_arrays) then can make each entry into rows, and finally [JSON_EXTRACT_SCALAR](https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions#json_extract_scalar) can pull out individual columns.
So here's an example of what I think you're trying to accomplish:
```
with sampledata as (
select """[{"id":"63bddc8cfe21ec002d26b7f4","description":"General Admission", "src_currency":"USD","src_price":50.0,"src_fee":0.0,"src_commission":1.79,"src_discount":0.0,"applicable_pass_id":null,"seats_label":null,"seats_section_label":null,"seats_parent_type":null,"seats_parent_label":null,"seats_self_type":null,"seats_self_label":null,"rate_type":"Rate","option_name":null,"price_level_id":null,"src_discount_price":50.0,"rate_id":"636d6d5cea8c6000222c640d","cost_item_id":"63bddc8cfe21ec002d26b7f4"},{"id":"63bddc8cfe21ec002d26b7f4","description":"General Admission", "src_currency":"USD","src_price":50.0,"src_fee":0.0,"src_commission":1.79,"src_discount":0.0,"applicable_pass_id":null,"seats_label":null,"seats_section_label":null,"seats_parent_type":null,"seats_parent_label":null,"seats_self_type":null,"seats_self_label":null,"rate_type":"Rate","option_name":null,"price_level_id":null,"src_discount_price":50.0,"rate_id":"636d6d5cea8c6000222c640d","cost_item_id":"63bddc8cfe21ec002d26b7f4"}]""" as my_json_string
)
select JSON_EXTRACT_SCALAR(f,'$.id') as id, JSON_EXTRACT_SCALAR(f,'$.rate_type') as rate_type, JSON_EXTRACT_SCALAR(f,'$.cost_item_id') as cost_item_id
from sampledata, UNNEST(JSON_EXTRACT_ARRAY(my_json_string)) as f
```
Which creates rows with specific columns from that data, like this:
[](https://i.stack.imgur.com/wRG8T.png)
| null | CC BY-SA 4.0 | null | 2023-01-14T22:40:27.727 | 2023-01-14T22:40:27.727 | null | null | 1,196,131 | null |
75,121,824 | 2 | null | 75,121,207 | 0 | null | Matheus, I meant - your problem is that you only handle the behavior on click and not anywhere else, so while first opening the site there's no click, and data-attr is true by default, so you need to set it to false at the beginning.
[](https://i.stack.imgur.com/Z5g42.png)
| null | CC BY-SA 4.0 | null | 2023-01-14T22:57:32.380 | 2023-01-14T22:57:32.380 | null | null | 19,100,691 | null |
75,123,038 | 2 | null | 44,531,177 | 0 | null | The error is on line 11:
```
If ActiveSheet.Cells(i, "A") = (Me.ComboBox1) Then
```
It should be:
```
If ActiveSheet.Cells(i, "A").Value = Me.ComboBox1.Value Then
```
| null | CC BY-SA 4.0 | null | 2023-01-15T05:01:41.877 | 2023-01-16T19:15:06.083 | 2023-01-16T19:15:06.083 | 8,352,445 | 7,536,283 | null |
75,123,137 | 2 | null | 74,637,706 | 0 | null | Actually I have the same problem and I found out that unfortunately it is hardcoded. The only thing you can do is overwrite url to display something else or to just be empty.
```
@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI config() {
return new OpenAPI()
.addServersItem(serverInfo());
}
private Server serverInfo() {
return new Server()
.url("");
}
}
```
| null | CC BY-SA 4.0 | null | 2023-01-15T05:31:10.053 | 2023-01-15T05:31:10.053 | null | null | 18,804,543 | null |
75,123,171 | 2 | null | 75,114,895 | 0 | null | Use this HTML:
```
<body>
<div id="all">
<img src="your-image.jpg" alt="image" height="200" width="200">
</div>
</body>
```
With this CSS:
```
body{
padding: 0;
margin: 0;
background-image: url(your-image.jpg);
background-repeat: no-repeat;
background-size: cover;
}
#all{
margin: 0;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.85);
backdrop-filter: blur(10px);
}
```
Now, all the new HTML MUST go inside the `<div>` with id `#all`.
| null | CC BY-SA 4.0 | null | 2023-01-15T05:40:03.277 | 2023-01-15T05:40:03.277 | null | null | 20,286,394 | null |
75,123,284 | 2 | null | 75,122,352 | 2 | null | All you need is square brackets around the style attribute, same as you did for class attribute
```
cy.get('div[class="table-wrap"]')
.not('[style="display: none;"]')
.contains('element_to_selected_inside_This_div')
.should('have.length', 1) // only one is selected
```
| null | CC BY-SA 4.0 | null | 2023-01-15T06:16:06.837 | 2023-01-15T06:16:06.837 | null | null | 21,010,970 | null |
75,123,371 | 2 | null | 75,123,191 | 1 | null | You have to convert `Date` column as `DatetimeIndex`:
```
fb = pd.read_csv('META.csv', index_col='Date', parses_dates=['Date'])
```
Index as datetime:
[](https://i.stack.imgur.com/swfoQ.png)
Index as string:
[](https://i.stack.imgur.com/gyjcl.png)
Demonstration:
[](https://i.stack.imgur.com/uQ6zT.png)
| null | CC BY-SA 4.0 | null | 2023-01-15T06:38:55.020 | 2023-01-15T06:38:55.020 | null | null | 15,239,951 | null |
75,123,497 | 2 | null | 75,122,671 | 0 | null | Here are 3 options:
1. Don't parse it and treat it as a string.
2. Use ToString("N") when you need a version with no dashes.
3. Save it in the database as a Guid (uniqueidentifier in SQL Server), not a string; then the code and the database can use a 'real' guid type, not a string shortcut.
| null | CC BY-SA 4.0 | null | 2023-01-15T07:11:40.463 | 2023-01-15T07:11:40.463 | null | null | 581,076 | null |
75,123,540 | 2 | null | 75,123,079 | 1 | null | You can calculate device height depending on .
For calculating, library is needed.
[https://pub.dev/packages/device_info_plus](https://pub.dev/packages/device_info_plus)
With this library, you can check real device height.
That is `displayMetrics.heightPx` of `AndroidDeviceInfo`.
And then you can calculate the `androidNavHeight`.
```
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
final screenHeight = MediaQuery.of(context).size.height;
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
final AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
final deviceHeight = androidInfo.displayMetrics.heightPx;
final androidNavHeight = deviceHeight / devicePixelRatio - screenHeight;
```
If navigation style is , the `androidNavHeight` will be 48.
Else if navigation style is , the result will be around 14.857....
| null | CC BY-SA 4.0 | null | 2023-01-15T07:21:53.820 | 2023-01-15T08:02:08.157 | 2023-01-15T08:02:08.157 | 10,702,091 | 10,702,091 | null |
75,123,797 | 2 | null | 72,461,858 | 0 | null | The new usergroup `newUserGroup` should be given a read access (or even a write access if required) to the `productCatalogVersion` in which the members of that group will be able to view (read) the products details of that catalog version (Staged or Online, etc ..)
Here is an example of impex to give `newUserGroup` read access and write access to `XYZ_ProductCatalog`
```
INSERT_UPDATE CatalogVersion; catalog(id)[unique = true]; version[unique = true]; readPrincipals(uid)[mode = append]; writePrincipals(uid)[mode = append]
; XYZ_ProductCatalog ; Staged ; newUserGroupUID ; newUserGroupUID
; XYZ_ProductCatalog ; Online ; newUserGroupUID ; newUserGroupUID
```
You may modify the above impex to suit your use case.
| null | CC BY-SA 4.0 | null | 2023-01-15T08:24:14.700 | 2023-01-15T08:24:14.700 | null | null | 7,100,452 | null |
75,123,827 | 2 | null | 26,606,280 | 0 | null | I had a whole load of these errors in one project.
Eventually I found that the project did not have a reference to `System.Xaml`.
Adding a reference to `System.Xaml` removed all of the warnings.
The strange thing is that it didn't cause a runtime problem.
| null | CC BY-SA 4.0 | null | 2023-01-15T08:32:07.250 | 2023-01-15T08:32:07.250 | null | null | 1,626,109 | null |
75,123,873 | 2 | null | 75,123,851 | 0 | null | It seems like you're encountering a problem when trying to add a Entity Framework data model (database first) to your project. The warning you're seeing may be related to the version of Entity Framework that you're using, or it could be caused by an issue with your Visual Studio installation.Try updating your visual studio and entity framework to the latest version, if you haven't already.
| null | CC BY-SA 4.0 | null | 2023-01-15T08:42:17.287 | 2023-01-15T08:42:17.287 | null | null | 20,348,144 | null |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.