Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
⌀ | ParentId
int64 1.68k
75.6M
⌀ | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
⌀ | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
⌀ | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 1
21.3M
⌀ | Tags
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
74,925,265 | 2 | null | 74,922,268 | 0 | null | The correct code would be:
```
const ids = response.results.map(e -> e.restaurant_id)
```
| null | CC BY-SA 4.0 | null | 2022-12-27T02:20:58.653 | 2022-12-27T02:20:58.653 | null | null | 7,574,461 | null |
74,925,281 | 2 | null | 74,918,389 | 0 | null | missing css file? You may go to `CSS` blade to see the details. Opening F12 window then refresh your page.
[](https://i.stack.imgur.com/NlBwZ.gif)
| null | CC BY-SA 4.0 | null | 2022-12-27T02:26:28.677 | 2022-12-27T02:26:28.677 | null | null | 14,574,199 | null |
74,925,373 | 2 | null | 74,925,079 | 0 | null | You can do it simply by remove the `lowest` class from all inputs before doing anything in the function, and then determine the new lowest to give it the class, and this is the simple but big way.
---
To take a short and clear way, just do that:
```
function findLowest() {
var inputs = [...document.querySelectorAll("input[type=number]")]
let values = inputs.map(input => input.value)
var lowest = Math.min(...values)
inputs.forEach(input => {
input.classList[ input.value == lowest ? "add" : "remove" ]("lowest")
})
}
```
```
.lowest { color: red; }
input:not(.lowest) { color: black; }
```
```
<form>
<label for="value1">Value 1:</label><br>
<input type="number" id="value1" name="value1" oninput="findLowest()"><br>
<br>
<label for="value2">Value 2:</label><br>
<input type="number" id="value2" name="value2" oninput="findLowest()"><br>
<br>
<label for="value3">Value 3:</label><br>
<input type="number" id="value3" name="value3" oninput="findLowest()"><br>
<label for="value4">Value 4 => "text":</label><br>
<input type="text" id="value4" name="value4"><br>
</form>
```
We're getting the inputs as an array, then get the values of the inputs with the `map` method, then get the lowest value with `Math.min` method, and finally loop over all inputs using the `forEach` method, and conditionally choose to add or remove the `lowest` class from the input that has the lowest value.
| null | CC BY-SA 4.0 | null | 2022-12-27T02:56:46.820 | 2022-12-27T17:39:49.463 | 2022-12-27T17:39:49.463 | 20,708,566 | 20,708,566 | null |
74,925,427 | 2 | null | 74,925,079 | 0 | null | maybe that ?
Use:
A- `.valueAsNumber` to get a `input[type=number]` number value ( not a string)
B- `classList.toggle` with it force boolean argument
C- event `input` directly on the `form` (not on each element)
```
const
myForm = document.forms['my-form']
, inNums = [...myForm.querySelectorAll('input[type=number]')]
;
myForm.oninput = event =>
{
let min = inNums.reduce((min,el)=>Math.min(el.valueAsNumber, min), Infinity);
inNums.forEach( el => el.classList.toggle('lowest', el.value == min));
}
```
```
body {
font-family : Arial, Helvetica, sans-serif;
font-size : 16px;
}
.lowest {
color : red;
}
label, input {
display : block;
}
label {
font-size : .8rem;
margin : .8rem
}
input {
font-size : 1rem;
padding : 0 0 0 0.5em;
width : 6rem;
}
```
```
<form name="my-form">
<label>Value 1:
<input type="number" name="value1" value="0" >
</label>
<label>Value 2:
<input type="number" name="value2" value="0">
</label>
<label>Value 3:
<input type="number" name="value3" value="0">
</label>
</form>
```
| null | CC BY-SA 4.0 | null | 2022-12-27T03:12:23.007 | 2022-12-27T03:33:07.493 | 2022-12-27T03:33:07.493 | 10,669,010 | 10,669,010 | null |
74,925,796 | 2 | null | 74,925,608 | 0 | null | Run the query like this:
```
def place_order(request, total=0, quantity=0,):
current_user = request.user
#if cartr count is less than or = 0 then redirect back to shop
cart_items = Cart_item.objects.filter(user=current_user)
cart_count = cart_items.count()
if cart_count <= 0 :
return redirect('store')
grand_total = 0
tax = 0
for cart_item in cart_items:
total += (cart_item.product.price * cart_item.quantity)
quantity += cart_item.quantity
tax = (2 * total)/100
context = {
'cart_items' :cart_items,
'total' :total,
'tax' :tax,
'grand_total' :grand_total,
}
```
and url pattern:
```
path('place_order/', views.place_order, name='place_order')
```
| null | CC BY-SA 4.0 | null | 2022-12-27T04:50:30.833 | 2022-12-31T05:06:54.613 | 2022-12-31T05:06:54.613 | 2,847,330 | 20,719,804 | null |
74,925,949 | 2 | null | 74,922,800 | 0 | null | Modify the font through `editor: Font Family` in the
[](https://i.stack.imgur.com/cFWHE.png)
or add the following configuration in .
```
"editor.fontFamily": "Ink Free,Consolas, 'Courier New', monospace",
```
[](https://i.stack.imgur.com/67zOG.png)
| null | CC BY-SA 4.0 | null | 2022-12-27T05:28:11.763 | 2022-12-27T05:28:11.763 | null | null | 19,133,920 | null |
74,926,201 | 2 | null | 20,937,475 | 2 | null | ```
datalist::-webkit-calendar-picker-indicator {
display: none;
opacity: 0;
}
```
It is okay but this css code will hide any calander on page.
Like I'm using datepicker calender and this will also hide the controls including datalist and datetime picker.
| null | CC BY-SA 4.0 | null | 2022-12-27T06:12:45.007 | 2022-12-27T06:12:45.007 | null | null | 13,204,433 | null |
74,926,331 | 2 | null | 74,926,178 | 0 | null | Based on the discussion in this github [issue](https://github.com/stripe/stripe-react-native/issues/1212). It looks like you need to use an older version of xcode to avoid this error.
| null | CC BY-SA 4.0 | null | 2022-12-27T06:34:12.073 | 2022-12-27T06:34:12.073 | null | null | 333,638 | null |
74,926,356 | 2 | null | 74,851,903 | 0 | null | Try this
```
npm uninstall -g expo-cli
```
and `npm start` again.
| null | CC BY-SA 4.0 | null | 2022-12-27T06:38:15.147 | 2022-12-27T06:38:15.147 | null | null | 13,646,752 | null |
74,926,523 | 2 | null | 74,922,643 | 0 | null | Did you using DataGrid component?
Try this:
```
<DataGrid columns={[...columns, { field: 'total', sortable: false }]} />
```
| null | CC BY-SA 4.0 | null | 2022-12-27T07:02:56.350 | 2022-12-27T07:02:56.350 | null | null | 13,646,752 | null |
74,926,520 | 2 | null | 74,925,028 | 0 | null | First thing that is wrong in your code is that you did not inject in ConfigureServices :
```
services.AddScoped<IUsuariosService, UsuariosService>();
```
and the second point you have to care about is that, you did not use the interface in your service layer, base on Dependency Inversion Principle classes should depend upon interfaces so we have to use interfaces instead of UsuariosRepo class.
```
private readonly IUsuariosRepo _repository;
public UsuariosService(IUsuariosRepo repository)
{
_repository = repository;
}
```
| null | CC BY-SA 4.0 | null | 2022-12-27T07:02:42.503 | 2022-12-27T07:02:42.503 | null | null | 5,059,088 | null |
74,926,809 | 2 | null | 74,926,617 | 0 | null | You can first re-install your VS code to remove this error and then go to terminal integration settings and select node.js there.
| null | CC BY-SA 4.0 | null | 2022-12-27T07:46:37.117 | 2022-12-27T07:46:37.117 | null | null | 20,400,930 | null |
74,926,928 | 2 | null | 74,818,962 | 0 | null | Here are the problems
- First, you are trying to display the image using a Label widget, but you are not actually adding the Label widget to the window. You can fix this by using the pack() method to add the Label widget to the window.- Second, you are trying to set the image attribute of the Label widget to an ImageTk.PhotoImage object, but you are not actually creating an ImageTk.PhotoImage object. Instead, you are trying to pass an Image object to the PhotoImage constructor.
To fix this, you can create an ImageTk.PhotoImage object by passing the Image object to the PhotoImage constructor as follows:```
image = PIL.Image.open(r"tree.jpg").resize((50,50))
image = ImageTk.PhotoImage(image)
test = Label(self, image=image)
test.pack()
```
| null | CC BY-SA 4.0 | null | 2022-12-27T08:01:39.067 | 2022-12-27T08:01:39.067 | null | null | 17,435,885 | null |
74,926,962 | 2 | null | 74,925,618 | 0 | null | To center your containers, just remove position absolute and use flex property.
Using flexbox you don't need to use 2 differents class to center elements.
```
function displayTime(){
var dateTime = new Date();
var hrs = dateTime.getHours();
var min = dateTime.getMinutes();
if (hrs > 12){
hrs = hrs -12
}
if (hrs > 12){
hrs = hrs -12
}
if (hrs < 10){
hrs = "0" + hrs
}
if (min < 10){
min = "0" + min
}
document.getElementById('hours').innerHTML = hrs;
document.getElementById('minutes').innerHTML = min;
}
setInterval(displayTime, 10);
var width = screen.width;
var height = screen.height;
```
```
@font-face{
font-family: myfont;
src:url(productsans.ttf);
}
body{
margin: 0%;
padding: 0%;
background-color: black;
}
span{
display: flex;
justify-content: center;
height: 449px;
width: 449px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.container{
font-family: 'myfont';
color: #fff;
display: flex;
justify-content: center;
/*position: absolute; REMOVE
top: 36%;
left: 28%;
transform: translate(-100%, -50%);*/
font-size: 370px;
}
/*.container1{
display: flex;
justify-content: center;
font-family: 'myfont';
color: #fff;
position: absolute; REMOVE
top: 64%;
left: 28%;
transform: translate(-100%, -50%);
font-size: 370px;
}*/
```
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Android 12 Digital Clock</title>
<script src="script.js" defer></script>
<link rel="stylesheet" href="style.css"
</head>
<body>
<div class="container">
<span id="hours"></span>
</div>
<div class="container">
<span id="minutes"></span>
</div>
</body>
</html>
```
| null | CC BY-SA 4.0 | null | 2022-12-27T08:06:52.567 | 2022-12-27T08:06:52.567 | null | null | 6,592,881 | null |
74,926,995 | 2 | null | 72,090,665 | 0 | null | About your issue of the browser returning even after putting in your `phrase` which I know prevents you from getting the results (because I am following the same book) is probably emanating from the `vsearch.py` file. Did you ensure you use `return` statement in the `def search4vowels` and `def search4letters` functions?
Also make sure the `vsearch.py` was properly saved as a sdist file
| null | CC BY-SA 4.0 | null | 2022-12-27T08:12:00.230 | 2022-12-27T08:12:00.230 | null | null | 10,202,927 | null |
74,927,241 | 2 | null | 74,925,677 | 1 | null | I found the answer. Use example:
```
{
"command": "extension.command",
"group": "6_copypath@5"
}
```
| null | CC BY-SA 4.0 | null | 2022-12-27T08:43:25.733 | 2022-12-28T16:59:11.627 | 2022-12-28T16:59:11.627 | 19,573,373 | 19,573,373 | null |
74,927,285 | 2 | null | 74,852,609 | 0 | null | I have reproduced in my environment and got expected results as below in google Collab:
```
This is <font color='red'> red </font>
<mark style="background-color: lightblue">Rithwik</mark>
```

AFAIK, I couldn't find any Official Documentation on Markdown (Highlighting words) and this feature is not supported in Databricks by my understanding and i would suggest you raise a feature request.
| null | CC BY-SA 4.0 | null | 2022-12-27T08:47:36.683 | 2022-12-27T08:47:36.683 | null | null | 17,623,802 | null |
74,927,347 | 2 | null | 27,695,749 | 0 | null | ```
static async makeBody(to, subject, message) {
const str = ["Content-Type: text/plain; charset=\"UTF-8\"\n",
"MIME-Version: 1.0\n",
"Content-Transfer-Encoding: 7bit\n",
"to: ", to, "\n",
`Subject: =?UTF-8?B?${Buffer.from(subject).toString('base64')}?=\n\n`,
message
].join('');
return Buffer(str).toString("base64").replace(/\+/g, '-').replace(/\//g, '_');
}
```
| null | CC BY-SA 4.0 | null | 2022-12-27T08:55:11.857 | 2022-12-27T08:55:11.857 | null | null | 9,055,645 | null |
74,927,405 | 2 | null | 74,917,393 | 0 | null | The problem in your code lies in the fact that you're having an incorrect setter:
```
public void setOvScore(int ovScore){this.ovScore=ovScore;}
```
The argument is of type int and not double, hence that behavior. To solve this you have to change the type of the argument from int to double:
```
public void setOvScore(double ovScore){this.ovScore=ovScore;}
//
```
| null | CC BY-SA 4.0 | null | 2022-12-27T09:01:31.543 | 2022-12-27T09:01:31.543 | null | null | 5,246,885 | null |
74,927,460 | 2 | null | 74,926,933 | 0 | null | > print one report by
In that case, try to
- - - -
| null | CC BY-SA 4.0 | null | 2022-12-27T09:09:40.767 | 2022-12-27T09:09:40.767 | null | null | 9,097,906 | null |
74,927,574 | 2 | null | 73,348,089 | 0 | null | You need to go to Android Studio Settings > View > Appearance and click on the toolbar.
[](https://i.stack.imgur.com/uU3Zh.png)
| null | CC BY-SA 4.0 | null | 2022-12-27T09:23:44.617 | 2023-01-04T03:44:50.470 | 2023-01-04T03:44:50.470 | 16,124,033 | 20,870,535 | null |
74,927,587 | 2 | null | 31,503,674 | 0 | null | In my case, this issue happens because of a proxy that also responds to the header `Transfer-Encoding`, and my server forwards all the headers to the client side. Removing `Transfer-Encoding` fixed the issue for me.
This has also address here: [rfc9112#name-transfer-encoding](https://www.rfc-editor.org/rfc/rfc9112#name-transfer-encoding)
```
HttpHeaders headers = new HttpHeaders();
proxyResonse.getHeaders().forEach((key, value) -> {
if (!key.equals(HttpHeaders.TRANSFER_ENCODING)) {
headers.addAll(key, value);
}
});
// add `headers` to client response
```
| null | CC BY-SA 4.0 | null | 2022-12-27T09:24:52.927 | 2022-12-27T09:24:52.927 | null | null | 5,984,642 | null |
74,927,989 | 2 | null | 74,927,988 | 0 | null | It seems like the correct solution is to use a collection of anonymous types to build tables.
The following code:
```
DateOnly dateOnlyNow = DateOnly.FromDateTime(DateTime.Now);
var output = new[] {
new { method = "ToString()", value = dateOnlyNow.ToString() },
new { method = "ToString(DD.MM.YYYY)", value = dateOnlyNow.ToString("DD.MM.YYYY") },
new { method = "ToString(dd.MM.yyyy)", value = dateOnlyNow.ToString("dd.MM.yyyy") },
};
output.Dump();
```
produces the expected result:

| null | CC BY-SA 4.0 | null | 2022-12-27T10:07:31.457 | 2022-12-27T10:07:31.457 | null | null | 2,900,278 | null |
74,927,990 | 2 | null | 74,925,001 | 0 | null | [](https://i.stack.imgur.com/Za532.png)
i make this for my project, i made it simple for you, you can customize, this is the basic idea:
```
class MyList<T> extends StatelessWidget {
final List<T> listModel;
final double? cacheExtent;
final Widget Function(BuildContext, int index) listBuilder;
final List<Widget? Function(T listValue)> separatorsBuilder;
const MyList({Key? key,required this.listModel, required this.listBuilder, required this.separatorsBuilder, this.cacheExtent}) : super(key: key);
@override
Widget build(BuildContext context) {
final childreen = _buildChildreen(context);
return ListView.builder(
cacheExtent: cacheExtent,
itemCount: childreen.length,
itemBuilder: (context, index){
return childreen[index];
});
}
List<Widget> _buildChildreen(BuildContext context){
List<T> remain = List.from(listModel);
List<Widget> result = [];
int separatorCount = 0;
for (var separator in separatorsBuilder){
bool separatorUsed = false;
while(remain.isNotEmpty){
if(separator(remain.first) != null){
if(!separatorUsed){
result.add(separator(remain.first)!);
separatorUsed = true;
separatorCount++;
}
final index = result.length - separatorCount;
result.add(listBuilder(context, index));
remain.removeAt(0);
}
else {
break;
}
}
}
return result;
}
}
```
The list i use in example :
```
final now = DateTime.now();
List<MyModel> myModel = [
MyModel(message: 'hello, yesterday', dateTime: now.subtract(const Duration(days: 1))),
MyModel(message: 'hello, this from yesterday', dateTime: now.subtract(const Duration(days: 1))),
MyModel(message: 'hello, this me yesterday', dateTime: now.subtract(const Duration(days: 1))),
MyModel(message: 'yes, this is now', dateTime: now),
MyModel(message: 'sure this message is today', dateTime: now),
MyModel(message: 'this message sent today', dateTime: now),
];
```
use it like this in widget tree:
```
MyList<MyModel>(
listModel: myModel,
listBuilder: (context, index) {
return ListTile(
title: Text(myModel[index].message),
);
},
separatorsBuilder: [
(data) {
if (data.dateTime.isYesterday()) {
return Container(color: Colors.blue,child: const Text("Yesterday"));
}
return null;
},
(data) {
if (data.dateTime.isToday()) {
return Container(color: Colors.blue,child: const Text("Today"));
}
return null;
}
])
```
mymodel :
```
class MyModel {
String message;
DateTime dateTime;
MyModel({required this.message, required this.dateTime});
}
```
some extension will useful in your case :
```
extension DateHelpers on DateTime {
bool isToday() {
final now = DateTime.now();
return now.day == day &&
now.month == month &&
now.year == year;
}
bool isYesterday() {
final yesterday = DateTime.now().subtract(const Duration(days: 1));
return yesterday.day == day &&
yesterday.month == month &&
yesterday.year == year;
}
}
```
| null | CC BY-SA 4.0 | null | 2022-12-27T10:07:33.840 | 2022-12-27T10:07:33.840 | null | null | 15,366,030 | null |
74,928,971 | 2 | null | 74,928,139 | 2 | null | You have a missing jar in your libs. Those yellow lines under your imports is telling you it has no idea what those classes are.
| null | CC BY-SA 4.0 | null | 2022-12-27T11:58:22.187 | 2022-12-27T11:58:22.187 | null | null | 1,151,144 | null |
74,928,987 | 2 | null | 74,924,779 | 1 | null | I am not sure if this is desired behaviour (this might or might not have been a deliberate design decision by the author of this Geom), and might warrant an issue report to the package maintainer. `ggpol::GeomParliament` uses `rectGrob` to draw the legend key (you can see that by looking at `GeomParliament$draw_key`). You can override this by first defining the correct `draw_key` function (using the `key_glyph` argument in the geom) and then override the aesthetics in `guides`.
```
library(ggpol)
#> Loading required package: ggplot2
df <- data.frame(Type = c("R"), value = c(100))
ggplot(df) +
geom_parliament(aes(seats = value, fill = Type), key_glyph = "point") +
guides(fill = guide_legend(override.aes = list(size = 10, shape = 21)))
#> Warning: Using the `size` aesthetic in this geom was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` in the `default_aes` field and elsewhere instead.
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-12-27T11:59:48.223 | 2022-12-27T11:59:48.223 | null | null | 7,941,188 | null |
74,929,294 | 2 | null | 55,172,274 | 0 | null | On the emulator window, click on the 3-dots menu and you will find the option to record and Save as GIF, see the screenshot
[](https://i.stack.imgur.com/dTUUP.png)
| null | CC BY-SA 4.0 | null | 2022-12-27T12:32:03.657 | 2022-12-27T12:32:03.657 | null | null | 684,582 | null |
74,929,306 | 2 | null | 74,928,306 | 0 | null | ```
Sub copyRea()
Dim wb As New Workbook
Dim ws As New Worksheet
Dim newdata As Range
Dim rg As Range
Dim n As Date
Dim row_val As Integer
Set wb = activeworbooks.Select
Set ws = activeworksheet.Select
Set rg = ws.PivotTable("Rea").Columnfield("Date début").Range
Set n = Now()
If Year(rg) = Year(n) And Month(rg) = Month(n) And Day(rg) = Day(n) Then
'if the data of the day is found in the pivot table
'go to the previous column and copy the data of the fields : Total Cat Total Hors Cat
Set newdata = Cells.Find(What:="*", _
Before:=Cells(row_val), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)
newdata.Copy
Else
Exit Sub
End If
End Sub
```
I tried some coding
| null | CC BY-SA 4.0 | null | 2022-12-27T12:33:30.237 | 2022-12-27T12:33:30.237 | null | null | 20,871,056 | null |
74,929,587 | 2 | null | 74,927,871 | 0 | null | i have tried npm run dev it doesn't work , so i replace it with npm run build .
this is what my package.json look like:
```
"private": true,
"scripts": {
"dev": "vite",
"watch": "npm-watch",
"build": "vite build"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.3",
"lodash": "^4.17.19",
"postcss": "^8.4.6",
"tailwindcss": "^3.1.0",
"vite": "^4.0.3"
},
"dependencies": {
"npm-watch": "^0.11.0"
},
"watch": {
"build": {
"patterns": [
"src"
],
"extensions": "js,jsx"
}
}
```
}
I added ( "watch": "npm-watch",)
| null | CC BY-SA 4.0 | null | 2022-12-27T12:59:04.867 | 2022-12-27T12:59:04.867 | null | null | 18,474,215 | null |
74,930,270 | 2 | null | 74,900,085 | 0 | null | I asked this same question in the Bioconductor website and it was answered correctly there: [https://support.bioconductor.org/p/9148540/](https://support.bioconductor.org/p/9148540/)
| null | CC BY-SA 4.0 | null | 2022-12-27T14:04:36.233 | 2022-12-27T14:04:36.233 | null | null | 20,846,330 | null |
74,930,906 | 2 | null | 74,927,576 | 0 | null | The issue is that you have create an installed application. the redirect uri you are using is that of localhost. Yet you do not have a web server running on your machine so its giving you a 404 when returning to you the authorization code.
The solution would be to do what they do in the [python quickstart for google drive](https://developers.google.com/drive/api/quickstart/python)
Here they use `creds = flow.run_local_server(port=0)` to spawn a local web server to accept the authorization code response from the authorization process.
# Code
```
from __future__ import print_function
import os.path
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']
def main():
"""Shows basic usage of the Drive v3 API.
Prints the names and ids of the first 10 files the user has access to.
"""
creds = None
# The file token.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.json'):
creds = Credentials.from_authorized_user_file('token.json', SCOPES)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open('token.json', 'w') as token:
token.write(creds.to_json())
try:
service = build('drive', 'v3', credentials=creds)
# Call the Drive v3 API
results = service.files().list(
pageSize=10, fields="nextPageToken, files(id, name)").execute()
items = results.get('files', [])
if not items:
print('No files found.')
return
print('Files:')
for item in items:
print(u'{0} ({1})'.format(item['name'], item['id']))
except HttpError as error:
# TODO(developer) - Handle errors from drive API.
print(f'An error occurred: {error}')
if __name__ == '__main__':
main()
```
| null | CC BY-SA 4.0 | null | 2022-12-27T15:01:40.800 | 2022-12-27T15:01:40.800 | null | null | 1,841,839 | null |
74,931,009 | 2 | null | 74,930,443 | 1 | null | Part of the page you are trying to parse is being rendered client side, so when mechanize gets the HTML it does not contain the links you are looking for.
Luckily for you the website is using a [JSON API](https://shopee.com.br/api/v4/recommend/recommend?bundle=category_landing_page&cat_level=1&catid=11059983&limit=60&offset=60) so it is pretty easy to extract the information of the products.
| null | CC BY-SA 4.0 | null | 2022-12-27T15:10:55.847 | 2022-12-27T15:10:55.847 | null | null | 3,994,337 | null |
74,931,017 | 2 | null | 69,709,251 | 0 | null | You should create virtualenv manually
1.open pycharm
2.File >> Settings >> Project: (your project name) >> Python Interpreter
3.click on Add interpreter >> Add local Interpreter
4.click on Virtualenv Environment
5.Environment : click on New
6.Location : your project location
7.Base Interpreter : python location
8.click on OK
That's it. Your virtual environment is create
| null | CC BY-SA 4.0 | null | 2022-12-27T15:12:08.953 | 2022-12-27T15:12:08.953 | null | null | 10,919,335 | null |
74,931,083 | 2 | null | 13,256,720 | -1 | null | guys!
Fell free to try this solution: first, create a derived class from original RichTextBox. In the constructor, set and style flags:
```
public class MyRichTextBox : RichTextBox
{
public MyRichTextBox()
{
SetStyle(ControlStyles.Selectable, false);
SetStyle(ControlStyles.UserMouse, true);
}
}
```
Then, use it instead of original:
```
private void InitializeComponent()
{
...
this.richTextBox1 = new MyRichTextBox();
...
```
Also, you can set those behaiour flags, to avoid unnessesery user interactions:
```
this.richTextBox1.Cursor = System.Windows.Forms.Cursors.Default;
this.richTextBox1.ReadOnly = true;
this.richTextBox1.ShortcutsEnabled = false;
```
| null | CC BY-SA 4.0 | null | 2022-12-27T15:19:24.440 | 2022-12-27T15:19:24.440 | null | null | 20,872,865 | null |
74,931,373 | 2 | null | 10,636,667 | 0 | null | Adding this in CSS made the trick for me.
```
.modal-backdrop.fade.show{
z-index:0;
}
```
| null | CC BY-SA 4.0 | null | 2022-12-27T15:48:38.203 | 2022-12-27T20:00:36.670 | 2022-12-27T20:00:36.670 | 11,107,541 | 14,118,871 | null |
74,931,384 | 2 | null | 48,132,699 | 1 | null | You can fix the problem by opening a null pdf device
```
p1 <-gghistogram(data, title="MOTIVATION SCORES", x="MOTIVATION", y="..density..",
add_density=TRUE, add = "median", rug = TRUE, bins=15, color="#69c8ECFF",
fill="#69c8ECFF") ,
p2 <- gghistogram(data, title="MOTIVATION BY AGE GROUP", x = "MOTIVATION",
y="..density..", add_density=TRUE,
add = "median", rug = TRUE, bins=15,
color = "AGE_GROUP", fill = "AGE_GROUP",
palette = c("#69c8ECFF", "#E762D7FF")
)
pdf(NULL)
res <- ggarrange(p1,p2, legend = "bottom", common.legend = TRUE)
dev.off()
res
```
| null | CC BY-SA 4.0 | null | 2022-12-27T15:49:42.827 | 2022-12-27T15:49:42.827 | null | null | 20,873,048 | null |
74,931,510 | 2 | null | 74,922,107 | 0 | null | There are several problems with the code. Best way to avoid confusion is to set and/or obey some rules and stay strict. For instance:
1. table names and column names - all capital letters
2. variables - all small letters or just first letter capital or some combination
3. input parameters - & + exactly the same syntax as variable
4. put slash / after every pl/sql block to run it
5. if you are entering input params using SQL Developer's window (Enter Substitution Variable) and you are entering the VarChar2 value - enclose it with single quotes:
Here is a reduced part of your code that works by the rules above. You can set them differently if you wish so - just be consistent:
```
create table A_TBL
(
ID INT Not Null,
BR_NAME varchar2(20),
primary key(ID)
);
insert into A_TBL values (1, 'dhaka');
insert into A_TBL values (2, 'rajshahi');
set serveroutput on;
declare
my_id A_TBL.ID%TYPE := &my_id;
my_br_name A_TBL.BR_NAME%TYPE := &my_br_name;
begin
dbms_output.put_line(my_id || '-' || my_br_name);
end;
/ -- this slash is needed
/* R e s u l t --> input for &my_id was 1 -- input for &my_br_name was 'A' (with single quotes)
table A_TBL created.
1 rows inserted.
1 rows inserted.
anonymous block completed
1-A
*/
```
This way you will always know what is a column in a table and what is variable or parameter and the code would be easier to read and maintain.
| null | CC BY-SA 4.0 | null | 2022-12-27T16:01:15.640 | 2023-01-03T18:26:20.607 | 2023-01-03T18:26:20.607 | 13,302 | 19,023,353 | null |
74,931,819 | 2 | null | 72,899,754 | 0 | null | I solved mine by changing the templates directory in my settings.py file from the template folder I was using before adding tailwind to the theme/templates folder that was created when setting up tailwind.
in settings.py file from this:
```
TEMPLATES = [
{ ...,
'DIRS': ['templates'],
...,
}
],
```
to this:
```
TEMPLATES = [
{ ...,
'DIRS': ['theme/templates'],
...,
}
]
```
| null | CC BY-SA 4.0 | null | 2022-12-27T16:33:16.877 | 2022-12-27T16:37:14.397 | 2022-12-27T16:37:14.397 | 13,330,308 | 13,330,308 | null |
74,932,362 | 2 | null | 74,874,582 | 0 | null | Take a look how bootstrap make it in the [docs](https://getbootstrap.com/docs/4.6/components/forms/#custom-styles)
then, instead use as class is_invalid you can use .ng-invalid.ng-touched
```
.ng-invalid.ng-touched {
border-color: #dc3545;
padding-left: calc(1.5em + .75rem) !important;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: leftcalc(.375em + .1875rem) center;
background-size: calc(.75em + .375rem) calc(.75em + .375rem);
}
```
NOTE: I change the rigth by left in padding and position the image
NOTE2: you can use any svg, e.g.
```
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23dc3545' stroke='none' viewBox='0 0 16 16'><path d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z'/></svg>");
```
If we are working with material angular, we need take account the "floating label"
So, we can use in styles.css
```
input.ng-invalid.ng-touched {
border-color: #dc3545;
padding-left: calc(1.5em) !important;
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23dc3545' stroke='none' viewBox='0 0 16 16'><path d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z'/></svg>");
background-repeat: no-repeat;
background-position: left center;
background-size: calc(.75em + .375rem) calc(.75em + .375rem);
}
mat-form-field.mat-mdc-form-field.ng-invalid.ng-touched:not(.mat-focused) .mat-mdc-floating-label.mdc-floating-label:not(.mdc-floating-label--float-above) {
transform: translate(1.5em,-.15rem);
}
```
See [stackblitz](https://stackblitz.com/edit/angular-x67n6s?file=src%2Fstyles.scss)
| null | CC BY-SA 4.0 | null | 2022-12-27T17:24:51.180 | 2022-12-28T08:54:40.243 | 2022-12-28T08:54:40.243 | 8,558,186 | 8,558,186 | null |
74,932,643 | 2 | null | 74,932,616 | 0 | null | Not sure if this is a table used only for modelling or one that you have created as an actual table. If it's an actual table, ensure you have `DeleteTable` permissions for the role being used in workbench.
If this is just a modelling table locally, send feedback to the NoSQL Workbench team via the button on the main dashboard.
| null | CC BY-SA 4.0 | null | 2022-12-27T17:58:26.923 | 2022-12-27T17:58:26.923 | null | null | 7,909,676 | null |
74,932,854 | 2 | null | 74,920,457 | 0 | null | You tests are being run in watch mode, as people have said in the comments.
The `test:ci` command you have is intended to disable watching by creating the `CI` environment variable, but you're probably not running on the platform that command was written for.
The simplest solution is to add the `--watchAll=false` command line option in the `test:ci` script:
```
"test:ci": "cross-env CI=true react-scripts --watchAll=false test",
```
Ref: [https://create-react-app.dev/docs/running-tests/#on-your-own-environment](https://create-react-app.dev/docs/running-tests/#on-your-own-environment)
PS: I'm not familiar with `cross-env`, but that reference shows ways you might configure `test:ci` on various platforms.
| null | CC BY-SA 4.0 | null | 2022-12-27T18:21:33.493 | 2022-12-27T18:21:33.493 | null | null | 3,216,427 | null |
74,932,945 | 2 | null | 74,910,492 | 0 | null | While trying to figure it out I realized that the path it was searching for did not exist because I had changed the location of the file through the GUI so it was looking at the wrong path. I just kept the code files and rebuilded the project in a different file and deleted the the previous project, it worked perfectly.
So I would suggest to simply copy the code files and rebuilt the project it only takes a minute. At least this worked for me
| null | CC BY-SA 4.0 | null | 2022-12-27T18:31:18.757 | 2022-12-27T18:31:18.757 | null | null | 13,511,000 | null |
74,933,005 | 2 | null | 74,932,398 | 1 | null | Don't use the `tabu` package - it is more or less completely broken. The only thing which helds this package together is a lot of [ducktape](https://github.com/tabu-issues-for-future-maintainer/tabu) by the latex team.
Instead you could use `tabularray` package, which makes merging cells much easier and you'll also don't have to worry how long all your lines should be.
You might also want to choose another column type, like S from siunitx, to avoid the incorrect spacing around your minus signs ....
```
\documentclass[lettersize,journal]{IEEEtran}
\usepackage{array,tabularx}
\usepackage{pifont}
\usepackage{multirow,booktabs,tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{table*}[!t]
\caption{A. \label{table8}}
\centering
\begin{tblr}{
colspec={|c|c|S[table-format=1.3e-2]|S[table-format=1.3e-2]|S[table-format=1.3e-2]|S[table-format=1.3e-2]|S[table-format=1.3e-2]|},
vlines,
hlines,
row{1-2} = {guard}
}
\SetCell[r=2]{} A & \SetCell[c=2,r=2]{} B && \SetCell[c=4]{} C &&& \\
& & & E & F & G & H \\
\SetCell[r=3]{} D &
\SetCell[r=3]{} K & 1.0612e-09 & 1.0610e-09 & 5.2760e-10 & 3.7844e-08 & 7.6545e-06\\
& & 9.724e-10 & 9.7239e-10 & 4.8758e-10 & 4.9127e-08 & 7.7153e-06\\
& & 9.132e-10 & 9.131e-10 & 4.1633e-10 & 4.3932e-08 & 8.2672e-06\\
\end{tblr}
\end{table*}
\end{document}
```
[](https://i.stack.imgur.com/xc28g.png)
| null | CC BY-SA 4.0 | null | 2022-12-27T18:36:52.613 | 2022-12-27T20:48:23.837 | 2022-12-27T20:48:23.837 | 2,777,074 | 2,777,074 | null |
74,933,122 | 2 | null | 74,933,010 | 1 | null | Putting a `key` on a div will cause that div to unmount and remount when the key changes. But it will have no effect on the component surrounding that div (Attribute). If you want to deliberately unmount and remount Attribute, you need to put a key on Attribute. So wherever you're rendering it, do:
```
<Attribute key={`${globalId}-${name}`} globalId={globalId} name={name} value={something} />
```
| null | CC BY-SA 4.0 | null | 2022-12-27T18:51:27.457 | 2022-12-27T18:51:27.457 | null | null | 3,794,812 | null |
74,933,163 | 2 | null | 74,932,947 | 1 | null | You can't do this inside a , not one that's editable. It sounds like you're after a [WYSIWYG editor](https://en.wikipedia.org/wiki/WYSIWYG), most of which use a to do this.
There are several JavaScript options for this, to name a few:
- [TinyMCE](http://tinymce.moxiecode.com/)- [CKEditor](http://ckeditor.com/)
| null | CC BY-SA 4.0 | null | 2022-12-27T18:55:42.113 | 2022-12-27T18:55:42.113 | null | null | 12,453,755 | null |
74,933,358 | 2 | null | 74,932,947 | 1 | null | So here's what I have tried following your approach, it still needs improvement, thou:
```
const textarea = document.getElementById("editor");
function moveCursorAtTheEnd() {
var selection = document.getSelection();
var range = document.createRange();
var contenteditable = document.querySelector('div[contenteditable="true"]');
if (contenteditable.lastChild.nodeType == 3) {
range.setStart(contenteditable.lastChild, contenteditable.lastChild.length);
} else {
range.setStart(contenteditable, contenteditable.childNodes.length);
}
selection.removeAllRanges();
selection.addRange(range);
}
textarea.addEventListener("keydown", function (e) {
if (e.keyCode == 32 || e.keyCode == 13) updateText(textarea.textContent);
textarea.innerHTML = textarea.innerHTML + " ";
moveCursorAtTheEnd();
});
function updateText(text) {
textarea.innerHTML = colorize(
text.replace(/\n/g, "<br>").replace(/\t/g, "	")
);
}
function colorize(text) {
var words = ["int", "class", "#include", "namespace"];
for (const keyword of words) {
text = text.replaceAll(
keyword,
`<span style="color:#569cd6">${keyword}</span>`
);
text = text.replaceAll(
keyword.toLowerCase(),
`<span style="color:#569cd6">${keyword.toLowerCase()}</span>`
);
}
return text;
}
```
```
#editor {
background: lightgrey;
height: 100vh;
}
[contenteditable]:focus {
outline: 0px solid transparent;
}
```
```
<div contentEditable="true" id="editor" onfocus="this.value = this.value;"></div>
```
After all, for a robust editor, I'd recommend you to use [ACE](https://ace.c9.io/#nav=about) editor, you can have a look at the live demo here: [https://ace.c9.io/build/kitchen-sink.html](https://ace.c9.io/build/kitchen-sink.html) It's not that difficult to implement. Hope it helps!
| null | CC BY-SA 4.0 | null | 2022-12-27T19:20:22.390 | 2022-12-27T19:32:38.563 | 2022-12-27T19:32:38.563 | 12,743,692 | 12,743,692 | null |
74,933,670 | 2 | null | 74,933,637 | 0 | null | The expression on the right hand side of the `*=` is evaluated .
`7 - 3` => `4` which multiplied by `1` is `4`.
`6 - 3` => `3` which multiplied by `4` is `12`.
`4 - 3` => `1` which multiplied by `12` is `12`.
To achieve what you are expecting:
```
numbers = [7, 6, 4]
result = 1
for num in numbers:
result = result * num - 3
print(result)
```
| null | CC BY-SA 4.0 | null | 2022-12-27T20:04:02.893 | 2022-12-27T20:04:02.893 | null | null | 15,261,315 | null |
74,933,685 | 2 | null | 74,933,637 | 0 | null | the *= means that the * will be used between what's before it and what's after so you need to get result_2 in this example to get what you want :
```
numbers = [7,6,4]
result = 1
result_2 = 1
for number in numbers:
result *= number -3
result_2 = result_2 * number -3
print(result, result_2)
```
| null | CC BY-SA 4.0 | null | 2022-12-27T20:05:08.363 | 2022-12-27T20:30:50.557 | 2022-12-27T20:30:50.557 | 14,225,385 | 14,225,385 | null |
74,933,692 | 2 | null | 74,933,061 | 1 | null | Since you didn't provide the sample data from your csv, assuming it's the data you like to use to annotate the maps. In this example I use the country short names as the text which can be added by `plotly.go.scattergeo`.
```
import geopandas as gpd
import plotly.express as px
import json
world_data = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
africa = world_data[world_data.continent=='Africa']
africa_json = json.loads(africa.to_json())
f = px.choropleth(africa,
geojson=africa_json,
featureidkey='properties.name',
locations='name',
color='name')
## Add labels on countries
f.add_scattergeo(
geojson=africa_json,
locations=africa['name'],
featureidkey='properties.name',
text=africa['iso_a3'],
mode='text',
)
f.update_geos(fitbounds='locations')
```
[](https://i.stack.imgur.com/hdTy2.png)
| null | CC BY-SA 4.0 | null | 2022-12-27T20:05:51.953 | 2022-12-27T20:05:51.953 | null | null | 8,464,277 | null |
74,933,718 | 2 | null | 74,933,637 | 0 | null | ```
numbers=[7, 6, 4]
result = 1
for num in numbers:
result *= num-3
print(result)
```
The *= operator is a compound assignment operator, which means that it combines the assignment operator = with another operator
[https://www.educative.io/answers/what-are-the-compound-assignment-identity-operators-in-python](https://www.educative.io/answers/what-are-the-compound-assignment-identity-operators-in-python)
```
numbers=[7, 6, 4]
result = 1
for num in numbers:
result = result*num-3
print(result)
```
| null | CC BY-SA 4.0 | null | 2022-12-27T20:08:58.297 | 2022-12-27T20:08:58.297 | null | null | 14,923,551 | null |
74,933,814 | 2 | null | 74,933,637 | 1 | null | > Why with the *= operator is the order of operations altered?
The *= is not an operator, it's delimiter. Check the '2. Lexical analysis' of 'The Python Language Reference':
> The following tokens are operators:```
+ - * ** / // % @
<< >> & | ^ ~ :=
< > <= >= == !=
```
> The following tokens serve as delimiters in the grammar:```
( ) [ ] { }
, : . ; @ = ->
+= -= *= /= //= %= @=
&= |= ^= >>= <<= **=
```
The period can also occur in floating-point and imaginary literals. A
sequence of three periods has a special meaning as an ellipsis
literal. The second half of the list, the augmented assignment
operators, serve lexically as delimiters, but also perform an
operation.
Moreover, in your code you have the, augmented assignment statement, as per '7.2.1. Augmented assignment statements':
> :[...]An augmented assignment evaluates the target (which, unlike normal
assignment statements, cannot be an unpacking) and the expression
list, performs the binary operation specific to the type of assignment
on the two operands, and assigns the result to the original target.
The target is only evaluated once. In the
augmented version, x is only evaluated once. Also, when possible, the
actual operation is performed in-place, meaning that rather than
creating a new object and assigning that to the target, the old object
is modified instead.Unlike normal assignments, augmented assignments evaluate the
left-hand side before evaluating the right-hand side. For example,
a[i] += f(x) first looks-up a[i], then it evaluates f(x) and performs
the addition, and lastly, it writes the result back to a[i].
The '6.16. Evaluation order' says:
> Python evaluates expressions from left to right. Notice that while evaluating an assignment, the right-hand side is evaluated before the left-hand side.
You can also check the '6.17. Operator precedence' chapter, but it's not about the statements.
| null | CC BY-SA 4.0 | null | 2022-12-27T20:22:30.117 | 2022-12-27T20:34:38.687 | 2022-12-27T20:34:38.687 | 5,007,100 | 5,007,100 | null |
74,934,008 | 2 | null | 17,437,042 | 1 | null | I recommend `settings.Width = Unit.Percentage(100);`
| null | CC BY-SA 4.0 | null | 2022-12-27T20:48:35.410 | 2022-12-27T21:29:54.170 | 2022-12-27T21:29:54.170 | 7,733,418 | 9,881,537 | null |
74,934,144 | 2 | null | 74,933,956 | 1 | null | You can use `np.where`, which follows the format `np.where(condition, value if condition is true, value if condition is false)` – feel free to read the documentation [here](https://numpy.org/doc/stable/reference/generated/numpy.where.html).
For example:
```
S = 55
k = 2
np.where((user_data/S == 0) | (user_data/S == 1), (user_data+1)/(S + k), user_data/S)
```
Result:
```
array([[0.29090909, 0.27272727, 0.25454545, 0.18181818, 0.01754386],
[0.01754386, 0.23636364, 0.10909091, 0.27272727, 0.38181818],
[0.21818182, 0.52727273, 0.01818182, 0.21818182, 0.01818182],
[0.01754386, 0.01754386, 0.01754386, 0.01754386, 0.98245614]])
```
| null | CC BY-SA 4.0 | null | 2022-12-27T21:09:46.600 | 2022-12-27T21:17:10.223 | 2022-12-27T21:17:10.223 | 5,327,068 | 5,327,068 | null |
74,934,173 | 2 | null | 74,933,956 | 1 | null | I have noticed that your smoothing approach will cause P > 1, you are to clip or normalize the values later on:
```
probs = user_data/55
alpha = (user_data+1)/(55+2)
extreme_values_mask = (probs == 0) | (probs == 1)
probs[extreme_values_mask] = alpha[extreme_values_mask]
```
Result:
```
array([[0.29090909, 0.27272727, 0.25454545, 0.18181818, 0.01754386],
[0.01754386, 0.23636364, 0.10909091, 0.27272727, 0.38181818],
[0.21818182, 0.52727273, 0.01818182, 0.21818182, 0.01818182],
[0.01754386, 0.01754386, 0.01754386, 0.01754386, 0.98245614]])
```
Extension:
```
# Scale by sum.
probs /= probs.sum(1).reshape((-1, 1))
print(probs)
print(probs.sum(1))
[[0.28589342 0.26802508 0.25015674 0.17868339 0.01724138]
[0.01724138 0.2322884 0.10721003 0.26802508 0.37523511]
[0.21818182 0.52727273 0.01818182 0.21818182 0.01818182]
[0.01666667 0.01666667 0.01666667 0.01666667 0.93333333]]
[1. 1. 1. 1.]
```
| null | CC BY-SA 4.0 | null | 2022-12-27T21:14:29.787 | 2022-12-27T21:27:00.510 | 2022-12-27T21:27:00.510 | 18,624,778 | 18,624,778 | null |
74,934,329 | 2 | null | 74,923,093 | 1 | null | My previous answer depended on knowing the grid configuration of the input image. This solution does not.
The main challenge is to detect where the borders are and, thus, where the rectangles that contain the images are located.
To detect the borders, we'll look for (vertical and horizontal) image lines where all pixels are "white". Since the borders in the image are not really pure white, we'll use a value less than 255 as the whiteness threshold (WHITE_THRESH in the code.)
The gist of the algorithm is in the following lines of code:
```
whitespace = [np.all(gray[:,i] > WHITE_THRESH) for i in range(gray.shape[1])]
```
Here "whitespace" is a list of Booleans that looks like
```
TTTTTFFFFF...FFFFFFFFTTTTTTTFFFFFFFF...FFFFTTTTT
```
where "T" indicates the corresponding horizontal location is part of the border (white).
We are interested in the x-locations where there are transitions between T and F. The call to the function returns a list of tuples of indices
```
[(x1, x2), (x1, x2), ...]
```
where each (x1, x2) pair indicates the xmin and xmax location of images in the x-axis direction.
The slices function finds the "edges" where there are transitions between True and False using the exclusive-or operator and then returns the locations of the transitions as a list of tuples (pairs of indices).
Similar code is used to detect the vertical location of borders and images.
The complete runnable code below takes as input the OP's image "cat.png" and:
1. Extracts the sub-images into 4 PNG files "fragment-0-0.png", "fragment-0-1.png", "fragment-1-0.png" and "fragment-1-1.png".
2. Creates a (borderless) version of the original image by pasting together the above fragments.
The runnable code and resulting images follow. The program runs in about 0.25 seconds.
```
from PIL import Image
import numpy as np
def slices(lst):
""" Finds the indices where lst changes value and returns them in pairs
lst is a list of booleans
"""
edges = [lst[i-1] ^ lst[i] for i in range(len(lst))]
indices = [i for i,v in enumerate(edges) if v]
pairs = [(indices[i], indices[i+1]) for i in range(0, len(indices), 2)]
return pairs
def extract(xx_locs, yy_locs, image, prefix="image"):
""" Locate and save the subimages """
data = np.asarray(image)
for i in range(len(xx_locs)):
x1,x2 = xx_locs[i]
for j in range(len(yy_locs)):
y1,y2 = yy_locs[j]
arr = data[y1:y2, x1:x2, :]
Image.fromarray(arr).save(f'{prefix}-{i}-{j}.png')
def assemble(xx_locs, yy_locs, prefix="image", result='composite'):
""" Paste the subimages into a single image and save """
wid = sum([p[1]-p[0] for p in xx_locs])
hgt = sum([p[1]-p[0] for p in yy_locs])
dst = Image.new('RGB', (wid, hgt))
x = y = 0
for i in range(len(xx_locs)):
for j in range(len(yy_locs)):
img = Image.open(f'{prefix}-{i}-{j}.png')
dst.paste(img, (x,y))
y += img.height
x += img.width
y = 0
dst.save(f'{result}.png')
WHITE_THRESH = 110 # The original image borders are not actually white
image_file = 'cat.png'
image = Image.open(image_file)
# To detect the (almost) white borders, we make a grayscale version of the image
gray = np.asarray(image.convert('L'))
# Detect location of images along the x axis
whitespace = [np.all(gray[:,i] > WHITE_THRESH) for i in range(gray.shape[1])]
xx_locs = slices(whitespace)
# Detect location of images along the y axis
whitespace = [np.all(gray[i,:] > WHITE_THRESH) for i in range(gray.shape[0])]
yy_locs = slices(whitespace)
extract(xx_locs, yy_locs, image, prefix='fragment')
assemble(xx_locs, yy_locs, prefix='fragment', result='composite')
```
Individual fragments:
[](https://i.stack.imgur.com/dHOCd.png)
[](https://i.stack.imgur.com/MAB1l.png)
[](https://i.stack.imgur.com/fRTul.png)
[](https://i.stack.imgur.com/EJxM9.png)
The composite image:
[](https://i.stack.imgur.com/6QEZJ.png)
| null | CC BY-SA 4.0 | null | 2022-12-27T21:42:16.120 | 2022-12-27T21:54:09.443 | 2022-12-27T21:54:09.443 | 8,072,841 | 8,072,841 | null |
74,934,573 | 2 | null | 50,233,984 | 0 | null | I am having the exact same error.
I created a new project by-the-book of spring boot (with only web-starter). I did not add any code and invoked it as it is, right after its creation. I was successful with mvn clean install (jar runs and is operative), but intellij invocation (that involves the own intellij build step) fails due to missing org.springframework.boot package. (you can see in the image that the package is recognizable by intellij. it's only a problem of the build step)
I am after all the attempts of invalidate cache; restarted intellij; I have re-installed intellij completely and upgraded to latest 2022.3 ultimate version. running on java 17 on windows 11 (as much as it matters); I have sent my project to other team mates and it works flawlessly on their machine (as expected).
[](https://i.stack.imgur.com/wSm1c.png)
It seems that something got hanged and ruined on my intellij configuration, and the step of 'build' cannot get aligned with maven's artifacts
| null | CC BY-SA 4.0 | null | 2022-12-27T22:17:56.647 | 2022-12-27T22:17:56.647 | null | null | 1,869,409 | null |
74,934,586 | 2 | null | 74,934,267 | 0 | null | Foreign keys or referential integrities need to be organized with cascade operations. Which means if you expect your data from an important table to be deleted then you have to cascade the delete operation to all those table whose data is dependent on that important table.
For eg. if you want to delete an employee 'emp-1' from EMPLOYEE table then you should also delete it's address 'addr-1' from a referenced ADDRESS table. Otherwise an unreferenced address in the ADDRESS table laying there is of no use.
Refer this [oracle documentation](https://docs.oracle.com/cd/E23095_01/Platform.93/RepositoryGuide/html/s0610cascadingdatarelationships01.html) for more details on cascade delete
| null | CC BY-SA 4.0 | null | 2022-12-27T22:20:06.957 | 2022-12-27T22:20:06.957 | null | null | 11,383,913 | null |
74,934,970 | 2 | null | 74,934,627 | -1 | null | BigQuery Time types adjust values outside the 24 hour boundary - `00:00:00` to `24:00:00`; for example, if you subtract an hour from `00:30:00`, the returned value is `23:30:00`.
Based on your screenshot it looks like you are storing a duration? So 330 hours, 25 minutes and 55 seconds?
You would probably be best using timestamp, converting the hours to days and adding the remainder to your minutes and seconds.
You can then cast the resulting string to timestamp.
A much simpler solution is just `cast('330:25:55' as interval)` - thanks to @MatBailie
[](https://i.stack.imgur.com/hWfv9.png)
| null | CC BY-SA 4.0 | null | 2022-12-27T23:30:43.700 | 2022-12-29T20:17:35.433 | 2022-12-29T20:17:35.433 | 20,428,977 | 20,428,977 | null |
74,935,287 | 2 | null | 74,935,168 | 1 | null | In `OfficesList.fromJson` you need to change `toList` to `toList()` so that you're calling the function and actually getting the list.
```
class OfficesList {
List<Office> offices;
OfficesList({required this.offices});
factory OfficesList.fromJson(Map<String, dynamic> json) {
var officesJson = json['offices'] as List;
List<Office> officesList =
officesJson.map((i) => Office.fromJson(i)).toList() as List<Office>;
// ^^
return OfficesList(
offices: officesList,
);
}
}
```
| null | CC BY-SA 4.0 | null | 2022-12-28T00:41:17.327 | 2022-12-28T00:41:17.327 | null | null | 8,174,223 | null |
74,935,433 | 2 | null | 74,933,700 | 1 | null | You can use `regexp_matches`:
```
select id intl, regexp_replace(v[1], '^0+', '') values from tbl
cross join regexp_matches(id, '(\d+)', 'g') v
```
[See fiddle](https://dbfiddle.uk/L4Poelh2).
| null | CC BY-SA 4.0 | null | 2022-12-28T01:22:08.357 | 2022-12-28T01:22:08.357 | null | null | 7,326,738 | null |
74,935,457 | 2 | null | 74,935,168 | 0 | null | Just remove the `as List<Office>` here is an example.
```
var officeJson = json.encode([
{"name": "test1", "address": "address1", "image": "image1"},
{"name": "test2", "address": "address2", "image": "image2"}
]);
List<dynamic> decodedOfficeJson = jsonDecode(officeJson);
List<Office> officesList = decodedOfficeJson.map((i) => Office.fromJson(i)).toList();
```
| null | CC BY-SA 4.0 | null | 2022-12-28T01:27:43.707 | 2022-12-28T01:27:43.707 | null | null | 15,548,016 | null |
74,935,547 | 2 | null | 24,416,793 | 0 | null | I had the same problem.
I wrap the links in `<p>` tags.
For example change this:
```
<a href="www.example.com">Link 1</a>
<a href="www.example.com">Link 2</a>
<a href="www.example.com">Link 3</a>
```
to this:
```
<p><a href="www.example.com">Link 1</a></p>
<p><a href="www.example.com">Link 2</a></p>
<p><a href="www.example.com">Link 3</a></p>
```
Then you can add whatever classes you like to the p tag. For example `<p class="mb-4">`.
| null | CC BY-SA 4.0 | null | 2022-12-28T01:49:57.203 | 2022-12-28T01:49:57.203 | null | null | 5,783,745 | null |
74,935,858 | 2 | null | 74,935,778 | -1 | null | you might somewhere have declared the print as a variable. eg: `print = "sample"`. So restart the session or execute `del print` command and try executing your code.
```
del print
a=1
b=2
c=a+b
print(c)
```
Try executing the above code, also follow the below rules while naming a variable in python.
- - -
Here are some examples of valid and invalid identifier names in Python:
```
# Valid identifier names
_private
_private123
myVariable
myVariable123
MY_CONSTANT
# Invalid identifier names
123invalid # cannot start with a digit
for # for is a reserved word
```
| null | CC BY-SA 4.0 | null | 2022-12-28T02:59:06.333 | 2022-12-28T03:03:41.727 | 2022-12-28T03:03:41.727 | 269,970 | 14,565,137 | null |
74,936,073 | 2 | null | 74,932,798 | 1 | null | You can try to use a partial view in `Pages/Shared`,replace the html in ajax success:
Pages/Shared/Partial:
```
@model List<Conta>
<table class="table">
<tr>
<th>Id</th>
<th>Nome</th>
<th>Valor</th>
<th>Data</th>
<th>Prestação</th>
<th>Cartão</th>
<th>Pago?</th>
<th>Despesa?</th>
<th></th>
<th></th>
</tr>
@foreach (var conta in Model)
{
<tr>
<th>@conta._id</th>
<th>@conta.Nome</th>
<th>@conta.Valor</th>
<th>@conta.Data.ToShortDateString()</th>
<th>@(conta.TotalPrestacoes == 1 ? "" : $"{conta.PrestacaoAtual}/{conta.TotalPrestacoes}")</th>
<th>@conta.CartaoId</th>
<th>@(conta.Pago ? "Sim" : "Não")</th>
<th>@(conta.Despesa ? "Sim" : "Não")</th>
<th><button type="button" class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#CreateModal">Editar</button></th>
<th><button type="button" class="btn btn-danger">Deletar</button></th>
</tr>
}
</table>
```
ajax:
```
function changeDateSelector(date){
var dataAtualizada = date.value;
$.ajax({
type: "POST",
url: '/Contas/ContaView?handler=MonthSelector',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(dataAtualizada),
headers:
{
"RequestVerificationToken": $('input:hidden[name="__RequestVerificationToken"]').val()
},
success:function(data){
$("#test").html(data);
}
});
}
```
ContaView.cshtml:
```
<div id="test">
<partial name="Partial" [email protected] />
</div>
```
ContaView.cshtml.cs:
```
public PartialViewResult OnPostMonthSelector([FromBody] string dataAtualizada)
{
dataCorrente = DateTime.ParseExact(dataAtualizada, "yyyy-MM", null);
contas = BuscarContasUsuarioMes(User.Identity.Name, dataCorrente);
return Partial("Partial", contas);
}
```
| null | CC BY-SA 4.0 | null | 2022-12-28T03:49:37.747 | 2022-12-28T03:49:37.747 | null | null | 13,593,736 | null |
74,936,310 | 2 | null | 74,935,515 | 0 | null | Here's an easy workflow to start with:
- - `Sign Up``Sign In``Shared Preferences`- `Sign In`
Find more info about Shared Preferences in [this Link](https://pub.dev/packages/shared_preferences).
| null | CC BY-SA 4.0 | null | 2022-12-28T04:40:19.163 | 2022-12-28T04:40:19.163 | null | null | 6,340,327 | null |
74,936,324 | 2 | null | 74,936,299 | 0 | null | Try running the following command in terminal:
```
flutter pub get
```
| null | CC BY-SA 4.0 | null | 2022-12-28T04:41:51.693 | 2022-12-28T04:41:51.693 | null | null | 16,124,033 | null |
74,936,402 | 2 | null | 74,936,299 | 0 | null | try using the below commands:
```
flutter clean
flutter pub get
```
| null | CC BY-SA 4.0 | null | 2022-12-28T04:57:23.727 | 2022-12-28T04:58:40.857 | 2022-12-28T04:58:40.857 | 12,349,734 | 20,676,140 | null |
74,936,417 | 2 | null | 74,935,004 | 1 | null | Its a little bit confusing calling a flex container "element". I personally prefer to call them "blabla-container", where 'blabla' is waterver I'm working with in that section (for example: "nav-links-container". But that of course is just a matter of taste.
About the question, thanks for the new info, if you are open to suggestions, the easiest way to do it is with css-grid:
```
#example-element {
display: grid;
grid-template-columns: repeat(3, 1fr);
/* or this way:
grid-template-columns: auto auto auto;
*/
overflow-x: hidden !important;
}
```
You can find more detailed info here: [MDN Docs, css-grid](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids#flexible_grids_with_the_fr_unit)
Ahh and one more detail, what you call "clipping", happens when the parent container is not big enought to contain the children with fixed sizes, so if after applying this changes you don't see it behaving as in the second picture, simply make the parent component smaller (200px for example) and voila!
| null | CC BY-SA 4.0 | null | 2022-12-28T04:59:49.410 | 2022-12-28T05:09:30.000 | 2022-12-28T05:09:30.000 | 9,341,643 | 9,341,643 | null |
74,936,522 | 2 | null | 74,935,004 | 0 | null | Grid layout would be easier here, as you want to show specific numbers of columns per row.
Use `grid-template-columns` to specify how many columns you want and their width. Then use `overflow: hidden` to hide those overflowed elements.
```
#example-element {
border: 1px solid black;
width: 300px;
height: 150px;
display: grid;
grid-template-columns: repeat(3, 100px);
gap: 1rem;
overflow-x: hidden;
}
#example-element > div {
background-color: rgba(0,0,255,.2);
border: 3px solid #00f;
width: 100px;
}
```
```
<div id="example-element" class="transition-all" style="flex-wrap: wrap;">
<div>Item One</div>
<div>Item Two</div>
<div>Item Three</div>
<div>Item Four</div>
<div>Item Five</div>
<div>Item Six</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-12-28T05:22:04.197 | 2022-12-28T05:22:04.197 | null | null | 16,801,529 | null |
74,936,538 | 2 | null | 74,936,299 | 0 | null | first do project clean and then pub get to get dependencies like below.
run this commands in your terminal.
```
flutter clean
flutter pub get
```
| null | CC BY-SA 4.0 | null | 2022-12-28T05:24:58.520 | 2022-12-28T05:24:58.520 | null | null | 17,779,863 | null |
74,936,741 | 2 | null | 74,432,453 | 1 | null | Use PyPDF2 1.28.6 or older. Odoo is not compatible with PyPDF2 2.x
| null | CC BY-SA 4.0 | null | 2022-12-28T05:58:55.313 | 2022-12-28T05:58:55.313 | null | null | 611,150 | null |
74,936,777 | 2 | null | 74,936,299 | 0 | null | Try the below steps one by one:
Open the terminal inside your flutter project folder and then perform,
```
flutter clean
flutter pub get
cd ios
pod repo update
pod install
```
Re-run your project.
| null | CC BY-SA 4.0 | null | 2022-12-28T06:04:44.730 | 2022-12-28T06:04:44.730 | null | null | 16,367,318 | null |
74,936,816 | 2 | null | 74,936,584 | 0 | null | You are looking for [skimage.measure.regionprops](https://scikit-image.org/docs/stable/api/skimage.measure.html). Once you have the predicted label map (`om` in your code) you can apply `regionprops` to it and get the `area` of each region.
| null | CC BY-SA 4.0 | null | 2022-12-28T06:10:37.373 | 2022-12-28T06:10:37.373 | null | null | 1,714,410 | null |
74,936,822 | 2 | null | 65,837,159 | 0 | null | The selected answer is wrong, the labels are incorrect.
Here is the corrected version:
```
pd.DataFrame((zip(X.columns[np.argsort(np.abs(shap_values).mean(0))][::-1],
-np.sort(-np.abs(shap_values).mean(0)))),
columns=["feature", "importance"])
```
| null | CC BY-SA 4.0 | null | 2022-12-28T06:11:27.083 | 2022-12-28T06:11:27.083 | null | null | 3,713,236 | null |
74,936,865 | 2 | null | 61,146,334 | 2 | null | you were used showTimePicker()
and in this you assign initialTime value than it will consider 24 hour format
but if you want 12 hour format follow this way
i make a function this will called from button's onTap : (){} method
myFunction
```
Future<TimeOfDay?> getTime({
required BuildContext context,
String? title,
TimeOfDay? initialTime,
String? cancelText,
String? confirmText,
}) async {
TimeOfDay? time = await showTimePicker(
initialEntryMode: TimePickerEntryMode.dial,
context: context,
initialTime: initialTime ?? TimeOfDay.now(),
cancelText: cancelText ?? "Cancel",
confirmText: confirmText ?? "Save",
helpText: title ?? "Select time",
builder: (context, Widget? child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: false),
child: child!,
);
},
);
return time;
}
```
here inside builder applied MediaQuery method and MediaQuery will take data ,
so, here you need to assign as
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: false),
and you will get 12 hour format Time
if you like watch full code
```
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
final String title;
const MyHomePage({
Key? key,
required this.title,
}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
child: Text('getTime'),
onPressed: () async {
TimeOfDay? time = await getTime(
context: context,
title: "Select Your Time",
);
},
),
],
),
),
);
}
}
Future<TimeOfDay?> getTime({
required BuildContext context,
String? title,
TimeOfDay? initialTime,
String? cancelText,
String? confirmText,
}) async {
TimeOfDay? time = await showTimePicker(
initialEntryMode: TimePickerEntryMode.dial,
context: context,
initialTime: initialTime ?? TimeOfDay.now(),
cancelText: cancelText ?? "Cancel",
confirmText: confirmText ?? "Save",
helpText: title ?? "Select time",
builder: (context, Widget? child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: false),
child: child!,
);
},
);
return time;
}
```
[](https://i.stack.imgur.com/7JSa0.png)
thank you
| null | CC BY-SA 4.0 | null | 2022-12-28T06:16:22.970 | 2022-12-28T06:16:22.970 | null | null | 19,873,077 | null |
74,936,942 | 2 | null | 74,928,659 | 0 | null | You can check your font-size and line height. Check if font-size and line-height are smaller than the parent div.
| null | CC BY-SA 4.0 | null | 2022-12-28T06:28:33.987 | 2022-12-28T06:28:33.987 | null | null | 10,049,824 | null |
74,937,049 | 2 | null | 74,936,704 | 0 | null | They are warnings rather than exceptions, so you can continue to use the Moodle site
`max_input_vars` is an easy fix, edit the php file for Apache
```
/etc/php/xx/apache2/php.ini
```
Search for `max_input_vars` and replace the value
```
;max_input_vars = 1000
max_input_vars = 5000
```
Then restart Apache
[https://docs.moodle.org/401/en/Environment_-_max_input_vars](https://docs.moodle.org/401/en/Environment_-_max_input_vars)
Using https is recommended for security but is a bit more complex to set up. It also depends how your server is setup.
There are instructions here - Test it on a local/staging server first. And think about scheduling downtime and putting the site into maintenance mode while the changes are being made.
[https://docs.moodle.org/311/en/Transitioning_to_HTTPS](https://docs.moodle.org/311/en/Transitioning_to_HTTPS)
| null | CC BY-SA 4.0 | null | 2022-12-28T06:44:12.743 | 2022-12-28T06:44:12.743 | null | null | 1,603,711 | null |
74,937,050 | 2 | null | 74,936,928 | 1 | null | First Iterate over the dataset rows and then iterate over the value of each cell if there are any empty values return the message box of your choice to the user. Please find the below attached code for your reference.
```
foreach (DataGridViewRow rw in this.dataGridView1.Rows)
{
for (int i = 0; i < rw.Cells.Count; i++)
{
if (rw.Cells[i].Value == null || rw.Cells[i].Value == DBNull.Value || String.IsNullOrWhiteSpace(rw.Cells[i].Value.ToString())
{
// here is your input message box...
string promptValue = Prompt.ShowDialog("Message", "some other string you want!");
}
else
{
// Proceed with the things you want to do..
}
}
}
```
```
public static class Prompt
{
public static string ShowDialog(string text, string caption)
{
Form prompt = new Form()
{
Width = 500,
Height = 150,
FormBorderStyle = FormBorderStyle.FixedDialog,
Text = caption,
StartPosition = FormStartPosition.CenterScreen
};
Label textLabel = new Label() { Left = 50, Top=20, Text=text };
TextBox textBox = new TextBox() { Left = 50, Top=50, Width=400 };
Button confirmation = new Button() { Text = "Ok", Left=350, Width=100, Top=70, DialogResult = DialogResult.OK };
confirmation.Click += (sender, e) => { prompt.Close(); };
prompt.Controls.Add(textBox);
prompt.Controls.Add(confirmation);
prompt.Controls.Add(textLabel);
prompt.AcceptButton = confirmation;
return prompt.ShowDialog() == DialogResult.OK ? textBox.Text : "";
}
}
```
```
string promptValue = Prompt.ShowDialog("Message", "some other string you want!");
```
| null | CC BY-SA 4.0 | null | 2022-12-28T06:44:32.597 | 2022-12-28T07:40:01.213 | 2022-12-28T07:40:01.213 | 4,672,460 | 4,672,460 | null |
74,937,368 | 2 | null | 74,936,299 | 0 | null | I entered all directories with pubspec.yaml file and ran flutter clean->flutter pub get to resolve it. Thank you.
| null | CC BY-SA 4.0 | null | 2022-12-28T07:22:57.940 | 2022-12-28T07:22:57.940 | null | null | 20,701,302 | null |
74,937,616 | 2 | null | 74,937,525 | 1 | null | Try this:
1. Ctrl + Shift +P
2. Select "Preferences: Open User Settings"
3. Write "terminal" in the search box
4. Search for "Terminal > Integrated > Default Profile: Windows"
5. Set value to "Command Prompt"
[Helpful Image](https://i.stack.imgur.com/pFxNi.png)
| null | CC BY-SA 4.0 | null | 2022-12-28T07:53:01.583 | 2022-12-28T07:54:23.957 | 2022-12-28T07:54:23.957 | 20,798,789 | 20,798,789 | null |
74,937,681 | 2 | null | 74,934,058 | 0 | null | You can create a rectangle that is [masked off](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/mask) by a circle.
```
body {
background-color: silver;
}
```
```
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="200">
<defs>
<mask id="m1">
<rect width="100" height="100" fill="white" />
<circle r="100" fill="black"/>
</mask>
</defs>
<rect width="100" height="100" fill="white" mask="url(#m1)"/>
</svg>
```
| null | CC BY-SA 4.0 | null | 2022-12-28T07:59:32.333 | 2022-12-28T07:59:32.333 | null | null | 322,084 | null |
74,937,723 | 2 | null | 74,937,525 | -2 | null | Ctrl + Shift +P
Select "Preferences: Open User Settings"
Write "terminal" in the search box
Search for "Terminal > Integrated > Default Profile: Windows"
Set value to "Command Prompt"
or to "Powershell"
| null | CC BY-SA 4.0 | null | 2022-12-28T08:03:08.170 | 2022-12-28T08:03:08.170 | null | null | 20,877,543 | null |
74,937,930 | 2 | null | 74,937,810 | 0 | null | When you add a PhotoImage to a Tkinter widget, you have to keep a separate reference to the image object. Otherwise, the image will not show up.
| null | CC BY-SA 4.0 | null | 2022-12-28T08:26:58.680 | 2022-12-28T08:26:58.680 | null | null | 20,798,789 | null |
74,938,425 | 2 | null | 74,916,329 | 0 | null | Whats the hostname and port of RedisInsight you are accessing from your browser? If its not `localhost:4040`, set that in `RITRUSTEDORIGINS`.
If it is localhost:4040, set `RITRUSTEDORIGINS` to `http://localhost:4040`.
Set the right protocol (`http` or `https`), hostname and port. This should match the one you use in browser.
| null | CC BY-SA 4.0 | null | 2022-12-28T09:22:03.103 | 2022-12-28T09:22:03.103 | null | null | 6,830,396 | null |
74,938,462 | 2 | null | 74,851,477 | 0 | null | This is one of those Excel annomalies where the value of the floating point calculation is not accurate, in your case calculated as '2400.0143999999996' instead of 2400.0144.
Therefore the 'value' saved by Excel for the formula calulation with the values currently in the sheet is '2400.0143999999996' and when reading the cell as a string in pandas that's the value returned.
The answer from Rajat Shenoi however is valid and should display the number correctly as a float i.e. as '2400.0144'. Although it does also means that all the numbers in that column will then display as floats (with 4 decimal places being that is the largest number of decimal places of all the numbers) rather than as strings which may be your preferred view.
Try the following to see if it will do what you want. This example uses the 4 column 5 row example sheet you have provided. For comparison I'm adding an extra column to this Excel Sheet however you can obviously make the change to the existing column L, 'Column E' if you don't want to add the extra column.
I have also changed the values in cells 'J3' and 'J4' to give values with 2 and 3 decimal places in the formulas.
In column M (insert a new column if necessary), give it the header 'Rounded E' then enter the formula =ROUND(L2,6). Setting the rounding with a max of 6 decimal places. Copy this formula down the column for the rest of the populated rows.
Cell 'M2' should now have a value of '2400.0144' (assuming the Excel number format is not otherwise modifying the display)
Excel Sheet should now look like this
[](https://i.stack.imgur.com/UkZjX.jpg)
Change the 'using pandas section' of your code to the following;
```
### using pandas
df_input = pd.read_excel(excel_path, sheet_name, dtype={'Column E': float, 'Rounded E': str})
pd.options.display.float_format = '{:.5f}'.format
print(df_input)
```
Since the value for cell M2 stored by Excel would be '2400.0144' that is the value you should see in pandas under the 'Rounded E' column and the rest of the column also being strings will show with only the necessary number of decimal placings.
Column L 'Column E' is formatted to float with 5 decimals places so all numbers will pad to 5 decimal places . The number of decimal places is set using in the line
```
pd.options.display.float_format = '{:.5f}'.format
```
All values should have only the number of places specified in the format setting.
The last two columns would display as below, the 'Rounded E' column showing only the necessary number of decimal places.
```
Column E Rounded E
2400.01440 2400.0144
3600.04800 3600.048
3000.06000 3000.06
3600.00000 3600
3120.00000 3120
```
| null | CC BY-SA 4.0 | null | 2022-12-28T09:26:15.300 | 2022-12-28T09:26:15.300 | null | null | 13,664,137 | null |
74,938,581 | 2 | null | 74,937,810 | 0 | null | You need to define image object separately and then load it into `Label`:
```
from tkinter import *
from PIL import Image, ImageTk
root = Tk()
root.geometry("1000x700")
root.resizable(False, False)
image = ImageTk.PhotoImage(Image.open("image_processing20200410-19194-aihwb4.png"))
panel = Label(root, image=image)
panel.pack(expand=1, fill=BOTH)
root.mainloop()
```
Output:
[](https://i.stack.imgur.com/vDd0I.png)
| null | CC BY-SA 4.0 | null | 2022-12-28T09:38:07.230 | 2022-12-28T09:45:11.647 | 2022-12-28T09:45:11.647 | 2,255,764 | 2,255,764 | null |
74,938,638 | 2 | null | 74,934,737 | 0 | null |
I believe you are trying to sign in using google OAuth on another site which leads to the google page. Well unfortunately cypress can't visit two different domains in the same test the normal way. (The tests would lead to error because of change in domain)
Please refer to the following documentation that I hope would be of help to you.
[https://docs.cypress.io/guides/guides/cross-origin-testing#Parts-of-a-URL](https://docs.cypress.io/guides/guides/cross-origin-testing#Parts-of-a-URL)
| null | CC BY-SA 4.0 | null | 2022-12-28T09:43:35.397 | 2022-12-28T09:43:35.397 | null | null | 18,176,599 | null |
74,938,910 | 2 | null | 74,937,810 | 0 | null | try this code it might work
```
from PIL import Image
from PIL.ImageTk import PhotoImage
root = Tk()
root.geometry("1000x700")
root.minsize(1000, 700)
root.maxsize(1000, 700)
bg_img = Label(image=ImageTk.PhotoImage(Image.open("Jitn6.png")), compound=CENTER)
bg_img.pack(expand=1, fill=BOTH)
```
| null | CC BY-SA 4.0 | null | 2022-12-28T10:10:35.377 | 2022-12-28T10:10:35.377 | null | null | 20,338,708 | null |
74,939,354 | 2 | null | 74,843,976 | 1 | null | With the `align` argument you could left "l" align the parts of your plot, so the text can be left aligned. If you want to align your zero-effect lines you could use `mar` and play with the units to adjust one of the graphs. Here is a reproducible example:
```
library(forestplot)
library(tidyr)
age.plot <- forestplot(age.data,
labeltext = c(labeltext,numbers),
boxsize = 0.1,
xlog = FALSE,
clip=c(-20,20),
xticks=c(-20,-10,0,10,20),
txt_gp = fpTxtGp(ticks=gpar(cex=1)),
align=c("l","l","l")
)
status.plot <- forestplot(status.data,
labeltext = c(labeltext,numbers),
boxsize = 0.1,
xlog = TRUE,
clip=c(1/100,100),
xticks=c(log(1e-2),log(1e-1),0,log(1e1),log(1e2)),
txt_gp = fpTxtGp(ticks=gpar(cex=1)),
align=c("l","l","l"),
mar = unit(c(0,5,0,10.5), "mm")
)
library(grid)
grid.newpage()
pushViewport(viewport(layout = grid.layout(2, 1)))
pushViewport(viewport(layout.pos.row = 1))
plot(age.plot)
popViewport()
pushViewport(viewport(layout.pos.row = 2))
plot(status.plot)
popViewport(2)
```

[reprex v2.0.2](https://reprex.tidyverse.org)
| null | CC BY-SA 4.0 | null | 2022-12-28T10:55:11.170 | 2022-12-28T10:55:11.170 | null | null | 14,282,714 | null |
74,939,521 | 2 | null | 70,426,337 | 1 | null | I had the same problem with Sphinx `5.0.2`. When inspecting the HTML file, it looks like a CSS rule adds a semicolon (`::after`) using:
```
dl.field-list > dt:after {
content: ":";
}
```
I got rid of that behavior by overriding this rule in my [custom css style](https://sphinx-book-theme.readthedocs.io/en/stable/customize/custom-css.html) sheet:
```
dl.field-list > dt:after {
content: "";
}
```
It is obviously not the best solution but it did the job for me.
| null | CC BY-SA 4.0 | null | 2022-12-28T11:12:51.547 | 2022-12-28T11:12:51.547 | null | null | 20,879,016 | null |
74,939,510 | 2 | null | 74,814,284 | 0 | null |
Check did you enable persistent journaling in your container(s)?
One way: `mkdir /var/log/journal && systemctl restart systemd-journald`
Other way: `in ystemd/man/journald.conf.html`
If not and your container uses systemd, it will log to memory with limits derived from the host RAM which can lead to unexpected OOM situations..
Also if possible you can increase the amount of RAM (clamav does use quite a bit).
[oom_killer](https://When%20a%20process%20in%20the%20container%20tries%20to%20consume%20more%20than%20the%20allowed%20amount%20of%20memory,%20the%20system%20kernel%20terminates%20the%20process%20that%20attempted%20the%20allocation,%20with%20an%20out%20of%20memory%20(OOM)%20error.%20Check%20did%20you%20enable%20persistent%20journaling%20in%20your%20container(s)?%20%20%20%20One%20way:%20%60mkdir%20/var/log/journal%20&&%20systemctl%20restart%20systemd-journald%60%20%20Other%20way:%20%20in%20ystemd/man/journald.conf.html%20%20%20If%20not%20and%20your%20container%20uses%20systemd,%20it%20will%20log%20to%20memory%20with%20limits%20derived%20from%20the%20host%20RAM%20which%20can%20lead%20to%20unexpected%20OOM%20situations..%20%20%20Also%20if%20possible%20i%20would%20increase%20the%20amount%20of%20ram%20(clamav%20does%20use%20quite%20a%20bit)%20%20%20If%20the%20node%20experiences%20an%20out%20of%20memory%20(OOM)%20event%20prior%20to%20the%20kubelet%20being%20able%20to%20reclaim%20memory,%20the%20node%20depends%20on%20the%20oom_killer%20to%20respond.%20Node%20out%20of%20memory%20behavior%20is%20well%20described%20in%20Kubernetes%20best%20practices:%20Resource%20requests%20and%20limits.%20%20Pods%20crash%20and%20OS%20Syslog%20shows%20the%20OOM%20killer%20kills%20the%20container%20process,%20Pod%20memory%20limit%20and%20cgroup%20memory%20settings.%20Kubernetes%20manages%20the%20Pod%20memory%20limit%20with%20cgroup%20and%20OOM%20killer.%20We%20need%20to%20be%20careful%20to%20separate%20the%20OS%20OOM%20and%20the%20pods%20OOM)
[Node out of memory behavior](https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#node-out-of-memory-behavior) is well described in [Kubernetes best practices: Resource requests and limits](https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-resource-requests-and-limits). .
Pods crash and OS Syslog shows the OOM killer kills the container process, [Pod memory limit and cgroup memory settings](https://zhimin-wen.medium.com/memory-limit-of-pod-and-oom-killer-891ee1f1cad8). Kubernetes manages the Pod memory limit with cgroup and OOM killer. We need to be careful to separate the OS OOM and the pods OOM.
Try to use the `--oom-score-adj` option to `docker run` or even `--oom-kill-disable`. Refer to [Runtime constraints on resources](https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources) for more info.
Also refer to the similar [SO](https://stackoverflow.com/questions/72937671/mongod-killed-by-oom-kill-memory-cgroup-out-of-memory-kill-process-20391-mon) for more related information.
| null | CC BY-SA 4.0 | null | 2022-12-28T11:11:54.320 | 2022-12-28T11:11:54.320 | null | null | 19,818,461 | null |
74,939,572 | 2 | null | 74,938,237 | 0 | null | It might have some sub-emmiters or the object may have particles in children. What you need to do is to Destroy(gameObject) when not needed.
| null | CC BY-SA 4.0 | null | 2022-12-28T11:17:25.820 | 2022-12-28T11:17:25.820 | null | null | 16,955,107 | null |
74,939,601 | 2 | null | 74,939,253 | 1 | null | A few things.
Outlook blocks base64 encoded images. But, indeed, if you use Outlook /safe, you can workaround this.
Apple email client allows base64 encoded images.
Another approach would be to embed an image by attaching a file.
On this page, you can find a comprehensive guide with all the scenarios:
[https://mailtrap.io/blog/embedding-images-in-html-email-have-the-rules-changed/](https://mailtrap.io/blog/embedding-images-in-html-email-have-the-rules-changed/)
Hope it helps!
| null | CC BY-SA 4.0 | null | 2022-12-28T11:19:50.390 | 2022-12-28T11:19:50.390 | null | null | 20,846,337 | null |
74,939,611 | 2 | null | 74,934,058 | 1 | null | This is a very simple path.
`M 0 100`
Move to (0, 100) (bottom left)
`H 100`
Horizontal line to bottom right
`V 0`
Vertical line to top right
`A 100 100 0 0 1 0 100`
Semicircular arc of radius 100, clockwise, to (0, 100) (bottom right).
`Z`
Close path
```
svg {
width: 200px;
}
```
```
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M 0 100 H 100 V 0 A 100 100 0 0 1 0 100 Z" fill="black"/>
</svg>
```
| null | CC BY-SA 4.0 | null | 2022-12-28T11:20:25.963 | 2022-12-28T11:20:25.963 | null | null | 1,292,848 | null |
74,939,627 | 2 | null | 74,930,025 | 0 | null | Use the following command to start the server while ensuring the assets get compiled into the build directory.
```
bin/dev
```
This will start the server as well as watch for JS and CSS changes
| null | CC BY-SA 4.0 | null | 2022-12-28T11:22:43.540 | 2022-12-28T11:22:43.540 | null | null | 4,758,119 | null |
74,940,231 | 2 | null | 74,940,077 | 0 | null | Looking at your code, you are using `System.Data.SqlClient` which is a .NET Data Provider for SQL Server.
In your question you state that you try to connect to a mysql database. Use the appropriate nuget package for that
| null | CC BY-SA 4.0 | null | 2022-12-28T12:24:50.910 | 2022-12-28T12:24:50.910 | null | null | 8,264,672 | null |
74,940,326 | 2 | null | 74,940,077 | 0 | null | You can’t connect using SqlConnection. you need to install MySqlConnection using nuget package. You can download from [https://www.nuget.org/packages/MySqlConnector](https://www.nuget.org/packages/MySqlConnector) and you can look how to use section from readme.
| null | CC BY-SA 4.0 | null | 2022-12-28T12:35:51.837 | 2022-12-28T12:35:51.837 | null | null | 2,226,837 | null |
74,940,604 | 2 | null | 74,936,613 | 0 | null | You will need to use geom_rect for this.
If I may put in my 2 cents worth: The result is a fairly clattered visual. I think there might be other options out there to show your fractions. I think my favoured way would to use facets. This is not only making the fraction idea much clearer, and way more intuitive, but is also way simpler to code. See below
```
library(tidyverse)
dat <- data.frame(group = c(rep("H", 4), rep("T",4)), subgroup = rep(c("A", "B", "C", "D"), 2),
x = c(100, 10, 80, 50, 40, 50, 80, 70),
y = c(20, 5, 50, 20, 20, 10, 40, 50))
## width for rects
w <- .45
dat %>%
## because it is stacking in reverse alphbetic order
arrange(group, desc(subgroup)) %>%
group_by(group) %>%
mutate(frac_ymin = lag(cumsum(x), default = 0),
frac_ymax = frac_ymin + y,
## group needs to be numeric for geom_rect
group = as.integer(factor(group, levels = c("H", "T")))) %>%
ggplot(aes(x = group, y = x, fill = subgroup)) +
geom_col(alpha = .5) +
## now use geom_rect instead
geom_rect(aes(xmin = group - w, xmax = group + w,
ymin = frac_ymin, ymax = frac_ymax,
fill = subgroup), alpha = 1)
```

## Suggestion to use facets instead
```
library(tidyverse)
dat <- data.frame(group = c(rep("H", 4), rep("T",4)), subgroup = rep(c("A", "B", "C", "D"), 2),
x = c(100, 10, 80, 50, 40, 50, 80, 70),
y = c(20, 5, 50, 20, 20, 10, 40, 50))
## you can use your old code, just add a facet!
dat %>%
ggplot(aes(x = group, y = x, fill = subgroup)) +
geom_col(alpha = .5) +
geom_col(aes(x = group, y = y, fill = subgroup), alpha = 1) +
facet_wrap(~subgroup)
```

| null | CC BY-SA 4.0 | null | 2022-12-28T13:03:18.900 | 2022-12-28T13:08:19.557 | 2022-12-28T13:08:19.557 | 7,941,188 | 7,941,188 | null |
74,940,792 | 2 | null | 74,940,734 | 0 | null | Of course is not possible to export an interactive PNG, but you can export the graph in html using `fig.write_html`.
As an example:
```
import plotly.express as px
fig =px.scatter(x=range(20), y=range(20))
fig.write_html("file.html")
```
This will create a file in the same folder of your code called "file.html".
If you open this file with a browser, it will result in:
[](https://i.stack.imgur.com/EdE2h.png)
You can open this file as any other HTML file, and you can interact with the graph (than you can integrate it wherever you want).
Here you can find the documentation: [https://plotly.com/python/interactive-html-export/](https://plotly.com/python/interactive-html-export/) where you can find the alternative with Dash too.
| null | CC BY-SA 4.0 | null | 2022-12-28T13:22:05.290 | 2023-01-02T08:41:47.063 | 2023-01-02T08:41:47.063 | 12,950,322 | 12,950,322 | null |
74,941,539 | 2 | null | 74,936,928 | 1 | null | If you are using plain C# model classes, you can rely on [data annotations validation attributes](https://www.reza-aghaei.com/dataannotations-validation-attributes-in-windows-forms/).
If you are using DataTable as the model, you can [validate the DataTable](https://stackoverflow.com/a/74941404/3110834) by setting column or row errors and check if the data table has errors.
You can also look over the rows or cells of DataGridView and set cell or row errors, with or without databinding.
```
private bool ValidateCell(DataGridViewCell cell)
{
//Validation rules for Column 1
if (cell.ColumnIndex == 1)
{
if (cell.Value == null ||
cell.Value == DBNull.Value ||
string.IsNullOrEmpty(cell.Value.ToString()))
{
cell.ErrorText = "Required";
return false;
}
else
{
cell.ErrorText = null;
return true;
}
}
//Other validations
return true;
}
private bool ValidateDataGridView(DataGridView dgv)
{
return dgv.Rows.Cast<DataGridViewRow>()
.Where(r => !r.IsNewRow)
.SelectMany(r => r.Cells.Cast<DataGridViewCell>())
.Select(c => ValidateCell(c)).ToList()
.All(x => x == true);
}
```
Then use above methods before saving the data:
```
private void SaveButton_Click(object sender, EventArgs e)
{
if (!ValidateDataGridView(dataGridView1))
{
MessageBox.Show("Please fix validation errors");
return;
}
//Save changes;
}
```
To show the errors on cells or rows of DataGridView, set [ShowRowErrors](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview.showrowerrors?view=windowsdesktop-7.0&WT.mc_id=DT-MVP-5003235) and [ShowCellErrors](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview.showcellerrors?view=windowsdesktop-7.0&WT.mc_id=DT-MVP-5003235) to true.
```
dataGridView1.DataSource = dt;
dataGridView1.ShowCellErrors = true;
```
Also, if you want to update the validations of the cells, after editing the cell:
```
private void DataGridView1_CellValueChanged(object sender,
DataGridViewCellEventArgs e)
{
ValidateCell(dataGridView1[e.ColumnIndex, e.RowIndex]);
}
```
| null | CC BY-SA 4.0 | null | 2022-12-28T14:37:14.940 | 2022-12-28T14:45:13.057 | 2022-12-28T14:45:13.057 | 3,110,834 | 3,110,834 | 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.