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,540,119 | 2 | null | 74,539,995 | 1 | null | Directly pass the size of your SVG icon to the `iconSize` property of the `IconButton` widget instead of the `SvgPicture` widget.
This should work:
```
IconButton(
iconSize: 30, // <--- this
onPressed: () {},
icon: SvgPicture.asset('icons/add_white_bg.svg'),
)
```
| null | CC BY-SA 4.0 | null | 2022-11-22T23:26:39.907 | 2022-11-22T23:26:39.907 | null | null | 5,882,307 | null |
74,540,169 | 2 | null | 57,137,050 | 0 | null | Thank you for your answer, it helped me.
below is my code, maybe can help someone.
frequency = 44100
duration = 5
record = sd.rec((frequency * duration), samplerate=frequency , channels=1, blocking=True, dtype='float64')
sd.wait()
st.audio(record.T, sample_rate=frequency)
| null | CC BY-SA 4.0 | null | 2022-11-22T23:33:42.163 | 2022-11-27T12:17:00.713 | 2022-11-27T12:17:00.713 | 4,357,938 | 3,551,448 | null |
74,540,533 | 2 | null | 73,113,207 | 0 | null | On the Twitter Developer Portal under the User Authentication settings page for the relevant app, you also need to make sure that you have the Redirect URLs set up for policy you expect to require Twitter authentication flow in.
The instructions [here](https://learn.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-twitter?pivots=b2c-custom-policy#:%7E:text=Under%20GENERAL%20AUTHENTICATION%20SETTINGS) use the signup and signin policy as an example, however other policies can be responsible for re-authenticating a user (ie. change password). The Redirect URL for each of those policies will be different so it needs to be listed in the User Authentication settings page otherwise you'll get the following error:
> AADB2C: The request to obtain a token from 'https://api.twitter.com/oauth/request_token' returned an error 'Forbidden'
| null | CC BY-SA 4.0 | null | 2022-11-23T00:35:54.730 | 2022-11-23T00:35:54.730 | null | null | 161,735 | null |
74,540,671 | 2 | null | 74,538,092 | 0 | null | The easiest solution I could think of was to have text cut off with ellipsis in the title and description if it's too long. I also made the size of the image elements to be consistent for each box so that everything would line up. I recommend refactoring the card class to use a flexbox, but this will also work. I also modified the HTML to use a random icon from the internet for demonstration purposes.
Here's a link to a JSFiddle with the modified code: [https://jsfiddle.net/n7opzs9t/9/](https://jsfiddle.net/n7opzs9t/9/)
Hope this helps!
```
/* Added class for the title */
.title {
color: white;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-height: 1em;
max-width: 85%;
margin: auto;
}
/* Added text wrapping and outer spacing for description*/
.desc {
color: rgb(232, 14, 14);
font-size: 16px;
padding: 5px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-height: 2em;
max-width: 80%;
margin: 20px auto;
}
/* Limited the width of the button to the size of the card and added spacing to the outside*/
.game {
border: none;
outline: 0;
display: inline-block;
padding: 8px;
color: rgba(0, 0, 0, 0.741);
border-radius: 10px;
background-color: rgb(129, 5, 5);
text-align: center;
cursor: pointer;
width: -webkit-fill-available;
font-size: 18px;
margin: 2px 2px;
}
/* Moved stylings over to the css file for images*/
.thumb {
border-radius: 10px;
width: 300px;
height: 300px;
margin: 2px;
}
```
```
<div id="search" class="flex-container">
<div class="card">
<img class="thumb" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Windows_Settings_app_icon.png/1024px-Windows_Settings_app_icon.png" alt="#" />
<h1 class="title">Text</h1>
<p class="desc">Text</p>
<div style="margin: 24px 0;"> <i class="fa-solid fa-keyboard"></i> </div>
<a class="game" href="/Pages/games/wpnfire/">Press to play</a>
</div>
<div class="card">
<img class="thumb" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Windows_Settings_app_icon.png/1024px-Windows_Settings_app_icon.png" alt="#" />
<h1 class="title">Text is way too long for this title</h1>
<p class="desc">Text is way too long for this description</p>
<div style="margin: 24px 0;"> <i class="fa-solid fa-keyboard"></i> </div>
<a class="game" href="/Pages/games/wpnfire/">Press to play</a>
</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-11-23T01:00:12.650 | 2022-11-23T01:00:12.650 | null | null | 20,576,892 | null |
74,541,069 | 2 | null | 74,540,921 | 0 | null | As I stated in my comment, you are looking for [cumsum()](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.cumsum.html):
```
import pandas as pd
df = pd.DataFrame({
'items': ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B'],
'weeks': [1, 2, 3, 4, 1, 2, 3, 4],
'sales': [100, 101, 102, 130, 10, 11, 12, 13]
})
df.groupby(['items'])['sales'].cumsum()
```
Which results in:
```
0 100
1 201
2 303
3 433
4 10
5 21
6 33
7 46
Name: sales, dtype: int64
```
I'm using:
```
pd.__version__
'1.5.1'
```
Putting it all together:
```
import pandas as pd
df = pd.DataFrame({
'items': ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B'],
'weeks': [1, 2, 3, 4, 1, 2, 3, 4],
'sales': [100, 101, 102, 130, 10, 11, 12, 13]
})
df['wtds'] = df.groupby(['items'])['sales'].cumsum()
```
Resulting in:
```
items weeks sales wtds
0 A 1 100 100
1 A 2 101 201
2 A 3 102 303
3 A 4 130 433
4 B 1 10 10
5 B 2 11 21
6 B 3 12 33
7 B 4 13 46
```
| null | CC BY-SA 4.0 | null | 2022-11-23T02:18:57.090 | 2022-11-23T02:32:54.730 | 2022-11-23T02:32:54.730 | 6,789,321 | 6,789,321 | null |
74,541,220 | 2 | null | 74,540,824 | 0 | null | Try resizing your window.
when the terminal is to small, it will word wrap and have the characters that don't fit on the next line, thus making your output all jumbled and weird.
| null | CC BY-SA 4.0 | null | 2022-11-23T02:47:14.777 | 2022-11-23T02:47:14.777 | null | null | 15,139,208 | null |
74,541,254 | 2 | null | 74,541,205 | 0 | null | c++ just doesn't write "self" explicitly, maybe you need to learn about the keyword "this".
| null | CC BY-SA 4.0 | null | 2022-11-23T02:52:03.437 | 2022-11-23T02:52:03.437 | null | null | 5,417,267 | null |
74,541,316 | 2 | null | 74,538,092 | 0 | null | here is another way you can fix the problem :
```
<div id="search" class="flex-container">
<div>
<div class="card">
<img class="thumb" width="300" height="300" src="/Pages/games/wpnfire/wpnfire.jpg" alt="#" />
<h1 style="color: white;">Text</h1>
<p class="desc">Text</p>
<div style="margin: 24px 0;"> <i class="fa-solid fa-keyboard"></i> </div>
<a class="game" href="/Pages/games/wpnfire/">Press to play</a>
</div>
<div>
<div class="card">
<img class="thumb" width="300" height="300" src="/Pages/games/wpnfire/wpnfire.jpg" alt="#" />
<h1 style="color: white;">text</h1>
<p class="desc">Text for testing the sort of the elements</p>
<div style="margin: 24px 0;"> <i class="fa-solid fa-keyboard"></i> </div>
<a class="game" href="/Pages/games/wpnfire/">Press to play</a>
</div>
</div>
```
and the CSS will be like this :
```
.desc {
color: rgb(232, 14, 14);
font-size: 16px;
width:100%;
/* padding: 5px; */
}
.game:hover {
color: rgb(120, 9, 9);
background-color: rgb(52, 3, 3);
}
.game {
border: none;
outline: 0;
display: inline-block;
padding: 8px 0;
color: rgba(0, 0, 0, 0.741);
border-radius: 10px;
background-color: rgb(129, 5, 5);
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
position:absolute;
bottom:0;
translate : 0px -10px;
}
.flex-container {
width : 100%;
display: flex;
align-items: center;
align-content: center;
}
.flex-container>div {
display : flex;
gap:20px;
margin: 1px;
padding: 3px;
width : 100%
}
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 300px;
border-radius: 10px;
background-color: black;
text-align: center;
font-family: arial;
word-wrap: break-word;
display:flex;
align-items : center;
justify-content : center;
flex-direction:column;
width : 100%;
position:relative;
}
.thumb {
border-radius: 10px;
}
.button {
background-color: orange;
border: none;
color: black;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 12px;
}
.center-screen {
text-align: center;
font-family: "Arial";
font-size: 20px;
}
form {
background-color: #4654e1;
width: 300px;
height: 44px;
border-radius: 5px;
display: flex;
flex-direction: row;
align-items: center;
}
input {
all: unset;
font: 16px system-ui;
color: #fff;
height: 100%;
width: 100%;
padding: 6px 10px;
}
```
| null | CC BY-SA 4.0 | null | 2022-11-23T03:03:45.703 | 2022-11-23T03:03:45.703 | null | null | 15,237,828 | null |
74,541,374 | 2 | null | 74,530,300 | 1 | null | After tried everything that possible, finally I able to solved my problem. The last thing that I tried was :
Change Project Runner Configuration for Release to NONE
[](https://i.stack.imgur.com/4pO4e.png)
But, maybe this is not the final way to solve the similar problem. If above solutions don't work, the please try this solutions as well :
1. TargetSettings -> Build Phases -> Compile Sources -> add your .m class ->Build and Run
2. Set development target of extension must equal to runner's development target
3. Target -> Runner -> Build Phases, scroll down and find Compile Resource -> Add your .m file
4. Clean and build folder for severals time,
but don't forget to do everytime you edit xcode component ( just to re-ensure everything is work )
I hope this solution can help other member who face the same issue.
Info, the issue come when i use this :
- -
| null | CC BY-SA 4.0 | null | 2022-11-23T03:16:21.733 | 2022-11-23T03:16:21.733 | null | null | 20,476,465 | null |
74,541,519 | 2 | null | 74,540,720 | 0 | null | I would suggest to check version of your `axios` library.
Looks like the latest [version 1.2.0](https://www.npmjs.com/package/axios/v/1.2.0) of `axios` has changes in the response decompression logic and it doesn't work if server does not set the response content-length header. If that's a case - just temporary downgrade to the last [stable version](https://www.npmjs.com/package/axios/v/1.1.3) `1.1.3` i.e.:
```
npm i [email protected]
```
## UPDATE
Looks like adding a header `'Accept-Encoding': 'identity'` fixes an issue without a need to downgrade
| null | CC BY-SA 4.0 | null | 2022-11-23T03:39:34.720 | 2022-12-16T19:54:25.700 | 2022-12-16T19:54:25.700 | 701,869 | 701,869 | null |
74,541,668 | 2 | null | 8,454,730 | 0 | null | Note for myself Code template from [https://excessivelyadequate.com/posts/print.html](https://excessivelyadequate.com/posts/print.html) tested and working
```
@page {
/* Browser default, customizable by the user in the print dialogue. */
size: auto;
/* Default, but explicitly in portrait or landscape orientation and not user-
customizable. In my instance of Chrome, this is a vertical or horizontal letter
format, but you might find something different depending on your locale. */
size: portrait;
size: landscape;
/* Predefined format, can be coupled with an orientation. */
size: letter;
size: A4;
size: A4 landscape;
/* Custom, with same width and height. */
size: 10cm;
size: 420px;
size: 6in;
/* Different width and height. */
size: 640px 360px;
size: 20cm 15cm;
}
```
| null | CC BY-SA 4.0 | null | 2022-11-23T04:04:50.967 | 2022-11-23T04:04:50.967 | null | null | 6,727,914 | null |
74,541,777 | 2 | null | 74,024,072 | 0 | null | `$[DEFAULT_SERVICE_URL]` is the [default backend service](https://cloud.google.com/load-balancing/docs/url-map#url_map_defaults) or in your case, the default backend bucket if none of the path matchers or host rules match the incoming URL.
You can find a few examples from the [documention](https://cloud.google.com/load-balancing/docs/https/traffic-management-global#advanced_host_path_and_route_rule) as previously stated. You may also check this [Stackoverflow thread](https://stackoverflow.com/questions/74352537/google-cloud-load-balancer-routing-roles-not-working) for additional YAML sample.
| null | CC BY-SA 4.0 | null | 2022-11-23T04:23:32.163 | 2022-11-23T04:23:32.163 | null | null | 19,430,638 | null |
74,541,776 | 2 | null | 74,541,223 | 1 | null | I'm not sure if I completely understand the question, but to access the key of each `childSnapshot`, you'd do:
```
const childKey = childSnapshot.key;
```
If you want to store both the keys and the value for all products, you can do something like:
```
onValue(thumbnailRef, (snapshot) => {
snapshot.forEach((childSnapshot) => {
const childData = childSnapshot.val();
const childKey = childSnapshot.key;
setTestProducts((prev) => [...prev, { key: childKey, data: childData }]);
});
})
```
Or preferably with a single call to the state setter:
```
onValue(thumbnailRef, (snapshot) => {
let testProducts = []
snapshot.forEach((childSnapshot) => {
const childData = childSnapshot.val();
const childKey = childSnapshot.key;
testProducts.push({ key: childKey, data: childData });
});
setTestProducts((testProducts);
})
```
| null | CC BY-SA 4.0 | null | 2022-11-23T04:23:19.757 | 2022-11-23T04:23:19.757 | null | null | 209,103 | null |
74,542,372 | 2 | null | 74,536,233 | 0 | null | I have faced the same issue so I have make my own text editor with palceholder. Please have a loot at this simple code. You just need to Initialised it with binding variables for use.
```
import SwiftUI
struct MLBTextEditor: View {
var title: String
var text: Binding<String>
var placeHolder: String
@FocusState private var detailIsFocused: Bool
init(title: String, text: Binding<String>, placeholder: String) {
UITextView.appearance().backgroundColor = .clear
self.title = title
self.text = text
self.placeHolder = placeholder
}
var body: some View {
VStack(alignment: .leading, spacing: 7) {
if !title.isEmpty {
Text(title)
.font(.custom(Nunito.Medium.rawValue, size: 13))
}
ZStack(alignment: .topLeading) {
if text.wrappedValue.isEmpty {
Text(placeHolder)
.padding(.all)
.foregroundColor(.gray)
.font(.custom(Roboto.Regular.rawValue, size: 14))
}
TextEditor(text: text)
.font(.custom(Roboto.Regular.rawValue, size: 14))
.padding(15)
.focused($detailIsFocused)
.opacity(text.wrappedValue.isEmpty ? 0.25 : 1)
.foregroundColor(self.text.wrappedValue == placeHolder ? .gray : .primary)
// this onchange method is use to close the keyboard
.onChange(of: text.wrappedValue) { _ in
if !text.wrappedValue.filter({ $0.isNewline }).isEmpty {
detailIsFocused = false
}
}
}
.onTapGesture {
if text.wrappedValue.isEmpty {
text.wrappedValue = " "
}
}
.overlay(
RoundedRectangle(cornerRadius: 5)
.stroke(.gray, lineWidth: 1)
)
}
}
}
struct MLBTextEditor_Previews: PreviewProvider {
static var previews: some View {
MLBTextEditor(title: "", text: .constant(""), placeholder: "Name please")
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-23T05:58:59.097 | 2022-11-23T05:58:59.097 | null | null | 6,026,338 | null |
74,542,389 | 2 | null | 74,540,866 | 1 | null | set redirect back with message data in the controller.
```
return redirect()->back()->with([
'messaage' => 'Installer was successfully deleted',
])
```
HandleInertiaRequests middleware.
```
public function share(Request $request)
{
return array_merge(parent::share($request), [
'flash' => [
'message' => fn () => $request->session()->get('message'),
],
]);
}
```
in component.
```
<template>
{{ $page.props.flash.message }}
</template>
<script setup>
import { usePage } from '@inertiajs/inertia-vue3'
const message = usePage().props.value.flash.message
</script>
```
docs : [https://inertiajs.com/shared-data](https://inertiajs.com/shared-data)
| null | CC BY-SA 4.0 | null | 2022-11-23T06:01:42.717 | 2022-11-23T06:01:42.717 | null | null | 20,568,912 | null |
74,542,573 | 2 | null | 74,533,488 | 0 | null | Functions like f-string is introduced from Python 3.6.
Therefore, in order to solve this problem, you need to update to Python 3.6 or higher.
| null | CC BY-SA 4.0 | null | 2022-11-23T06:25:24.927 | 2022-11-23T06:25:24.927 | null | null | 18,359,438 | null |
74,542,718 | 2 | null | 74,531,450 | 0 | null | Binding the Minimum property of Slider 2 to Value of Slider 1 will work but may look ugly.
A really nice solution is described here:
[WPF slider with two thumbs](https://stackoverflow.com/questions/5395957/wpf-slider-with-two-thumbs?rq=1)
| null | CC BY-SA 4.0 | null | 2022-11-23T06:43:34.853 | 2022-11-23T06:43:34.853 | null | null | 17,815,346 | null |
74,543,198 | 2 | null | 74,542,850 | 0 | null | wrap with Container and color, and make sure you added expanded widget in about the container in case if you are using listview
| null | CC BY-SA 4.0 | null | 2022-11-23T07:36:46.497 | 2022-11-23T07:36:46.497 | null | null | 14,466,358 | null |
74,543,665 | 2 | null | 74,535,868 | 0 | null | The problem is that the `${header}` model is updated to contain the headers sent by the webbrowser (so it's not really an error). The easiest solution is to change the name of the model to something else, for example:
```
@RequestMapping("/ktSessions")
public String ktSessionsPage(Model model) {
model.addAttribute("options","option1");
model.addAttribute("headername","header1"); // Changed to "headername"
return "ktSessions";
}
```
Don't forget to change it in your JSP as well:
```
<p>Header is <c:out value="${headername}"></c:out> </p>
```
| null | CC BY-SA 4.0 | null | 2022-11-23T08:21:10.330 | 2022-11-23T08:21:10.330 | null | null | 1,915,448 | null |
74,544,018 | 2 | null | 20,800,633 | 0 | null | Update 2022:
I use `aapt2 dump badging` instead of `aapt dump badging`,and aapt2 will dump ok without errors
| null | CC BY-SA 4.0 | null | 2022-11-23T08:52:18.493 | 2022-11-23T08:52:18.493 | null | null | 1,323,374 | null |
74,544,055 | 2 | null | 74,543,988 | 1 | null | If you click on the arrow present just after `Current File`, you will find an option called `Edit Configurations`. There you can add your own variables for running your application. And yes, you can save your configuration using the `Save TEST_CLASS_NAME Configuration`.
[](https://i.stack.imgur.com/gzs7I.png)
| null | CC BY-SA 4.0 | null | 2022-11-23T08:55:19.543 | 2022-11-23T08:55:19.543 | null | null | 7,803,797 | null |
74,544,096 | 2 | null | 74,543,089 | 0 | null | I didn't look at your bat file the most common issue on this kind of think is that process run from java did'nt share the environnement variable of your local setup nor jvm a quick fix to verify that is :
```
pb.environment().putAll(System.getenv());
```
hoping this will work :) then you just have to found which specific environnment variable is missing :)
| null | CC BY-SA 4.0 | null | 2022-11-23T08:58:48.507 | 2022-11-23T08:58:48.507 | null | null | 9,630,748 | null |
74,544,345 | 2 | null | 74,544,277 | 0 | null | You can do it with [line-height](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height):
> The `line-height` CSS property sets the height of a line box. It's commonly used to set the distance between lines of text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height.
Demo:
```
.page li {
line-height: 2em;
}
```
```
<p>
with line-height:
</p>
<ul class="page">
<li>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Illo tempora quas similique sed quaerat commodi ipsum reiciendis nisi dolor repellat est aliquam quod at harum temporibus reprehenderit eaque, ut assumenda.</li>
<li>Vel praesentium accusamus nihil id fugit quasi aperiam perferendis harum quidem corporis aliquam, quod nobis architecto recusandae quaerat velit nesciunt necessitatibus quam pariatur expedita quibusdam! Quia odio similique velit veniam?</li>
<li>Adipisci earum aspernatur quibusdam optio id rem impedit nam soluta itaque porro illum maiores, accusantium cum veniam alias, nesciunt corporis voluptas natus enim repudiandae libero placeat quidem reprehenderit? Quam, ex.</li>
<li>Rerum voluptatem ratione harum officia, veniam ipsum. Quibusdam, quasi impedit consequuntur quaerat distinctio officia. Animi, laudantium deleniti quo illo, unde facere delectus nam modi dicta dolorum neque perferendis qui eaque.</li>
<li>Molestias quaerat dolorem fugiat error iste, tempora quos suscipit at eligendi nemo expedita harum facilis cumque quod provident tenetur consequatur placeat. Porro, rem et nostrum libero nisi inventore aut vero.</li>
<li>In autem possimus amet, aut mollitia reiciendis quae iure! Officia impedit maxime iusto repellat magni natus quasi magnam aliquam velit, inventore error earum incidunt nostrum consequatur sunt. Nihil, dolorum dolore.</li>
</ul>
<p>
vs without line-height:
</p>
<ul>
<li>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Illo tempora quas similique sed quaerat commodi ipsum reiciendis nisi dolor repellat est aliquam quod at harum temporibus reprehenderit eaque, ut assumenda.</li>
<li>Vel praesentium accusamus nihil id fugit quasi aperiam perferendis harum quidem corporis aliquam, quod nobis architecto recusandae quaerat velit nesciunt necessitatibus quam pariatur expedita quibusdam! Quia odio similique velit veniam?</li>
<li>Adipisci earum aspernatur quibusdam optio id rem impedit nam soluta itaque porro illum maiores, accusantium cum veniam alias, nesciunt corporis voluptas natus enim repudiandae libero placeat quidem reprehenderit? Quam, ex.</li>
<li>Rerum voluptatem ratione harum officia, veniam ipsum. Quibusdam, quasi impedit consequuntur quaerat distinctio officia. Animi, laudantium deleniti quo illo, unde facere delectus nam modi dicta dolorum neque perferendis qui eaque.</li>
<li>Molestias quaerat dolorem fugiat error iste, tempora quos suscipit at eligendi nemo expedita harum facilis cumque quod provident tenetur consequatur placeat. Porro, rem et nostrum libero nisi inventore aut vero.</li>
<li>In autem possimus amet, aut mollitia reiciendis quae iure! Officia impedit maxime iusto repellat magni natus quasi magnam aliquam velit, inventore error earum incidunt nostrum consequatur sunt. Nihil, dolorum dolore.</li>
</ul>
```
| null | CC BY-SA 4.0 | null | 2022-11-23T09:19:26.747 | 2022-11-23T09:19:26.747 | null | null | 1,248,177 | null |
74,544,351 | 2 | null | 74,543,361 | 0 | null | Always check if your elements are available before calling the attributes:
```
'cust_name': info.find('img', {'class':'card__logo'})['alt'] if info.find('img', {'class':'card__logo'}) else 'No Image',
```
#### Example
```
import requests
from bs4 import BeautifulSoup
import pandas as pd
list_c = []
for n in range(0,35): # Ask hosting server to fetch url
url = f'https://www.tableau.com/solutions/customers?region=All&industry=All&department=All&page={n}'
pages = requests.get(url)
soup = BeautifulSoup(pages.text, 'html.parser') #parse
cus_info = soup.find_all('div',{'class': 'card__details'}) #find all tags <img...>
for info in cus_info:
customer_info = {
'cust_name': info.find('img', {'class':'card__logo'})['alt'] if info.find('img', {'class':'card__logo'}) else 'No Image',
'cust_use' : info.find('h3', {'class':'card__title'}).get_text(),
'cust_url': 'www.tableau.com'+ info.find('a', {'class':''})['href'],
'cust_logo' : 'www.tableau.com'+ info.find('img', {'class':'card__logo'})['src'] if info.find('img', {'class':'card__logo'}) else 'No Image'
}
list_c.append(customer_info)
df_c = pd.DataFrame(list_c)
df_c
```
#### Output
| | cust_name | cust_use | cust_url | cust_logo |
| | --------- | -------- | -------- | --------- |
| 0 | Logo for World Food Programme | UN World Food Programme promotes organization-wide data literacy to advance food security worldwide | www.tableau.com/solutions/customer/un-world-food-programme-promotes-organization-wide-data-literacy | www.tableau.com/sites/default/files/styles/scale_220x60/public/companies/wfp_logo_0.png?itok=VUCFlWZn |
| 1 | Logo for Verizon Communications | Verizon uses Tableau to reduce support calls by 43%, enhancing customer experience | www.tableau.com/solutions/customer/verizon-reduces-calls-enhances-customer-experience-with-tableau | www.tableau.com/sites/default/files/styles/scale_220x60/public/companies/verizon_logo.png?itok=Hgt5ZJc4 |
| ... | ... | ... | ... | |
| 313 | Logo for MillerCoors USA | MillerCoors discovers sales opportunities, selling more product to retailers with Tableau Cloud | www.tableau.com/solutions/customer/millercoors-satisfies-their-thirst-better-data-tableau-online | www.tableau.com/sites/default/files/styles/scale_220x60/public/companies/miller_coors_-_a_mc_company_1.png?itok=HhsaBzvq |
| 314 | No Image | Masabi makes city transport smarter with help from Tableau | www.tableau.com/solutions/customer/masabi-makes-city-transport-smarter-help-tableau | No Image |
| null | CC BY-SA 4.0 | null | 2022-11-23T09:19:55.700 | 2022-11-23T09:43:33.337 | 2022-11-23T09:43:33.337 | 14,460,824 | 14,460,824 | null |
74,544,460 | 2 | null | 74,543,348 | 0 | null |
```
Get-AzAksVersion -Location canadacentral | where-Object {($.OrchestratorVersion -gt '1.23.12') -and ($.IsPreview -ne 'True')} | foreach {$_.OrchestratorVersion}
```
Its giving the same output , and its correct .
If I checked the lower versions than , I can see 1.23.12 which is obviously less that that.
```
Get-AzAksVersion -Location canadacentral | where-Object {($_.OrchestratorVersion -lt '1.23.8') -and ($_.IsPreview -ne 'True')} | foreach {$_.OrchestratorVersion}
```
```
1.22.11
1.22.15
1.23.12
```
[](https://i.stack.imgur.com/TaItK.png)
Here it is needed to observe that it is after dot(.) and >12 ( 1.23.12 )
Checked the same for greater than 1.23.32
[](https://i.stack.imgur.com/89Ie6.png)
| null | CC BY-SA 4.0 | null | 2022-11-23T09:28:46.153 | 2022-11-23T09:28:46.153 | null | null | 15,997,509 | null |
74,544,671 | 2 | null | 74,542,790 | 1 | null | actually, this is not a bug and it is pretty common. its called a floating point "error" and in a nutshell, it has to do things with how decimal numbers are stored within a google sheets (even [excel](http://support.microsoft.com/kb/78113) or any other app)
more details can be found here: [https://en.wikipedia.org/wiki/IEEE_754](https://en.wikipedia.org/wiki/IEEE_754)
to counter it you will need to introduce rounding like:
```
=ROUND(SUM(A1:A))
```
this is not an ideal solution for all cases so depending on your requirements you may need to use these instead of `ROUND`:
```
ROUNDUP
ROUNDDOWN
TRUNC
TEXT
```
| null | CC BY-SA 4.0 | null | 2022-11-23T09:42:42.350 | 2022-11-23T09:42:42.350 | null | null | 5,632,629 | null |
74,545,028 | 2 | null | 28,318,273 | -1 | null | ```
div {
background: #eee;
height: 100px;
box-shadow: 7px 7px 0px 7px #cccccc, -7px -7px 0 7px #cccccc;
margin: 15px;
}
```
```
<div></div>
```
| null | CC BY-SA 4.0 | null | 2022-11-23T10:07:50.343 | 2023-01-30T20:51:33.587 | 2023-01-30T20:51:33.587 | 3,749,896 | 15,470,818 | null |
74,545,084 | 2 | null | 74,544,090 | 0 | null | You can use [styled mode](https://api.highcharts.com/highcharts/chart.styledMode) to hide grid line on yaxis, article of [how to style by css](https://www.highcharts.com/docs/chart-design-and-style/style-by-css#style-by-css). Catch the last element using CSS pseudo-class [:last-of-type](https://developer.mozilla.org/en-US/docs/Web/CSS/:last-of-type) and choose how to hide visibility `stroke: transparent;` or `stroke: transparent;`.
```
.highcharts-yaxis-grid path:last-of-type {
/* stroke: transparent; */
stroke-width: 0px;
}
```
Demo: [https://jsfiddle.net/BlackLabel/xdrj846h/](https://jsfiddle.net/BlackLabel/xdrj846h/)
| null | CC BY-SA 4.0 | null | 2022-11-23T10:11:47.470 | 2022-11-23T10:11:47.470 | null | null | 12,171,673 | null |
74,545,183 | 2 | null | 74,544,384 | 1 | null | A script passed via User Data will only be executed on the of the instance. (Actually, the first boot per Instance ID.)
If you want to debug the script, the log file is available in:
```
/var/log/cloud-init-output.log
```
Your attempt to redirect to a file with `echo ' ... ' >init-ssl.sh` is being thwarted by the fact that the script contains a single quote (`'`), which is closing the `echo` early. You should use different quotes to avoid this happening. Or, as @Mornor points out, simply run the script directly. If you want to sleep for a bit up-front, then just put the `sleep()` at the start of the script.
| null | CC BY-SA 4.0 | null | 2022-11-23T10:17:52.970 | 2022-11-23T20:38:02.767 | 2022-11-23T20:38:02.767 | 174,777 | 174,777 | null |
74,545,174 | 2 | null | 74,522,240 | 2 | null | My first answer doesn't feel like doing any justice since it's far from the gif you posted which shows what you want.
So here's another one that closely resembles it. However, I feel like this implementation is not very efficient in terms of calling sequences of animations, but in terms of `re-composition` I incorporated some optimization strategy called [deferred reading](https://medium.com/androiddevelopers/jetpack-compose-debugging-recomposition-bfcf4a6f8d37), making sure only the composables that observes the values will be the only parts that will be re-composed. I left a `Log` statement in the parent progress composable to verify it, the `ArcProgressbar` is not updating unnecessarily when the progress is animating.
```
Log.e("ArcProgressBar", "Recomposed")
```
Full source code that you can copy-and-paste () without any issues.
```
val maxProgressPerLevel = 200 // you can change this to any max value that you want
val progressLimit = 300f
fun calculate(
score: Float,
level: Int,
) : Float {
return (abs(score - (maxProgressPerLevel * level)) / maxProgressPerLevel) * progressLimit
}
@Composable
fun ArcProgressbar(
modifier: Modifier = Modifier,
score: Float
) {
Log.e("ArcProgressBar", "Recomposed")
var level by remember {
mutableStateOf(score.toInt() / maxProgressPerLevel)
}
var targetAnimatedValue = calculate(score, level)
val progressAnimate = remember { Animatable(targetAnimatedValue) }
val scoreAnimate = remember { Animatable(0f) }
val coroutineScope = rememberCoroutineScope()
LaunchedEffect(level, score) {
if (score > 0f) {
// animate progress
coroutineScope.launch {
progressAnimate.animateTo(
targetValue = targetAnimatedValue,
animationSpec = tween(
durationMillis = 1000
)
) {
if (value >= progressLimit) {
coroutineScope.launch {
level++
progressAnimate.snapTo(0f)
}
}
}
}
// animate score
coroutineScope.launch {
if (scoreAnimate.value > score) {
scoreAnimate.snapTo(0f)
}
scoreAnimate.animateTo(
targetValue = score,
animationSpec = tween(
durationMillis = 1000
)
)
}
}
}
Column(
modifier = modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally
) {
Box {
PointsProgress(
progress = {
progressAnimate.value // deferred read of progress
}
)
CollectorLevel(
modifier = Modifier.align(Alignment.Center),
level = {
level + 1 // deferred read of level
}
)
}
CollectorScore(
modifier = Modifier.padding(top = 16.dp),
score = {
scoreAnimate.value // deferred read of score
}
)
}
}
@Composable
fun CollectorScore(
modifier : Modifier = Modifier,
score: () -> Float
) {
Column(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = "Collector Score",
color = Color.White,
fontSize = 16.sp
)
Text(
text = "${score().toInt()} PTS",
color = Color.White,
fontSize = 40.sp
)
}
}
@Composable
fun CollectorLevel(
modifier : Modifier = Modifier,
level: () -> Int
) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
modifier = Modifier
.padding(top = 16.dp),
text = level().toString(),
color = Color.White,
fontSize = 82.sp
)
Text(
text = "LEVEL",
color = Color.White,
fontSize = 16.sp
)
}
}
@Composable
fun BoxScope.PointsProgress(
progress: () -> Float
) {
val start = 120f
val end = 300f
val thickness = 8.dp
Canvas(
modifier = Modifier
.fillMaxWidth(0.45f)
.padding(10.dp)
.aspectRatio(1f)
.align(Alignment.Center),
onDraw = {
// Background Arc
drawArc(
color = Color.LightGray,
startAngle = start,
sweepAngle = end,
useCenter = false,
style = Stroke(thickness.toPx(), cap = StrokeCap.Square),
size = Size(size.width, size.height)
)
// Foreground Arc
drawArc(
color = Color(0xFF3db39f),
startAngle = start,
sweepAngle = progress(),
useCenter = false,
style = Stroke(thickness.toPx(), cap = StrokeCap.Square),
size = Size(size.width, size.height)
)
}
)
}
```
Sample usage:
```
@Composable
fun PrizeProgressScreen() {
var score by remember {
mutableStateOf(0f)
}
var scoreInput by remember {
mutableStateOf("0")
}
Column(
modifier = Modifier
.fillMaxSize()
.background(Color(0xFF6b4cba)),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
modifier = Modifier
.padding(vertical = 16.dp),
text = "Progress for every level up: $maxProgressPerLevel",
color = Color.LightGray,
fontSize = 16.sp
)
ArcProgressbar(
score = score,
)
Button(onClick = {
score += scoreInput.toFloat()
}) {
Text("Add Score")
}
TextField(
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
value = scoreInput,
onValueChange = {
scoreInput = it
}
)
}
}
```
[](https://i.stack.imgur.com/mvUS4.gif)
[](https://i.stack.imgur.com/iSXHa.gif)
| null | CC BY-SA 4.0 | null | 2022-11-23T10:17:22.790 | 2022-11-23T14:27:20.313 | 2022-11-23T14:27:20.313 | 19,023,745 | 19,023,745 | null |
74,545,302 | 2 | null | 69,289,289 | 1 | null | Try adding the following arg to the command:
```
--platform=linux/amd64
```
or alternatively use the following command to set an env var:
```
export DOCKER_DEFAULT_PLATFORM=linux/amd64
```
| null | CC BY-SA 4.0 | null | 2022-11-23T10:27:39.200 | 2022-11-28T11:11:20.993 | 2022-11-28T11:11:20.993 | 2,963,422 | 10,037,807 | null |
74,545,331 | 2 | null | 74,543,089 | 0 | null | Try `pb.inheritIO();` before you call its start method. What you seem to have is a hybrid batch/Powershell script that that relies on stderr to determine which of the two it executes so this should require correct processing of stderr.
| null | CC BY-SA 4.0 | null | 2022-11-23T10:29:33.883 | 2022-11-23T10:29:33.883 | null | null | 16,376,827 | null |
74,545,375 | 2 | null | 19,066,982 | -1 | null | bypass alternative with:
use "font_face": "Bahnschrift Light",
instead "font_face": "Bahnschrift",
some how: its notworking with font-weight
| null | CC BY-SA 4.0 | null | 2022-11-23T10:32:05.797 | 2022-11-23T10:32:05.797 | null | null | 15,009,551 | null |
74,546,179 | 2 | null | 74,545,704 | 0 | null | The labels used by the UI might not correspond 1-to-1 with the actual key names in the configuration schema - for example, the real key name for `Key File Path` is just `KeyFilePath`
To figure out what to use, simply consult [the documentation](https://simba.wpengine.com/products/BigQuery/doc/ODBC_InstallGuide/win/content/odbc/bq/options/options-general.htm) and find the appropriate key name for a given configuration option in the UI, then use those, e.g.:
```
Set-OdbcDsn -Name "My_Connew" -SetPropertyValue @(
"[email protected]",
"KeyFilePath=C:\vocus-sandpit-dfa36ce40776.json",
"Catalog=vocus-sandpitvocus-sandpit",
"DefaultDataset=vocus_rawnew"
)
```
| null | CC BY-SA 4.0 | null | 2022-11-23T11:37:10.943 | 2022-11-23T11:37:10.943 | null | null | 712,649 | null |
74,546,439 | 2 | null | 13,509,989 | 0 | null | You can simply change the height from XML using
```
android:layout_height="20dp"
```
| null | CC BY-SA 4.0 | null | 2022-11-23T11:58:03.723 | 2022-11-23T11:58:03.723 | null | null | 6,253,148 | null |
74,546,436 | 2 | null | 74,544,653 | 0 | null | you can do it if it's possible to separate the two lines in heading,
html:
```
<header>
<div>
<div class="first-line">
<p>
sample title, pretty long
<div className={css.container}>
<div className={css.shine1}></div>
<div className={css.shine2}></div>
<div className={css.shine3}></div>
</div>
</p>
</div>
<p>
that is wrapping in two lines
</p>
</div>
</header>
```
css :
```
header .first-line{
position: relative;
display: inline-block;
}
.container {
position: absolute;
display: inline;
top: 20px;
right: 5px;
}
.container div {
position: absolute;
height: 5px;
border-radius: 5px;
background-color: red;
transform-origin: bottom left;
}
.shine1 {
width: 26px;
transform: rotate(-95deg) translate(20px, 5px);
}
.shine2 {
width: 32px;
transform: rotate(-45deg) translate(20px);
}
.shine3 {
width: 26px;
transform: rotate(0deg) translate(15px);
}
```
| null | CC BY-SA 4.0 | null | 2022-11-23T11:57:53.363 | 2022-11-23T11:57:53.363 | null | null | 13,720,213 | null |
74,546,449 | 2 | null | 15,277,460 | 0 | null | I could not get the suggested methods to work when using a androidx.preference.PreferenceDialogFragmentCompat.
What ultimately worked was adding the following method to the PreferenceDialogFragmentCompat:
```
/**
* This is needed to get a dialog without a title.
*/
@Override
protected void onPrepareDialogBuilder(@NonNull AlertDialog.Builder builder) {
super.onPrepareDialogBuilder(builder);
builder.setTitle(null);
}
```
| null | CC BY-SA 4.0 | null | 2022-11-23T11:59:07.593 | 2022-11-23T11:59:07.593 | null | null | 3,911,287 | null |
74,546,599 | 2 | null | 74,546,483 | 0 | null | Please see here for detailed anwser:
[What is the meaning of exclamation and question marks in Jupyter notebook?](https://stackoverflow.com/questions/53498226/what-is-the-meaning-of-exclamation-and-question-marks-in-jupyter-notebook)
What `!pip` is doing in your case is:
`cmd> pip`
and pip is not a valid windows cmd command.
What you're looking for might be:
`%pip list`
edit: this is my guess, I don't have a windows computer here to test this
| null | CC BY-SA 4.0 | null | 2022-11-23T12:11:23.020 | 2022-11-23T12:11:23.020 | null | null | 14,571,316 | null |
74,546,688 | 2 | null | 36,391,120 | 0 | null | select concat(name,'(',upper(left(occupation,1)),')') as name
from occupations
order by name;
select concat('There are a total of ',count()
| null | CC BY-SA 4.0 | null | 2022-11-23T12:19:44.637 | 2022-11-23T12:19:44.637 | null | null | 16,926,348 | null |
74,547,172 | 2 | null | 68,379,442 | 0 | null | Pass the style (that you called it "df2") with html:
```
st.write(df2.to_html(), unsafe_allow_html=True))
```
| null | CC BY-SA 4.0 | null | 2022-11-23T12:56:49.003 | 2022-11-23T12:56:49.003 | null | null | 18,660,783 | null |
74,547,209 | 2 | null | 74,541,436 | 1 | null | Thanks for the question and detailed reprex.
The problem is in the two lines:
```
e1 <- as.data.frame(get_aws_points(pts), z = 1)
e2 <- as.data.frame(get_aws_points(pts), z = 14)
```
The `z` argument is an argument for `get_aws_points`. You are passing it as an argument for `as.data.frame`. As such, your elevations on `e1` and `e2` are both using the default `z` of 5 which returns a large pixel (several km). I wouldn't expect the USGS and the AWS with `z` of 5 elevations to very closely match.
If you change those two lines to:
```
e1 <- as.data.frame(get_aws_points(pts, z = 1))
e2 <- as.data.frame(get_aws_points(pts, z = 14))
```
Then you will get what you want. The `e1` elevations will be very different than USGS, but the `e2` elevations should be very close. Big caveat here... `z=14` will return a raster for approximately all of California with an approximate pixel size of 7 meters. This will be large! I would scale this back. I tested it with a `z = 10` and the difference between the two sources ranged from -81 to 52 meters. This is expected as the terrain tiles scale based on the zoom so the elevation at a given zoom level will be resampled. The USGS point service is pulling directly from a the 10m NED and is not resampled.
Also, since your point elevations are all in the US, I would use the USGS point elevation service for these data and not mess with the AWS source. The AWS point elevations are, admittedly, a bit of a hack to have a point elevations for global applications. There is no global analogue to the USGS service that I know of.
| null | CC BY-SA 4.0 | null | 2022-11-23T12:59:42.063 | 2022-11-23T13:16:08.223 | 2022-11-23T13:16:08.223 | 3,069,901 | 3,069,901 | null |
74,547,268 | 2 | null | 74,546,348 | 0 | null | If there should only be one element with the class `.show` you could select that class for the removement before adding that class to the new element:
```
$('.show').removeClass('show');
```
Would look in your code like this:
```
$( ".main-menu-link-container" ).click(function() {
var index = $( ".main-menu-link-container" ).index( this );
$( ".show" ).removeClass( "show" );
$( ".subcategory-menu-links-wrapper" ).eq(index).addClass( "show" );
});
```
| null | CC BY-SA 4.0 | null | 2022-11-23T13:03:33.860 | 2022-11-23T13:03:33.860 | null | null | 15,377,355 | null |
74,548,089 | 2 | null | 74,547,067 | 0 | null | You should use the DATE data type, and you can easily insert your dates using TO_DATE function:
```
create table test_dates( d date );
insert into test_dates values ( TO_DATE( '31-12-2014', 'DD-MM-YYYY' ));
select * from test_dates;
```
Date & Time Data Types: [https://docs.snowflake.com/en/sql-reference/data-types-datetime.html](https://docs.snowflake.com/en/sql-reference/data-types-datetime.html)
TO_DATE: [https://docs.snowflake.com/en/sql-reference/functions/to_date.html](https://docs.snowflake.com/en/sql-reference/functions/to_date.html)
| null | CC BY-SA 4.0 | null | 2022-11-23T14:06:25.693 | 2022-11-23T14:06:25.693 | null | null | 12,550,965 | null |
74,548,130 | 2 | null | 14,828,144 | 0 | null | Future visitors see this similar post:
[Inno Setup - How can I change the About dialog text?](https://stackoverflow.com/questions/61737682/inno-setup-how-can-i-change-the-about-dialog-text)
Try to use the built-in function for this:
- `AboutSetupNote``TranslatorNote`
| null | CC BY-SA 4.0 | null | 2022-11-23T14:08:45.127 | 2022-11-23T14:08:45.127 | null | null | 5,124,710 | null |
74,548,145 | 2 | null | 28,551,948 | 1 | null | Do not hardcode style to your app.
1. Choice theme.
2. Install tcl-ttkthemes, python3-ttkthemes package.
3. Add *TkTheme: your_theme_name to ~/.Xresources.
4. Reload X server or execute: xrdb -merge ~/.Xresources && source ~/.profile
| null | CC BY-SA 4.0 | null | 2022-11-23T14:09:39.580 | 2022-11-23T14:09:39.580 | null | null | 6,146,442 | null |
74,548,162 | 2 | null | 74,547,148 | 1 | null | I am not sure about all your your conditions but this one could do it:
```
UPDATE a
SET approval =
CASE WHEN
a.customer <> a.customer_new OR
a.customer = a.customer_new AND b.sale_short_eq = 0 OR
a.customer = a.customer_new AND a.sale_id = b.max_len_sale_id
THEN 'Y'
ELSE 'N'
END
FROM
thetable a
INNER JOIN (
SELECT
customer,
CASE WHEN MIN(sale_short_id) = MAX(sale_short_id) THEN 1 ELSE 0 END AS sale_short_eq,
( SELECT TOP 1 sale_id
FROM thetable
WHERE customer = c.customer
ORDER BY LEN(sale_id) DESC
) AS max_len_sale_id
FROM thetable c
GROUP BY customer
) b
ON a.customer = b.customer
```
Note that the columns `b.sale_short_eq` and `b.max_len_sale_id` are returned by a sub-query joined to the main query.
Especially `SALE_SHORT_ID HAS THE SAME VALUE THEN MAX(LEN(SALE_ID)` is not clear. Did you mean that SALE_ID must be the same as the maximum length SALE_ID? Because SALE_SHORT_ID cannot be the same than any SALE_ID. And what happens if two different SALE_IDs have the same max length?
See: [https://dbfiddle.uk/7Ct87-Mk](https://dbfiddle.uk/7Ct87-Mk)
| null | CC BY-SA 4.0 | null | 2022-11-23T14:10:40.260 | 2022-11-24T13:34:12.380 | 2022-11-24T13:34:12.380 | 880,990 | 880,990 | null |
74,548,259 | 2 | null | 74,544,653 | 1 | null | I have figured it out.
Although my solution is very "hacky", it works fine in any test case I thought about.
My solution is to create a hidden replica of the first line on top of the title with the same css properties. Once that is done I just get the width of the replica and use that value to define the `left` property of my sunshines.
This is the function I use to get the first line of the text :
```
const getFirstLine = el => {
const text = el.innerHTML;
//set the innerHTML to a character
el.innerHTML = 'a';
//get the offsetheight of the single character
const singleLineHeight = el.offsetHeight;
//split all innerHTML on spaces
const arr = text.split(' ');
//cur is the current value of the text we are testing to see if
//it exceeds the singleLineHeight when set as innerHTML
//prev is the previously tested string that did not exceed the singleLineHeight
//cur and prev start as empty strings
let cur = '';
let prev = '';
//loop through, up to array length
for (let i = 0; i < arr.length; i++) {
//examine the rest of text that is not already in previous string
const restOfText = text.substring(prev.length, text.length);
//the next space that is not at index 0
const nextIndex =
restOfText.indexOf(' ') === 0
? restOfText.substring(1, restOfText.length).indexOf(' ') + 1
: restOfText.indexOf(' ');
//the next part of the rest of the text
cur += restOfText.substring(0, nextIndex);
//set the innerHTML to the current text
el.innerHTML = cur;
//now we can check its offsetHeight
if (el.offsetHeight > singleLineHeight) {
//once offsetHeight of cur exceeds singleLineHeight
//previous is the first line of text
//set innerHTML = prev so
el.innerHTML = prev;
//we can grab the innertext
const firstLine = el.innerText;
const indexOfSecondLine = prev.lastIndexOf('<');
//reset el
el.innerHTML = text;
return firstLine;
}
//offsetheight did not exceed singleLineHeight
//so set previous = cur and loop again
//prev = cur + ' ';
prev += cur.substring(prev.length, cur.length);
}
el.innerHTML = text;
return text;
};
```
If you want to do the same be careful to wait for the fonts of the web page to be loaded or the width you will be getting will be wrong.
```
document.fonts.ready.then(function () {})
```
I have also managed to handle when the title has the `text-align: center;` property by adding a `margin-left/right: auto;` to the replica that I then get and add to the calculated `left` using this :
```
parseInt(window.getComputedStyle(invisibleTitle).marginLeft)
```
I know it is not perfect, but since there is no easy way to do that in css it is the only working way that I found.
| null | CC BY-SA 4.0 | null | 2022-11-23T14:18:13.980 | 2022-11-23T15:34:46.270 | 2022-11-23T15:34:46.270 | 2,756,409 | 19,555,540 | null |
74,548,291 | 2 | null | 74,548,191 | 1 | null | there isn't such a function. you will need to try something like:
```
=INDEX(IFNA(VLOOKUP(REGEXREPLACE(TO_TEXT(A1:A3), "[0-9, ]", ),
{"$", "USD"; "€", "EUR"; "zł", "PLN"}, 2, 0)))
```
also, you may want to see: [https://stackoverflow.com/questions/73767719/locale-differences-in-google-sheets-documentation-missing-pages](https://stackoverflow.com/questions/73767719/locale-differences-in-google-sheets-documentation-missing-pages)
[](https://i.stack.imgur.com/wMKLr.png)
| null | CC BY-SA 4.0 | null | 2022-11-23T14:20:45.133 | 2022-11-23T18:00:49.620 | 2022-11-23T18:00:49.620 | 5,632,629 | 5,632,629 | null |
74,548,333 | 2 | null | 25,639,251 | 0 | null | by jQuery in Multiple mode:
```
var selectedValues = ["1", "2"];
$('.my_select').val(selectedValues).trigger('change');
```
| null | CC BY-SA 4.0 | null | 2022-11-23T14:23:23.273 | 2022-11-23T14:23:23.273 | null | null | 12,182,913 | null |
74,548,700 | 2 | null | 74,479,392 | 0 | null | If you're using Python3, you don't need to encode or decode anything. Strings are unicode by default:
```
>>> title = "جامعة المبروك"
>>> print(title)
جامعة المبروك
```
As mentioned in the comments, you shouldn't use `str` as a variable name, because it's a built-in function in Python. (You can tell it's a built-in function because it's red in your code.) Built-in functions are reserved, and overwriting them can cause unpredictable behavior.
But that's not actually your problem here. The code where you're trying to en-/decode is what's causing the jibberish:
```
>>> title = "جامعة المبروك"
>>> title = title.encode('utf-8')
>>> title = title.decode('latin1')
>>> print(title)
Ø¬Ø§ÙØ¹Ø© اÙÙØ¨Ø±ÙÙ
```
Just take that out (and change your variable name) and you should be fine.
حظ سعيد
| null | CC BY-SA 4.0 | null | 2022-11-23T14:49:14.617 | 2022-11-23T14:49:14.617 | null | null | 1,333,623 | null |
74,549,136 | 2 | null | 29,830,563 | 0 | null | Thanks a lot for the previus answer, I do this in my proyect and it run well, but at least in my case I need to put before the other instructions.
This works fine
```
gulp.src(['**/*.html'])
.pipe(convertEncoding({ from: "windows1250", to: "utf8" }))
.pipe(replace(/\n\s*\n/g,'\n'))
.pipe(gulp.dest('./DIST/'));
```
This doesn't work fine
```
gulp.src(['**/*.html'])
.pipe(replace(/\n\s*\n/g,'\n'))
.pipe(convertEncoding({ from: "windows1250", to: "utf8" }))
.pipe(gulp.dest('./DIST/'));
```
| null | CC BY-SA 4.0 | null | 2022-11-23T15:18:25.390 | 2022-11-23T15:18:25.390 | null | null | 3,303,585 | null |
74,549,222 | 2 | null | 74,525,297 | 0 | null | Thank you!
I created it like this and its almost the same:
```
.parent {
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: white;
}
.left {
float: left;
line-height: 50px;
font-size: 1.5em;
padding-right: 15px;
font-weight: bold;
}
.right {
overflow:hidden;
line-height: 50px;
padding-left: 15px;
border-left: 1px rgb(46, 46, 46) solid;
width:fit-content;
}
```
| null | CC BY-SA 4.0 | null | 2022-11-23T15:23:44.073 | 2022-11-23T15:23:44.073 | null | null | 19,127,095 | null |
74,549,334 | 2 | null | 74,548,902 | 0 | null | I have declared a function to handle stroking and clipping:
```
public extension View {
/// Clips a View to given `Shape` and traces the outline with a line in the given `Color`
func outlined<S>(
with shape: S,
in color: Color,
lineWidth: CGFloat
) -> some View where S: Shape {
clipShape(shape)
.overlay(
shape.stroke(color, lineWidth: lineWidth))
.contentShape(shape)
}
}
```
so then you can simply define your views like this:
```
struct ContentView: View {
@StateObject private var cardState = CardState()
var body: some View {
VStack {
CardView(text: "Hello, world")
.shadow(radius: cardState.isSelected ? 6 : 0)
.onTapGesture {
cardState.isSelected.toggle()
}
}
.padding(20)
}
}
struct CardView: View {
private(set) var text: String
var body: some View {
VStack {
Spacer()
HStack {
Spacer()
Text(text).font(.system(.largeTitle))
Spacer()
}
Spacer()
}
.background(Color.white)
.outlined(
with: RoundedRectangle(cornerRadius: 20),
in: .blue,
lineWidth: 2
)
}
}
```
| null | CC BY-SA 4.0 | null | 2022-11-23T15:31:49.090 | 2022-11-23T16:52:46.790 | 2022-11-23T16:52:46.790 | 7,948,372 | 7,948,372 | null |
74,549,394 | 2 | null | 25,428,611 | 1 | null | This solution works, even using late binding, so you do not need to add a library manually:
```
Public Function CheckUrlExists(url) As Boolean
On Error GoTo CheckUrlExists_Error
Dim xmlhttp As Object
Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "HEAD", url, False
xmlhttp.send
If xmlhttp.Status = 200 Then
CheckUrlExists = True
Else
CheckUrlExists = False
End If
Exit Function
CheckUrlExists_Error:
CheckUrlExists = False
End Function
```
| null | CC BY-SA 4.0 | null | 2022-11-23T15:36:00.263 | 2022-11-23T15:36:00.263 | null | null | 5,448,626 | null |
74,549,401 | 2 | null | 74,533,118 | 1 | null | You never update the value in `b`. In point of fact, `b` is not necessary to your program at all. Your printing strategy is also more complicated than it needs to be. Print `a` minus `7`, then do the subtraction and print it. This prevents the program telling you the rest of `6 - 7` is `6`.
```
program _Gul_;
uses
crt;
var
a: integer;
begin
a := 1000;
while a > 0 do
begin
writeln (a, ' - 7?');
delay(120);
a := a - 7;
writeln (a);
if a = 6 then
break;
end;
writeln('я гуль')
end.
```
| null | CC BY-SA 4.0 | null | 2022-11-23T15:36:31.067 | 2022-11-23T15:36:31.067 | null | null | 15,261,315 | null |
74,549,409 | 2 | null | 74,525,297 | 1 | null | You could use flex container which I find cleaner, with a simple div that represents the vertical ruler you need.
```
html,body {
margin: 0;
font-family: sans-serif
}
#container {
height: 100vh;
width: 100vw;
background: #000;
display: flex;
justify-content: center;
gap: 10px;
align-items: center;
color: #fff;
}
.border {
height: 1rem;
border-right: 1px solid #8d8d8d;
}
.small {
font-size: 12px;
}
```
```
<div id="container">
<span>500</span>
<div class="border"></div>
<span class="small">internal server error</span>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-11-23T15:36:56.627 | 2022-11-23T15:36:56.627 | null | null | 7,935,545 | null |
74,549,423 | 2 | null | 74,503,713 | 0 | null | you should be learning how to convert from json into array in kotlin ways and you should be working on Parcelable Data Class for eficiency data transfer.
Each pressed button/list item should passing a certain data object includes Contributor, Document ID,etc to a detail screen using Parcelable Data Class.
| null | CC BY-SA 4.0 | null | 2022-11-23T15:38:05.880 | 2022-11-23T15:38:05.880 | null | null | 20,583,476 | null |
74,550,433 | 2 | null | 57,053,728 | 1 | null | >
```
yarn add @mdi/font -D
```
// OR
```
npm install @mdi/font -D
```
```
import '@mdi/font/css/materialdesignicons.css' // Ensure you are using css-loader
import { createVuetify } from 'vuetify'
export default createVuetify({
icons: {
defaultSet: 'mdi', // This is already the default value - only for display purposes
},
})
```
| null | CC BY-SA 4.0 | null | 2022-11-23T16:54:24.710 | 2022-11-23T16:54:24.710 | null | null | 12,456,014 | null |
74,550,524 | 2 | null | 74,550,429 | -1 | null | ```
<div class="card" style="width: 16.5rem; margin-left: 20px;>
```
i use px but you can use rem, cm, etc.
| null | CC BY-SA 4.0 | null | 2022-11-23T17:01:05.850 | 2022-11-23T17:01:05.850 | null | null | 16,255,006 | null |
74,550,575 | 2 | null | 74,541,233 | 0 | null | When the documentation says something like "The frame buffer is at `0xa0000 - 0xaffff` they're referring to physical addressing, which isn't how the 8086 CPU is able to address memory. It uses a segment-offset system, which means that you need to use your segment registers `ds` or `es` to point to the upper four hex digits. It's a bit confusing, but what ends up happening is that the value in DS or ES is effectively multiplied by 16 and the value in SI or DI is added to that value, which is used to figure out the address to write to. This all happens automatically.
This example uses VGA mode 13H (320x200, 8bpp) but you'll get the idea.
```
mov ax,13h
int 10h ;enter 256 color VGA mode
mov ax,0A000h
mov es,ax ;you can't MOV a constant directly into ES so you need to use another register first.
mov di,0 ;when combined together, [es:di] aliases address 0xA0000
mov al,0Fh ;white
stosb ;mov [es:di],al
```
Hopefully that helps, I've never used a 386 CPU so all I know is the 16-bit version.
| null | CC BY-SA 4.0 | null | 2022-11-23T17:05:16.563 | 2022-12-20T11:15:10.673 | 2022-12-20T11:15:10.673 | 16,589,128 | 16,589,128 | null |
74,550,692 | 2 | null | 74,550,429 | 0 | null |
1. Don't put sizes on the cards. Use the grid to control sizing.
2. Rows require containers around them.
3. Don't use inline styles. That makes work harder for everyone, and much of what you might do with it can be done with Bootstrap features anyway. If you need custom styles, use a custom class.
4. The center element is deprecated. Don't use it. Use Bootstrap's text alignment or flex layout features instead.
```
.col.mw-16_5 {
max-width: 16.5rem;
}
```
```
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<div class="container">
<div class="row justify-content-center">
<div class="col mw-16_5">
<div class="card">
<img src="https://via.placeholder.com/300x100" class="card-img-top" alt="..." />
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col mw-16_5">
<div class="card">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col mw-16_5">
<div class="card">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col mw-16_5">
<div class="card">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
</div>
</div>
```
All that said, you might just want to use basic [flexbox layout](https://getbootstrap.com/docs/5.2/utilities/flex/) instead of rows and columns. You can use Bootstrap's [margin classes](https://getbootstrap.com/docs/5.2/utilities/spacing/#margin-and-padding) for card spacing.
```
.card.minw-10 {
min-width: 10rem;
}
.card.maxw-16_5 {
max-width: 16.5rem;
}
```
```
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<div class="d-flex flex-wrap justify-content-center">
<div class="card m-2 minw-10 maxw-16_5">
<img src="https://via.placeholder.com/300x100" class="card-img-top" alt="..." />
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<div class="card m-2 minw-10 maxw-16_5">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
<div class="card m-2 minw-10 maxw-16_5">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
<div class="card m-2 minw-10 maxw-16_5">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
<div class="card m-2 minw-10 maxw-16_5">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
<div class="card m-2 minw-10 maxw-16_5">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and make up the bulk of the card's content.
</p>
<a href="#" class="card-link">Card link</a>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
```
| null | CC BY-SA 4.0 | null | 2022-11-23T17:14:46.530 | 2022-11-23T17:27:03.920 | 2022-11-23T17:27:03.920 | 1,264,804 | 1,264,804 | null |
74,551,178 | 2 | null | 74,551,056 | 3 | null | Since you want two facet to be "individual Sex" and one to be "all", then we can duplicate the data:
```
library(dplyr)
library(ggplot2)
mtcars %>%
mutate(cyl = "All") %>%
bind_rows(mutate(mtcars, cyl = as.character(cyl))) %>%
ggplot(aes(mpg, disp)) +
geom_point() +
facet_wrap(~ cyl)
```
[](https://i.stack.imgur.com/o01Cm.png)
This premise works regardless of your plotting preference (e.g., scatterplot or histogram).
The intermediate `mutate(mtcars, cyl=as.character(cyl))` is because the duplicated data has a string for `cyl` whereas the original data is `integer`; since your `"Sex"` column is already `character`, you likely won't need that intermediate `as.character`. If they are `factor`s, however, you may need to proactively manage the levels of the factor to include `"All"` (or whatever string you prefer).
| null | CC BY-SA 4.0 | null | 2022-11-23T17:57:40.533 | 2022-11-23T17:57:40.533 | null | null | 3,358,272 | null |
74,551,706 | 2 | null | 31,481,386 | 0 | null | With flex it's really easy now :
```
<div class="parent">
<span class="description">Description</span>
<div class="dottedDiv"></div>
<span class="price">price</span>
</div>
```
CSS :
```
.parent {
display: flex;
justify-content: center;
}
.description{
padding-right: 1rem;
}
.price{
padding-left: 1rem;
}
.dottedDiv{
height : 1.6rem;
border-bottom: 1px dotted black;
flex-grow: 2;
}
```
Note that I'm reducing the height of the dotted div, to have the line exactly where I want it to be.
| null | CC BY-SA 4.0 | null | 2022-11-23T18:48:53.000 | 2022-11-23T18:48:53.000 | null | null | 16,097,107 | null |
74,551,724 | 2 | null | 74,549,625 | 1 | null | You can calculate the value that goes in each spot, no need to keep a separate counter variable:
```
void InitMatrix2D(int[,] matrix)
{
for (int r = 0; r < matrix.GetLength(0); r++)
{
for (int c = 0; c < matrix.GetLength(1); c++)
{
matrix[r, c] = (r * matrix.GetLength(1)) + (c + 1);
}
}
}
void InitMatrixLinear(int[,] matrix)
{
for (int i=0; i<matrix.Length; i++)
{
int r = i / matrix.GetLength(1);
int c = i % matrix.GetLength(1);
matrix[r, c] = (i+1);
}
}
```
Next, you can use `matrix.Length` to determine the correct amount of zeroes to pad your numbers with:
```
void DisplayMatrix(int[,] matrix)
{
int maxLength = matrix.Length.ToString().Length;
String numFormat = new string('0', maxLength);
for (int r = 0; r < matrix.GetLength(0); r++)
{
for (int c = 0; c < matrix.GetLength(1); c++)
{
Console.Write(matrix[r, c].ToString(numFormat) + " ");
}
Console.WriteLine();
}
}
```
Lastly, for the reverse diagonal, if the one-based row number plus the zero-based column number equals the number of columns, then you can change the background to yellow:
```
void DisplayMatrixWithCross(int[,] matrix)
{
int maxLength = matrix.Length.ToString().Length;
String numFormat = new string('0', maxLength);
Console.WriteLine();
for (int rows = 0; rows < matrix.GetLength(0); rows++)
{
for (int columns = 0; columns < matrix.GetLength(1); columns++)
{
Console.ResetColor();
if (rows == columns)
{
Console.ForegroundColor = ConsoleColor.Red;
}
if ((rows+1)+columns == matrix.GetLength(1))
{
Console.BackgroundColor = ConsoleColor.Yellow;
}
Console.Write(" " + matrix[rows, columns].ToString(numFormat));
}
Console.WriteLine();
}
}
```
My output:
[](https://i.stack.imgur.com/BYHRt.png)
| null | CC BY-SA 4.0 | null | 2022-11-23T18:50:11.877 | 2022-11-23T18:50:11.877 | null | null | 2,330,053 | null |
74,551,732 | 2 | null | 74,551,386 | 1 | null | Solved.
- -
In case someone's interested in the case, the data source was:
[http://infosiap.siap.gob.mx/gobmx/datosAbiertos.php](http://infosiap.siap.gob.mx/gobmx/datosAbiertos.php)
| null | CC BY-SA 4.0 | null | 2022-11-23T18:51:23.600 | 2022-11-23T18:51:23.600 | null | null | 13,478,435 | null |
74,551,848 | 2 | null | 17,788,859 | 1 | null | `forecast::ggAcf()` is another option:
```
library(ggplot2)
library(forecast)
ggAcf(wineind,lag.max=24)+
labs(title='wineind')
```
| null | CC BY-SA 4.0 | null | 2022-11-23T19:03:31.760 | 2022-11-23T19:03:31.760 | null | null | 2,308,532 | null |
74,551,889 | 2 | null | 74,551,056 | 0 | null | That is what I understand what you want. Starting from your three plots and then putting them together here with `patchwork`.
```
library(MASS)
data(cats)
library(dplyr)
library(ggplot2)
library(patchwork)
p1 <- cats %>%
filter(Sex %in% c("F")) %>%
ggplot(aes(x = Bwt, y = Hwt)) + geom_point() + facet_wrap("Sex")
p2 <- cats %>%
filter(Sex %in% c("M")) %>%
ggplot(aes(x = Bwt, y = Hwt)) + geom_point() + facet_wrap("Sex")
p3 <- cats %>%
ggplot(aes(x = Bwt, y = Hwt)) + geom_point() + facet_wrap("Sex")
(p1 | p2)/
p3
```

| null | CC BY-SA 4.0 | null | 2022-11-23T19:07:36.427 | 2022-11-23T19:07:36.427 | null | null | 4,282,026 | null |
74,552,262 | 2 | null | 11,630,321 | 1 | null | Others have described the well enough and unfortunately [the question which asks for a solution](https://stackoverflow.com/questions/12276675/modulus-with-negative-numbers-in-c/) is marked a duplicate of this one and a comprehensive answer on that aspect seems to be missing. There seem to be 2 commonly used general solutions and one special-case I would like to include:
```
// 724ms
inline int mod1(int a, int b)
{
const int r = a % b;
return r < 0 ? r + b : r;
}
// 759ms
inline int mod2(int a, int b)
{
return (a % b + b) % b;
}
// 671ms (see NOTE1!)
inline int mod3(int a, int b)
{
return (a + b) % b;
}
int main(int argc, char** argv)
{
volatile int x;
for (int i = 0; i < 10000000; ++i) {
for (int j = -argc + 1; j < argc; ++j) {
x = modX(j, argc);
if (x < 0) return -1; // Sanity check
}
}
}
```
NOTE1: This is generally correct (i.e. if `a < -b`). The reason I included it is because almost every time I find myself taking the modulus of a negative number is when doing math with numbers that are modded, for example `(i1 - i2) % n` where the `0 <= iX < n` (e.g. indices of a circular buffer).
As always, YMMV with regards to timing.
| null | CC BY-SA 4.0 | null | 2022-11-23T19:46:56.057 | 2022-11-23T19:46:56.057 | null | null | 358,680 | null |
74,552,294 | 2 | null | 74,552,268 | 2 | null |
# base R
```
df[ave(rep(TRUE, nrow(df)), df[,c("gender","paar")], FUN = function(z) !any(duplicated(z))),]
# ID gender paar
# 1 1 1 1
# 2 2 2 1
# 3 3 1 2
# 4 4 2 2
# 7 7 2 4
# 8 8 1 4
# 9 9 1 5
# 10 10 2 5
# 11 11 1 6
# 12 12 2 6
# 13 13 1 7
# 14 14 2 7
# 17 17 2 9
# 18 18 1 9
# 19 19 1 10
# 20 20 2 10
```
# dplyr
```
library(dplyr)
df %>%
group_by(gender, paar) %>%
filter(!any(duplicated(cbind(gender, paar)))) %>%
ungroup()
```
| null | CC BY-SA 4.0 | null | 2022-11-23T19:51:32.347 | 2022-11-23T19:51:32.347 | null | null | 3,358,272 | null |
74,552,297 | 2 | null | 74,552,268 | 1 | null | In `base R`, we may use `subset` after removing the observations where the group count for 'gender' and 'paar' are not 1
```
subset(df, ave(seq_along(gender), gender, paar, FUN = length) == 1)
```
---
Or with `duplicated`
```
df[!(duplicated(df[-1])|duplicated(df[-1], fromLast = TRUE)),]
```
-output
```
ID gender paar
1 1 1 1
2 2 2 1
3 3 1 2
4 4 2 2
7 7 2 4
8 8 1 4
9 9 1 5
10 10 2 5
11 11 1 6
12 12 2 6
13 13 1 7
14 14 2 7
17 17 2 9
18 18 1 9
19 19 1 10
20 20 2 10
```
| null | CC BY-SA 4.0 | null | 2022-11-23T19:52:03.440 | 2022-11-23T19:52:03.440 | null | null | 3,732,271 | null |
74,552,334 | 2 | null | 74,552,268 | 1 | null | Using `aggregate`
```
na.omit(aggregate(. ~ gender + PID, df, function(x)
ifelse(length(x) == 1, x, NA)))
gender PID ID
1 1 1 1
2 2 1 2
3 1 2 3
4 2 2 4
6 1 4 8
7 2 4 7
8 1 5 9
9 2 5 10
10 1 6 11
11 2 6 12
12 1 7 13
13 2 7 14
15 1 9 18
16 2 9 17
17 1 10 19
18 2 10 20
```
With `dplyr`
```
library(dplyr)
df %>%
group_by(gender, PID) %>%
filter(n() == 1) %>%
ungroup()
# A tibble: 16 × 3
ID gender PID
<dbl> <dbl> <dbl>
1 1 1 1
2 2 2 1
3 3 1 2
4 4 2 2
5 7 2 4
6 8 1 4
7 9 1 5
8 10 2 5
9 11 1 6
10 12 2 6
11 13 1 7
12 14 2 7
13 17 2 9
14 18 1 9
15 19 1 10
16 20 2 10
```
| null | CC BY-SA 4.0 | null | 2022-11-23T19:55:45.923 | 2022-11-23T20:35:38.987 | 2022-11-23T20:35:38.987 | 9,462,095 | 9,462,095 | null |
74,552,381 | 2 | null | 74,549,261 | 1 | null | You're using the wrong angle for QPainterPath, which uses degrees, as opposed to QPainter which uses sixteenths of a degree.
Also, you need to use [arcMoveTo()](https://doc.qt.io/qt-6/qpainterpath.html#arcMoveTo) (not `moveTo`) in order to place the path at the correct position when starting a new arc.
Finally, you have to close the path, using [closeSubpath()](https://doc.qt.io/qt-6/qpainterpath.html#closeSubpath).
```
path = QPainterPath()
outRect = QRectF(-100, -100, 200, 200)
path.arcMoveTo(outRect, -60)
path.arcTo(outRect, -60, 120)
path.arcTo(-50, -50, 100, 100, 60, 240)
path.closeSubpath()
painter.drawPath(path)
```
| null | CC BY-SA 4.0 | null | 2022-11-23T20:00:42.250 | 2022-11-23T20:00:42.250 | null | null | 2,001,654 | null |
74,552,406 | 2 | null | 74,552,268 | 1 | null | Another `dplyr` option could be:
```
df %>%
filter(with(rle(paste0(gender, PID)), rep(lengths == 1, lengths)))
ID gender PID
1 1 1 1
2 2 2 1
3 3 1 2
4 4 2 2
5 7 2 4
6 8 1 4
7 9 1 5
8 10 2 5
9 11 1 6
10 12 2 6
11 13 1 7
12 14 2 7
13 17 2 9
14 18 1 9
15 19 1 10
16 20 2 10
```
If the duplicated values can occur also between non-consecutive rows:
```
df %>%
arrange(gender, PID) %>%
filter(with(rle(paste0(gender, PID)), rep(lengths == 1, lengths)))
```
| null | CC BY-SA 4.0 | null | 2022-11-23T20:03:31.387 | 2022-11-23T20:11:58.823 | 2022-11-23T20:11:58.823 | 5,964,557 | 5,964,557 | null |
74,552,446 | 2 | null | 74,552,268 | 1 | null | Here is one more: :-)
```
library(dplyr)
df %>%
group_by(gender, PID) %>%
filter(is.na(ifelse(n()>1, 1, NA)))
```
```
ID gender PID
<dbl> <dbl> <dbl>
1 1 1 1
2 2 2 1
3 3 1 2
4 4 2 2
5 7 2 4
6 8 1 4
7 9 1 5
8 10 2 5
9 11 1 6
10 12 2 6
11 13 1 7
12 14 2 7
13 17 2 9
14 18 1 9
15 19 1 10
16 20 2 10
```
| null | CC BY-SA 4.0 | null | 2022-11-23T20:07:28.157 | 2022-11-23T20:07:28.157 | null | null | 13,321,647 | null |
74,552,735 | 2 | null | 74,552,519 | 1 | null | If I understand correctly, you are saying that the content is centered horizontally by default, but that the div needs a `height: 100%` to center the content vertically.
Divs are block elements, which means that, by default:
1. They take up the entire width of the screen
2. They only take up as much height as is needed to display their content (they have a default height of auto).
If your div is a flexbox with the content centered, even if the content is centered vertically, the div will still only expand downwards as far as it needs in order to fit the tallest element inside of it. Since the div is still at the top of the screen, even if its content is centered vertically inside the div, the content will appear at the top of the screen because the div is only as tall as the content and because the div is at the top of the screen.
However, the `height: auto` default property of divs can be overridden. If you set the height to `100%`, you force the div to be 100% of the height of its parent element, the page. The div would then have a bunch of extra space for the content, and due to the flex rule, it would position the content in the vertical center of that extra space.
To understand this further, you can try adding `border: 5px dashed black` to the div so you can see its size and position, and then using different values for height, like `unset`, `100%`, `50%`, etc. Experiment and play around!
| null | CC BY-SA 4.0 | null | 2022-11-23T20:39:05.807 | 2022-11-23T20:39:05.807 | null | null | 9,938,486 | null |
74,553,289 | 2 | null | 74,240,577 | 1 | null | I finally figured this out. The part that I was missing was that I had to specify which database to open with this `.mdw` file
## Step 1:
Open the `MyApp.mdb` database the `.mdw` file using this command:
```
"C:\Program Files (x86)\Microsoft Office\Office16\MSACCESS.EXE" "C:\Program Files\MyApp\MyApp.mdb" /WRKGRP "C:\Program Files\MyApp\Secured.mdw"
```
## Step 2:
Log in using Admin credentials:

## Step 3:

## Step 4:
Find the user whose password you want to reset. For eg: I'm going with here.

Now hit button.
Click and close the file.
## Step 5:
Tell user to login without a password and tell them to set their own password.
## Step 6:
user logs in successfully without a password now:

## Step 7:
user goes to to setup a new password.
## Step 8:
user selects tab. And sets a new password:

user hits and to close the widow.
## Step 9:
user's password is successfully reset, and he'll use the password he set in Step 8 to log in next time.
| null | CC BY-SA 4.0 | null | 2022-11-23T21:42:05.093 | 2022-11-28T18:07:58.007 | 2022-11-28T18:07:58.007 | 8,644,294 | 8,644,294 | null |
74,553,720 | 2 | null | 74,550,379 | 1 | null | You need a first foreach to browse `$eleves`. For each student, you need a second foreach to add all grades and evaluate the mean.
```
function evalMoyenne ($grades) {
$gradeSum = 0;
$coeffCount = 0;
foreach ( $grades as $subject => $grade ) {
$gradeSum += $grade['note'] * $grade['cof'];
$coeffCount += $grade['cof'];
}
return $gradeSum / $coeffCount;
}
foreach ( $eleves as $matricule => $row ) {
$moyenne = evalMoyenne( $row['module'] );
echo "<td>$matricule</td>"
. '<td>' . $row[0] . '</td>'
. '<td>' . $moyenne . '</td>'
}
```
Usually, if you have an array in an array, you need a `foreach` in a `foreach`. As an alternative, if there are a fixed subject count, you could also hardcode the meaning calculation:
```
$gradeSum = $row['module']['Math']['note'] * $row['module']['Math']['cof']
+ $row['module']['Physique']['note'] * $row['module']['Physique']['cof']
+ $row['module']['Langue']['note'] * $row['module']['Langue']['cof']
$cofSum = $row['module']['Math']['cof'] + $row['module']['Physique']['cof'] + $row['module']['Langue']['cof'];
$moyenne = $gradeSum / $cofSum;
```
| null | CC BY-SA 4.0 | null | 2022-11-23T22:40:38.803 | 2022-11-23T22:40:38.803 | null | null | 16,895,314 | null |
74,553,920 | 2 | null | 74,056,701 | 2 | null | Use a M3 theme in your app:
```
<style name="AppTheme" parent="Theme.Material3.DayNight">
```
Then in your layout:
```
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNav_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.App.BottomNavigationView"
```
with:
```
<style name="ThemeOverlay.App.BottomNavigationView" parent="">
<item name="colorSurface">#d1e4ff</item>
<item name="colorSecondaryContainer">#0061a3</item>
</style>
```
[](https://i.stack.imgur.com/Kuptb.png)
[](https://i.stack.imgur.com/xDKPR.png)
| null | CC BY-SA 4.0 | null | 2022-11-23T23:10:31.243 | 2022-11-23T23:10:31.243 | null | null | 2,016,562 | null |
74,554,023 | 2 | null | 18,920,542 | 1 | null | A modern answer with good browser support.
```
<span>×</span>
```
This technically puts the multiplication symbol there, but no one will really notice (found some websites that have a popup box and most use this for the x button).
If you need more control you can style it with color opacity etc...
example (index.html)
```
<span class="x-button">×</span>
```
styles.css
```
span.x-button {
color:gray;
opacity:0.7;
font-size:1.5em;
}
```
Result (first example)
```
<span>×</span>
```
Result (2nd example)
```
span {
color:gray;
opacity:0.7;
font-size:1.5em;
}
```
```
<span class="x-button">×</span>
```
Note: you can highlight this unlike other solutions, but this may not be desirable depending on the application. You can solve this in pure css too, just add
```
user-select:none;
-webkit-user-select:none;
```
| null | CC BY-SA 4.0 | null | 2022-11-23T23:29:50.577 | 2022-11-23T23:44:00.673 | 2022-11-23T23:44:00.673 | 14,739,273 | 14,739,273 | null |
74,554,116 | 2 | null | 74,554,098 | 0 | null | Try doing
`border-radius: 25px;`
sometimes rem doesn't work for border radius
| null | CC BY-SA 4.0 | null | 2022-11-23T23:45:48.377 | 2022-11-23T23:45:48.377 | null | null | 20,084,258 | null |
74,554,133 | 2 | null | 74,554,066 | 0 | null | I'm not sure of the cause, but try wrapping the request in `cy.session()`
```
Cypress.Commands.add("login", () => {
cy.session('login', () => {
cy.request({...})
})
})
```
The session command acts like a cache for the session token. When you call the login command in `beforeEach()`, the first time calls the request but subsequent times just restore the token from cache.
| null | CC BY-SA 4.0 | null | 2022-11-23T23:47:55.103 | 2022-11-23T23:47:55.103 | null | null | 18,366,749 | null |
74,554,174 | 2 | null | 74,554,019 | 1 | null | Status tip work by triggering the `StatusTip` event on the widget, if it does not handle it, it is propagated to its parents hierarchy until any of them does handle it (and its `event()` returns `True`).
The status tip is normally managed by the top level main window that contains the widget triggering the event. When the dock widget is floating, it is its own top level window, so the main window will not receive it.
A possible solution is to install an event filter on the dock widget, check if the event is of the correct type, verify if the dock is actually floating and then "reroute" the event to the `event()` of the main window and return its result.
```
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class Window(QMainWindow):
def __init__(self):
super().__init__()
self.setCentralWidget(QTextEdit())
self.dockWidget = QDockWidget()
container = QWidget()
self.dockWidget.setWidget(container)
self.button = QPushButton(
'I am a button',
toolTip='I am a tool tip',
statusTip='I am a status tip'
)
QVBoxLayout(container).addWidget(self.button)
self.addDockWidget(Qt.LeftDockWidgetArea, self.dockWidget)
self.statusBar()
self.dockWidget.installEventFilter(self)
def eventFilter(self, obj, event):
if (
event.type() == event.StatusTip
and obj == self.dockWidget
and self.dockWidget.isFloating()
):
return self.event(event)
return super().eventFilter(obj, event)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec())
```
Note: setting the QDockWidget parent to the main window is pointless: when it's properly added using `addDockWidget()` (as it should), it's automatically reparented anyway (otherwise you wouldn't be able to see it embedded in the dock areas).
| null | CC BY-SA 4.0 | null | 2022-11-23T23:54:09.013 | 2022-11-23T23:54:09.013 | null | null | 2,001,654 | null |
74,554,527 | 2 | null | 25,695,778 | 1 | null | I noticed the OP tried using FormData in one of their iterations to solve the original problem.
I've recently started using the Fetch api for sending form data. It's designed with promises making it really easy to use (especially if there's a form to leverage for all of the inputs):
```
var form = document.forms[0];
var data = new FormData(form);
fetch(form.action, { method: form.method, body: data })
.then((response) => {
// handle response
}).catch((error) => {
// handle error
);
```
[https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)
| null | CC BY-SA 4.0 | null | 2022-11-24T00:58:39.753 | 2022-11-24T00:58:39.753 | null | null | 10,485,004 | null |
74,554,541 | 2 | null | 74,553,828 | 1 | null | '=' missing in formula cell, target cell should not be integer as values are higher than range allowed
```
Sub GoalSeek()
Dim i As Integer
Dim ResultCell As Range
Dim TargetSales As Variant
For i = 4 To 18
Set ResultCell = Cells(i, 3)
TargetSales = Cells(i, 7).Value
Set ResultCell = Cells(i, 6)
ResultCell.Formula = "=(C" & i & "*" & "E" & i & ")"
ResultCell.GoalSeek TargetSales, Range("C" & i)
Next i
End Sub
```
| null | CC BY-SA 4.0 | null | 2022-11-24T01:01:13.570 | 2022-11-24T01:01:13.570 | null | null | 16,662,333 | null |
74,554,562 | 2 | null | 74,546,776 | 2 | null | If you want "any help" and are willing to use Imagemagick 7, then there is a simple solution using its aggressive trim.
Input:
[](https://i.stack.imgur.com/upxzz.png)
```
magick -fuzz 20% img.png +repage -bordercolor black -border 2 -background black -define trim:percent-background=0% -trim +repage img_trim.png
```
[](https://i.stack.imgur.com/JtBQz.png)
| null | CC BY-SA 4.0 | null | 2022-11-24T01:03:45.503 | 2022-11-24T01:03:45.503 | null | null | 7,355,741 | null |
74,554,567 | 2 | null | 74,554,098 | 0 | null | Check below snippet: with your CSS and HTML, in both cases the bootstrap creates a small rounded corner of `4px` around the images using `.rounded { border-radius: .25rem !important }` (Firefox DevTools). In fact, with your HTML (second card), the rounded borders of the image are gone.
Still not showing the result you are experiencing. Something else in your CSS creates the result.
The odd border radius in the image is not reproducable on Stackoverflow with your code.
I added below CSS to override `.rounded` in my Codepen test and got the same unwanted result. You must have done something similar. However, I still don't see it happening here on SO.
My [Codepen: SO74554098](https://codepen.io/renevanderlende/pen/vYrRzXY?editors=1100)
```
.rounded {
border-radius: 1rem !important;
}
```
The best option would, indeed, be to create a specific card layout for the images (as OP commented, 'card in a card') and use `.rounded` or a custom class with `border-radius` set.
```
.card {
/* added for test */
padding: 1rem; margin: 1rem; outline: 1px solid black;
/**/
position: relative;
display: flex;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: #f5f5f5;
background-clip: border-box;
border: 0.0625rem solid #e5e7eb;
border-radius: 1rem;
}
.rounded {
border-radius: 1rem !important;
}
```
```
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<h3>only .card > .rounded</h3>
<div class="card">
<img class="rounded" src="https://picsum.photos/id/237/300/200">
</div>
<h3>OP code with full bootstrap CSS (5.0.2)</h3>
<div class="card border-0 p-3 p-md-3 p-lg-4 mb-3">
<div class="row pb-4 text-left">
<div class="col-1 ps-1">
<h1 class="id-circle">B</h1>
</div>
<div class="col-11">
<span class="description details-text pe-1">Text</span>
</div>
</div>
<div class="row gy-3 mb-1 pb-0">
<div class="col-lg-6 col-md-6 col-sm-6 pb-0">
<div class="row pt-0 pb-0 image-row">
<img class="rounded" src="https://picsum.photos/id/237/300/200">
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.min.js"></script>
</body>
</html>
```
| null | CC BY-SA 4.0 | null | 2022-11-24T01:04:26.997 | 2022-11-24T16:18:48.240 | 2022-11-24T16:18:48.240 | 2,015,909 | 2,015,909 | null |
74,554,683 | 2 | null | 74,549,086 | 0 | null |
1. Open your vscode and reinstall the Python and Jupyter Notebook extensions.
2. Reinstall ipykernel package in the terminal.
At the same time, [this issue](https://stackoverflow.com/questions/67036168/kernel-died-with-exit-code-1vs-code) also proposes other solutions.
I encountered the same problem with traitlets==4.3.3. I updated it by using `pip install traitlets` and it's [version is 5.5.0](https://pypi.org/project/traitlets/) to solve this problem.
| null | CC BY-SA 4.0 | null | 2022-11-24T01:27:22.410 | 2022-11-24T09:53:17.630 | 2022-11-24T09:53:17.630 | 18,359,438 | 18,359,438 | null |
74,554,964 | 2 | null | 74,554,788 | 1 | null | Yes, this is possible. But you'll need to re-format your data a little first.
Here's the dataset I'm using in this example. It has the labels in the columns, and 1000 random Yes, No or Maybe responses as values.
```
asthma boneitis diabetes pneumonia
0 No No Yes Maybe
1 No No No Yes
2 No No No No
3 Yes No No Maybe
4 Yes No No Maybe
.. ... ... ... ...
995 No No Yes No
996 Maybe Yes Yes Yes
997 No No No Yes
998 No No No No
999 No No Maybe No
```
In order to format the data correctly for the plot, do this:
```
df2 = df.stack().groupby(level=[1]).value_counts().unstack()
# Preferred order of stacked bar elements
stack_order = ['Yes', 'Maybe', 'No']
df2 = df2[stack_order]
```
At this point, the data looks like this:
```
Yes Maybe No
asthma 83 83 834
boneitis 174 173 653
diabetes 244 260 496
pneumonia 339 363 298
```
Now you're ready to plot the data. Here's the code to do that:
```
df2.plot.bar(rot=0, stacked=True)
```
I'm using `rot=0` to avoid rotating the text labels (they would normally be at a 45 degree angle,) and `stacked=True` to produce a stacked bar chart.
The plot looks like this:
[](https://i.stack.imgur.com/pLjhN.png)
## Appendix
Code for generating test data set:
```
import pandas as pd
import numpy as np
categories = [
'asthma',
'boneitis',
'diabetes',
'pneumonia',
]
distribution = {
cat: (i + 1) / 12
for i, cat in enumerate(categories)
}
df = pd.DataFrame({
cat: np.random.choice(['Yes', 'Maybe', 'No'], size=1000, p=[prob, prob, 1 - 2 * prob])
for cat, prob in distribution.items()
})
```
| null | CC BY-SA 4.0 | null | 2022-11-24T02:26:53.043 | 2022-11-24T03:46:35.230 | 2022-11-24T03:46:35.230 | 530,160 | 530,160 | null |
74,555,055 | 2 | null | 72,937,512 | 0 | null | I found answers in the post [https://stackoverflow.com/a/73097326/5072481](https://stackoverflow.com/a/73097326/5072481) add username path to $HOME/ is the point
| null | CC BY-SA 4.0 | null | 2022-11-24T02:46:05.247 | 2022-11-24T02:46:05.247 | null | null | 5,072,481 | null |
74,555,219 | 2 | null | 73,455,840 | 0 | null | This is definitely what you are looking for
```
TextField(
value = text.value,
onValueChange = {
if (it.length <= 200) {
textLength.value = it.length
text.value = it
}
},
label = {
Text(text = textHint)
},
modifier = Modifier
.padding(top = 16.dp)
.sizeIn(minHeight = 120.dp)
.background(Color.Transparent),
keyboardOptions = KeyboardOptions.Default.copy(
imeAction = ImeAction.Done
),
keyboardActions = KeyboardActions(
onDone = {
//Do something here
},
),
)
```
| null | CC BY-SA 4.0 | null | 2022-11-24T03:15:42.327 | 2022-11-24T03:15:42.327 | null | null | 9,861,911 | null |
74,555,310 | 2 | null | 74,546,776 | 2 | null | Here is a Python/OpenCV solution. It first thresholds the image so that the background is black and the rest is white. It tests each edge of the threshold image and computes the mean and looks for the edge with the lowest mean. It stops on that edge if the mean==255. If not, then it trims off that edge and repeats. Once all edges have a mean of 255, it stops completely and uses the increments on each side to compute the crop of the original input.
Input:
[](https://i.stack.imgur.com/xgNRP.png)
```
import cv2
import numpy as np
# read image
img = cv2.imread('star_arrow.png')
h, w = img.shape[:2]
# threshold so border is black and rest is white. Note this is has pure black for the background, so threshold at black and invert. Adjust lower and upper if the background is not pure black.
lower = (0,0,0)
upper = (0,0,0)
mask = cv2.inRange(img, lower, upper)
mask = 255 - mask
# define top and left starting coordinates and starting width and height
top = 0
left = 0
bottom = h
right = w
# compute the mean of each side of the image and its stop test
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_bottom, mean_right)
top_test = "stop" if (mean_top == 255) else "go"
left_test = "stop" if (mean_left == 255) else "go"
bottom_test = "stop" if (mean_bottom == 255) else "go"
right_test = "stop" if (mean_right == 255) else "go"
# iterate to compute new side coordinates if mean of given side is not 255 (all white) and it is the current darkest side
while top_test == "go" or left_test == "go" or right_test == "go" or bottom_test == "go":
# top processing
if top_test == "go":
if mean_top != 255:
if mean_top == mean_minimum:
top += 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("top",mean_top)
continue
else:
top_test = "stop"
# left processing
if left_test == "go":
if mean_left != 255:
if mean_left == mean_minimum:
left += 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("left",mean_left)
continue
else:
left_test = "stop"
# bottom processing
if bottom_test == "go":
if mean_bottom != 255:
if mean_bottom == mean_minimum:
bottom -= 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("bottom",mean_bottom)
continue
else:
bottom_test = "stop"
# right processing
if right_test == "go":
if mean_right != 255:
if mean_right == mean_minimum:
right -= 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("right",mean_right)
continue
else:
right_test = "stop"
# crop input
result = img[top:bottom, left:right]
# print crop values
print("top: ",top)
print("bottom: ",bottom)
print("left: ",left)
print("right: ",right)
print("height:",result.shape[0])
print("width:",result.shape[1])
# save cropped image
#cv2.imwrite('border_image1_cropped.png',result)
cv2.imwrite('img_cropped.png',result)
cv2.imwrite('img_mask.png',mask)
# show the images
cv2.imshow("mask", mask)
cv2.imshow("cropped", result)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
Threshold Image:
[](https://i.stack.imgur.com/0ar0m.png)
Cropped Input:
[](https://i.stack.imgur.com/ClqOz.png)
Here is a version that shows an animation of the processing when run.
```
import cv2
import numpy as np
# read image
img = cv2.imread('star_arrow.png')
h, w = img.shape[:2]
# threshold so border is black and rest is white (invert as needed)
lower = (0,0,0)
upper = (0,0,0)
mask = cv2.inRange(img, lower, upper)
mask = 255 - mask
# define top and left starting coordinates and starting width and height
top = 0
left = 0
bottom = h
right = w
# compute the mean of each side of the image and its stop test
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_bottom, mean_right)
top_test = "stop" if (mean_top == 255) else "go"
left_test = "stop" if (mean_left == 255) else "go"
bottom_test = "stop" if (mean_bottom == 255) else "go"
right_test = "stop" if (mean_right == 255) else "go"
result = img[top:bottom, left:right]
cv2.imshow("result", result)
cv2.waitKey(100)
# iterate to compute new side coordinates if mean of given side is not 255 (all white) and it is the current darkest side
while top_test == "go" or left_test == "go" or right_test == "go" or bottom_test == "go":
# top processing
if top_test == "go":
if mean_top != 255:
if mean_top == mean_minimum:
top += 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("top",mean_top)
result = img[top:bottom, left:right]
cv2.imshow("result", result)
cv2.waitKey(100)
continue
else:
top_test = "stop"
# left processing
if left_test == "go":
if mean_left != 255:
if mean_left == mean_minimum:
left += 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("left",mean_left)
result = img[top:bottom, left:right]
cv2.imshow("result", result)
cv2.waitKey(100)
continue
else:
left_test = "stop"
# bottom processing
if bottom_test == "go":
if mean_bottom != 255:
if mean_bottom == mean_minimum:
bottom -= 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("bottom",mean_bottom)
result = img[top:bottom, left:right]
cv2.imshow("result", result)
cv2.waitKey(100)
continue
else:
bottom_test = "stop"
# right processing
if right_test == "go":
if mean_right != 255:
if mean_right == mean_minimum:
right -= 1
mean_top = np.mean( mask[top:top+1, left:right] )
mean_left = np.mean( mask[top:bottom, left:left+1] )
mean_bottom = np.mean( mask[bottom-1:bottom, left:right] )
mean_right = np.mean( mask[top:bottom, right-1:right] )
mean_minimum = min(mean_top, mean_left, mean_right, mean_bottom)
#print("right",mean_right)
result = img[top:bottom, left:right]
cv2.imshow("result", result)
cv2.waitKey(100)
continue
else:
right_test = "stop"
# crop input
result = img[top:bottom, left:right]
# print crop values
print("top: ",top)
print("bottom: ",bottom)
print("left: ",left)
print("right: ",right)
print("height:",result.shape[0])
print("width:",result.shape[1])
# save cropped image
cv2.imwrite('img_cropped.png',result)
cv2.imwrite('img_mask.png',mask)
# show the images
cv2.waitKey(0)
cv2.destroyAllWindows()
```
| null | CC BY-SA 4.0 | null | 2022-11-24T03:31:16.603 | 2022-11-25T22:07:18.730 | 2022-11-25T22:07:18.730 | 7,355,741 | 7,355,741 | null |
74,555,397 | 2 | null | 74,554,939 | 0 | null | The problem is often due to a rounding error in the Outlook engine (MS Word) with odd numbers. In your case, you've already identified an even numbered font-size works. Seeing as that's the core error, and it's not a bug in your code, you have to weigh up whether the unsightliness of the line is worse than changing the size of the font.
If that's not acceptable, you may have luck by setting a line-height of 16px like so: `font-size:15px; line-height:16px;`.
If all else fails, you can set the font-size differently just for Outlook desktops: `font-size:15px; mso-ansi-font-size: 16px;`
| null | CC BY-SA 4.0 | null | 2022-11-24T03:45:56.290 | 2022-11-24T03:45:56.290 | null | null | 8,942,566 | null |
74,555,811 | 2 | null | 74,555,777 | 3 | null | You cannot solve this problem in one line using list comprehension alone. You need the ternary operator (enclosed in the parentheses).
```
[(n if n%5 else f'{n}x') for n in range(1,31) if n%2]
```
| null | CC BY-SA 4.0 | null | 2022-11-24T04:58:42.617 | 2022-11-24T04:58:42.617 | null | null | 4,492,932 | null |
74,555,889 | 2 | null | 74,555,777 | 3 | null | If you don't care about the order of the items, you can avoid needing the ternary operator ([conditional expression](https://docs.python.org/3/reference/expressions.html#conditional-expressions)) by concatenating the lists resulting from two list comprehensions, e.g.
```
[n for n in range(1,31,2) if n%5 != 0] + [f'{n}x' for n in range(1,31,2) if n%5 == 0]
```
... which produces:
> [1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, '5x', '15x', '25x']
Alternatively, at the risk of making this look like code golf:
```
[[f'{n}x',n][min(n%5,1)] for n in range(1,31,2)]
```
... produces:
> [1, 3, '5x', 7, 9, 11, 13, '15x', 17, 19, 21, 23, '25x', 27, 29]
I've used the expression `min(n%5,1)` to index the list `[f'{n}x',n]` and thus select either item 0 or item 1 in the list, depending on whether `n` is divisible by 5 or not -- also without using the [conditional expression](https://docs.python.org/3/reference/expressions.html#conditional-expressions).
| null | CC BY-SA 4.0 | null | 2022-11-24T05:10:50.313 | 2022-11-24T05:44:42.253 | 2022-11-24T05:44:42.253 | 1,960,027 | 1,960,027 | null |
74,556,407 | 2 | null | 74,555,777 | 2 | null | Alternate workaround:
```
numlist = [(i,f'{i}x')[not i%5] for i in range(31) if i%2]
print(numlist)
# [1, 3, '5x', 7, 9, 11, 13, '15x', 17, 19, 21, 23, '25x', 27, 29]
```
| null | CC BY-SA 4.0 | null | 2022-11-24T06:22:29.797 | 2022-11-24T06:22:29.797 | null | null | 19,574,157 | null |
74,556,549 | 2 | null | 74,545,773 | 0 | null | You don't need to modify the Info.plist file, you can refer to the following steps:
1. Create a new Xamarin.Forms project
2. In your Solution Explorer directory, there is an Asset Catalogs folder in the iOS project, open the Assets file in this folder
3. Replace the default icons of all sizes in Applcon, and check whether the image name in the .csproj file is correct.
4. Build your app. If you have installed the app before, you need to uninstall it and reinstall it.
For more details, you can refer to the official documentation: [Application Icons in Xamarin.iOS | Microsof](https://learn.microsoft.com/en-us/xamarin/xamarin-forms/deploy-test/hot-restart#:%7E:text=Xamarin%20Hot%20Restart.-,Limitations,-Only%20iOS%20apps)
According to the comments, you used Hot Restart. [Hot Restart will have some restrictions](https://learn.microsoft.com/en-us/xamarin/xamarin-forms/deploy-test/hot-restart#:%7E:text=Xamarin%20Hot%20Restart.-,Limitations,-Only%20iOS%20apps), one of which is: Asset Catalogs are currently not supported. When using Hot Restart, your app will show the default icon and launch screen for Xamarin apps. When paired to a Mac, or developing on a Mac, your Asset Catalogs will work.
| null | CC BY-SA 4.0 | null | 2022-11-24T06:38:55.423 | 2022-11-29T02:53:35.870 | 2022-11-29T02:53:35.870 | 19,892,156 | 19,892,156 | null |
74,556,907 | 2 | null | 74,556,831 | 0 | null | Use the meter element to display a scalar value within a given range (a gauge):
```
<meter value="0.4" min="0.2" ax="0.6">0.4 out of 0.6</meter>
```
[](https://i.stack.imgur.com/bRMzm.png)
| null | CC BY-SA 4.0 | null | 2022-11-24T07:15:23.583 | 2022-11-24T07:19:17.160 | 2022-11-24T07:19:17.160 | 295,783 | 20,564,785 | null |
74,556,937 | 2 | null | 74,554,278 | 1 | null | The right way to do this in one single query is to use the [range field type](https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html) ([available since 5.2](https://www.elastic.co/blog/numeric-and-date-ranges-in-elasticsearch-just-another-brick-in-the-wall)) instead of using two fields `start` and `stop` and reimplementing the same logic. Like this:
```
PUT test
{
"mappings": {
"properties": {
"range": {
"type": "integer_range"
},
"val": {
"type":"integer"
}
}
}
}
```
Your documents would look like this:
```
{
"range" : {
"gte" : 0,
"lt" : 3
},
"val" : 3
}
```
And then the query would simply leverage an `histogram` aggregation like this:
```
POST test/_search
{
"size": 0,
"aggs": {
"histo": {
"histogram": {
"field": "range",
"interval": 1
},
"aggs": {
"total": {
"sum": {
"field": "val"
}
}
}
}
}
}
```
And the results are as expected: 3, 3, 4, 1, 0, 4
| null | CC BY-SA 4.0 | null | 2022-11-24T07:18:19.113 | 2022-11-24T07:27:35.227 | 2022-11-24T07:27:35.227 | 4,604,579 | 4,604,579 | null |
74,556,984 | 2 | null | 74,555,836 | 0 | null | This error occur when you are trying to use `MobileRTC` and run your app by emulator. when using MobileRTC you should use a real device because emulators does not support MobileRTC
| null | CC BY-SA 4.0 | null | 2022-11-24T07:22:39.697 | 2022-11-24T07:22:39.697 | null | null | 20,570,798 | null |
74,557,084 | 2 | null | 74,553,257 | 0 | null | In SQL Devloper's Connections pane right click on your database name - on a context menu click Properties and then check all the data, including SERVICE_NAME and compare it with your TNSNAMES.ora file.
Regards...
| null | CC BY-SA 4.0 | null | 2022-11-24T07:31:58.090 | 2022-11-24T08:21:07.823 | 2022-11-24T08:21:07.823 | 19,023,353 | 19,023,353 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.