qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
74,259,836 | <p>I have a Map data.</p>
<pre><code>Map<String , Map<String, List<int>>> data = {"value":{"it":[ 1666117800000,1666204200000,1666290600000 ],
"mt":[1666463400000,1666549800000,1666636200000]}};
</code></pre>
<p>I want to print it and mt values form this Map.</p>
| [
{
"answer_id": 74259883,
"author": "eol",
"author_id": 3761628,
"author_profile": "https://Stackoverflow.com/users/3761628",
"pm_score": 0,
"selected": false,
"text": " public enum CustomNumber {\n PLUS_ONE(1),\n MINUS_ONE(-1);\n\n public final int value;\n\n ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19661715/"
] |
74,259,874 | <p>I am making a search query in Elastic Search and I want to treat the fields the same when they match. For example if I search for field <strong>field1</strong> and it matches, then the _score is increase by 10(for example), same for the <strong>field2</strong>.</p>
<p>I was tried function_score but it's not working. It throws an error.</p>
<pre><code>"caused_by": {
"type": "class_cast_exception",
"reason": "class
org.elasticsearch.index.fielddata.plain.SortedSetDVOrdinalsIndexFieldData
cannot be cast to class
org.elasticsearch.index.fielddata.IndexNumericFieldData
(org.elasticsearch.index.fielddata.plain.SortedSetDVOrdinalsIndexFieldData
and org.elasticsearch.index.fielddata.IndexNumericFieldData are in unnamed
module of loader 'app')"
}
</code></pre>
<p>The query:</p>
<pre><code>{
"track_total_hits": true,
"size": 50,
"query": {
"function_score": {
"query": {
"bool": {
"must": [
{
"term": {
"field1": {
"value": "Value 1"
}
}
},
{
"term": {
"field2": {
"value": "value 2"
}
}
}
]
}
},
"functions": [
{
"field_value_factor": {
"field": "field1",
"factor": 10,
"missing": 0
}
},
{
"field_value_factor": {
"field": "field2",
"factor": 10,
"missing": 0
}
}
],
"boost_mode": "multiply"
}
}
}
</code></pre>
| [
{
"answer_id": 74259883,
"author": "eol",
"author_id": 3761628,
"author_profile": "https://Stackoverflow.com/users/3761628",
"pm_score": 0,
"selected": false,
"text": " public enum CustomNumber {\n PLUS_ONE(1),\n MINUS_ONE(-1);\n\n public final int value;\n\n ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10805602/"
] |
74,259,897 | <p>I have 3 tables (members, members3, payout)</p>
<p>Payout Table having records with the relationship of both other tables (members, members3)</p>
<p>I want to list the records with both table relationships.</p>
<p><em><strong>For example:</strong></em> <br /></p>
<p><strong>Members Table (Plan 1)</strong> <br />
id, name, mobile <br >
1, Karthik, 9237493</p>
<p><strong>Members3 Table (plan 3)</strong> <br />
id, name, mobile <br >
1, George, 923143422</p>
<p><strong>Payout Table</strong> <br >
id, mem_id, plan_id, Amount <br />
1, 1, 1, 500 <br />
2, 1, 3, 1500 <br /></p>
<p><em><strong>I want to fetch the records as below:</strong></em> <br />
ID, Member, Amount<br />
1, Karthik, 500 <br />
2, George, 1500 <br /></p>
<p>I have something already done it my Laravel Code. But Can't fetch the select fields as per relationship modal.</p>
<pre><code>$payout=Payout::leftJoin('tbl_members', function($join){
$join->on('tbl_payout.mem_id', '=', 'tbl_members.id')
->where('tbl_payout.plan_id', '=', '1');
})
->leftJoin('tbl_members3', function($join){
$join->on('tbl_payout.mem_id', '=', 'tbl_members3.id')
->where('tbl_payout.plan_id', '=', '3');
})
->Select(DB::Raw('tbl_payout.mem_id, tbl_members.username, tbl_members.name, tbl_payout.paid, tbl_members.city, tbl_members.mobile, tbl_members.bank, tbl_members.bank_number, tbl_members.bank_branch, tbl_members.bank_ifsc'))
->get();
</code></pre>
<p>In this Query, Eloquent fetches the tbl_members records only not tbl_members3 records.
How could I achieve this?</p>
| [
{
"answer_id": 74259883,
"author": "eol",
"author_id": 3761628,
"author_profile": "https://Stackoverflow.com/users/3761628",
"pm_score": 0,
"selected": false,
"text": " public enum CustomNumber {\n PLUS_ONE(1),\n MINUS_ONE(-1);\n\n public final int value;\n\n ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1011283/"
] |
74,259,907 | <p>I would like to query project costs for a project using SQL query (MS SQL Server 2016) and later prepare them in a chart using SQL report.
The data is available in SQL in this form:</p>
<pre><code>+---------+------------------+----------------+----------------+--------------------+------------------+------------------+
| Project | DevCostsExpected | DevCostsTarget | DevCostsActual | SalesCostsExpected | SalesCostsTarget | SalesCostsActual |
+---------+------------------+----------------+----------------+--------------------+------------------+------------------+
| A | 1000 | 2000 | 1500 | 2000 | 3000 | 2500 |
| B | 5000 | 7500 | 10000 | 8000 | 10000 | 3500 |
| C | 1400 | 1400 | 1000 | 5400 | 6000 | 7500 |
+---------+------------------+----------------+----------------+--------------------+------------------+------------------+
</code></pre>
<p>I need an SQL query that gives me the data in this form:</p>
<pre><code>select ??? from ProjectCosts where Project = 'A'
+---------+----------+-------+-------+
| Project | Costs | Dev | Sales |
+---------+----------+-------+-------+
| A | Expected | 1000 | 2000 |
| A | Target | 2000 | 3000 |
| A | Actual | 1500 | 2500 |
| B | Expected | 5000 | 8000 |
| B | Target | 7500 | 10000 |
| B | Actual | 10000 | 3500 |
+---------+----------+-------+-------+
</code></pre>
<p>How can I achieve such a kind of "transposition" with an SQL query?</p>
| [
{
"answer_id": 74259883,
"author": "eol",
"author_id": 3761628,
"author_profile": "https://Stackoverflow.com/users/3761628",
"pm_score": 0,
"selected": false,
"text": " public enum CustomNumber {\n PLUS_ONE(1),\n MINUS_ONE(-1);\n\n public final int value;\n\n ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12642103/"
] |
74,259,914 | <p>I have a client-side problem. The server side is working fine, and the <code>deleteCourse</code> method deletes the course, but I get the error you see in the title on the client side. I am not sure what is going on. If I need to provide something else, just ask :D</p>
<p>/actions/courses.js</p>
<pre class="lang-js prettyprint-override"><code>export const deleteCourse = (id) => async (dispatch) => {
try {
await api.deleteCourse(id);
dispatch({ type: DELETE, payload: id });
} catch (error) {
console.log(error);
}
};
</code></pre>
<pre><code>/reducers/courses.js
</code></pre>
<pre><code>import { FETCH_ALL, CREATE, UPDATE, DELETE } from '../../constants/actionTypes';
export default (courses = [], action) => {
switch (action.type) {
case FETCH_ALL:
return action.payload;
case CREATE:
return [...courses, action.payload];
case UPDATE:
return courses.map((course) =>
course._id === action.payload._id ? action.payload : course
);
case DELETE:
return courses.filter((course) => course._id !== action.payload);
default:
return courses;
}
};
</code></pre>
<pre><code>/api/index.js
</code></pre>
<pre><code>import axios from 'axios';
//Our route
const API = axios.create({ baseURL: 'http://localhost:5000' });
//Occurse before all the bellow requests
//Za google je result a za klasican je token
API.interceptors.request.use((req) => {
if (localStorage.getItem('profile'))
req.headers['Authorization'] = `Bearer ${
JSON.parse(localStorage.getItem('profile')).token
}`;
return req;
});
export const signIn = (formData) => API.post('/user/signIn', formData);
export const signUp = (formData) => API.post('/user/signUp', formData);
export const fetchCourses = () => API.get('/courses');
export const createCourse = (newCourse) => API.post('/courses', newCourse);
export const updateCourse = (id, updatedCourse) =>
API.patch(`./courses/${id}`, updatedCourse);
export const deleteCourse = (id) => API.delete(`./courses/${id}`);
</code></pre>
<pre><code>/index.js
</code></pre>
<pre class="lang-js prettyprint-override"><code>
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import reducers from '../src/api/reducers';
const store = createStore(reducers, compose(applyMiddleware(thunk)));
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<Provider store={store}>
<App />
</Provider>
);
</code></pre>
<p>/Button that starts the action</p>
<pre><code><Button size="small" color="primary" onClick={() => {
dispatch(deleteCourse(course._id))}}><DeleteIcon fontSize="small" /> Delete</Button>
</code></pre>
<p>I tried to console.log deleteCourse and I see that it is a resolved promise. Now I am watching some courses on youtube, and making my own project, but all of this is working for that guy just perfectly.</p>
<p>Thank you in advance!</p>
| [
{
"answer_id": 74259883,
"author": "eol",
"author_id": 3761628,
"author_profile": "https://Stackoverflow.com/users/3761628",
"pm_score": 0,
"selected": false,
"text": " public enum CustomNumber {\n PLUS_ONE(1),\n MINUS_ONE(-1);\n\n public final int value;\n\n ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19997365/"
] |
74,259,924 | <p>Let's say we have following list</p>
<pre><code>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
</code></pre>
<p>Now I want to add every 3 numbers together to provide length of 6 list thus,</p>
<pre><code>[6, 15, 24, 33, 42, 51]
</code></pre>
<p>I want to do this in python.... please help! (was my question worded weirdly,,?)</p>
<p>Until now I tried</p>
<pre><code>z = np.zeros(6)
p = 0
cc = 0
for i in range(len(that_list)):
p += that_list[i]
cc += 1
if cc == 3:
t = int((i+1)/3)
z[t] = p
cc = 0
p = 0
</code></pre>
<p>and it did not work....</p>
| [
{
"answer_id": 74259968,
"author": "Sash Sinha",
"author_id": 6328256,
"author_profile": "https://Stackoverflow.com/users/6328256",
"pm_score": 4,
"selected": true,
"text": ">>> nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]\n>>> [sum(nums[i:i+3]) for i in range(0... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20171425/"
] |
74,259,926 | <p>can anyone help please, with DRF</p>
<p>according to POST request, I want to create(if not exists) or update() table</p>
<p>belows are my codes</p>
<p>model.py</p>
<pre><code>class User1(models.Model):
user = models.CharField(max_length=10)
full_name = models.CharField(max_length=20)
logon_data = models.DateTimeField(blank=True, null=True)
</code></pre>
<p>serializer.py</p>
<pre><code>class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User1
fields = '__all__'
</code></pre>
<p>views.py</p>
<pre><code>from .models import User1
from .serializers import UserSerializer
from rest_framework.response import Response
from rest_framework.decorators import api_view
@api_view(['GET', 'POST'])
def UserView(request):
if request.method == 'GET':
users = User1.objects.all()
serializer = UserSerializer(users, many=True)
return Response(serializer.data)
elif request.method == 'POST':
users = User1.objects.all()
serializer = UserSerializer(data=request.data, many=True)
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=201)
return Response(serializer.errors, status=400)
</code></pre>
<p>urls.py</p>
<pre><code>from django.urls import path
from . import views
urlpatterns = [
path('users/', views.UserView),
]
</code></pre>
<p><strong>when POST request, I want to check like this:</strong></p>
<pre><code>if user exists:
if user.full_name == request.fullname
update (user.logon_data)
save()
else:
update (user.full_name)
update (user.logon_data)
save()
else:
create(
user = request.user,
full_name = request.full_name,
logon_data = request.logon_date)
save()
</code></pre>
<p>POST request for JSON like this:</p>
<pre><code>[
{
"user": "testuser1",
"full_name": "test user1",
"logon_data": "2022-10-19 09:37:26"
},
{
"user": "testuser2",
"full_name": "test user2",
"logon_data": "2022-10-20 07:02:06"
}
]
</code></pre>
| [
{
"answer_id": 74260035,
"author": "assume_irrational_is_rational",
"author_id": 11622508,
"author_profile": "https://Stackoverflow.com/users/11622508",
"pm_score": 0,
"selected": false,
"text": "update_or_create"
},
{
"answer_id": 74260140,
"author": "shiva bahadur basnet",
... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17278856/"
] |
74,259,986 | <p>I have an instance of MuleSoft's Flex Gateway (v 1.2.0) installed on a Linux machine in a podman container. I am trying to forward container as well as API logs to Splunk. Below is my log.yaml file in /home/username/app folder. Not sure what I am doing wrong, but the logs are not getting forwarded to Splunk.</p>
<pre><code>apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
name: logging-config
spec:
logging:
outputs:
- name: default
type: splunk
parameters:
host: <instance-name>.splunkcloud.com
port: "443"
splunk_token: xxxxx-xxxxx-xxxx-xxxx
tls: "on"
tls.verify: "off"
splunk_send_raw: "on"
runtimeLogs:
logLevel: info
outputs:
- default
accessLogs:
outputs:
- default
</code></pre>
<p>Please advise.</p>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1982597/"
] |
74,259,987 | <p>I have the following list of named vectors:</p>
<pre><code>lof <- list(PP1 = c(A = -0.96, R = 0.8, N = 0.82, D = 1, C = -0.55,
E = 0.94, Q = 0.78, G = -0.88, H = 0.67, I = -0.94, L = -0.9,
K = 0.6, M = -0.82, F = -0.85, P = -0.81, S = 0.41, T = 0.4,
W = 0.06, Y = 0.31, V = -1), PP2 = c(A = -0.76, R = 0.63, N = -0.57,
D = -0.89, C = -0.47, E = -0.54, Q = -0.3, G = -1, H = -0.11,
I = -0.05, L = 0.03, K = 0.1, M = 0.03, F = 0.48, P = -0.4, S = -0.82,
T = -0.64, W = 1, Y = 0.42, V = -0.43), PP3 = c(A = 0.31, R = 0.99,
N = 0.02, D = -1, C = 0.19, E = -0.99, Q = -0.38, G = 0.49, H = 0.37,
I = -0.18, L = -0.24, K = 1, M = -0.08, F = -0.58, P = -0.07,
S = 0.57, T = 0.37, W = -0.47, Y = -0.2, V = -0.14))
</code></pre>
<p>What I want to do is to convert it to tibble and keeping the name of the vector as a column in a tibble.</p>
<p>With this:</p>
<pre><code>library(tidyverse)
as_tibble(lof)
</code></pre>
<p>I get this:</p>
<pre><code># A tibble: 20 × 3
PP1 PP2 PP3
<dbl> <dbl> <dbl>
1 -0.96 -0.76 0.31
2 0.8 0.63 0.99
.. etc ...
</code></pre>
<p>What I want to get is this:</p>
<pre><code> PP1 PP2 PP3. residue
1 -0.96 -0.76 0.31 A
2 0.8 0.63 0.99 R
.. etc ...
</code></pre>
<p>How can I achieve that?</p>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74259987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8391698/"
] |
74,260,000 | <p>basically my app receives a serial number through an AJAX POST request from the front end, and it has to find the product who's serial number matches the given serial number and return it's details.</p>
<p>here is my view , I have confirmed that the data is being received correctly and that a product with the exact serial number exists in the database but i still get a 404 not found response.</p>
<p>i am using Mariadb as my app's database.
here is my code:
``</p>
<pre><code>```
from django.http import HttpResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from products.models import Products
from django.shortcuts import get_object_or_404
``
# Create your views here.
@csrf_exempt
def products(request):
if request.method == 'POST':
query = request.body.decode('utf-8')
products = Products.objects.all()
for i in products:
print(f"item{i} : {i.serial_number}")
print(f"request : {query}")
context = {
'products' : products,
}
get_object_or_404(products,serial_number = query)
return render(request,"products/products.html",context)
else:
return render(request,"products/products.html")
```
here is the terminal output:
`
`[31/Oct/2022 10:29:48] "GET / HTTP/1.1" 200 2459
itemProducts object (1) : https://blog.minhazav.dev/research/html5-qrcode.html
itemProducts object (3) : 123
itemProducts object (4) :
itemProducts object (5) : http://shooka.com
request : "http://shooka.com"
Not Found: /`
``
</code></pre>
<p>and here is my models code:</p>
<pre><code>`from django.db import models
# Create your models here.
class Products(models.Model):
pub_date = models.DateTimeField('date published',null=False)
prod_name = models.CharField(max_length=255 , null=False)
serial_number = models.CharField(max_length=255 , null
=False,unique=True)
comments = models.TextField()`
</code></pre>
<p>as you can see, serial_number is a string and my query is also a string so there should be no problem comparing those two</p>
<p>i tried casting query to str before searching for it in the db, i also checked my db charset , uts utf8mb4</p>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12177358/"
] |
74,260,014 | <p>I am facing issue "Index of /" while accessing my website that i have uploaded on cPanel direct root. Even I have .htaccess file in public_html</p>
<p>I try this htaccess code.</p>
<pre><code><IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /public/$1
#RewriteRule ^ index.php [L]
RewriteRule ^(/)?$ public/index.php [L]
</IfModule>
</code></pre>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16811608/"
] |
74,260,023 | <p>I was latest terrfaorm version 1.3.3 and aws version "aws-cli/2.7.5 Python/3.9.11 Windows/10 exe/AMD64 prompt/off" and here is my script.</p>
<pre><code># Application load balancer
resource "aws_elb" "main" {
name = "constructor-io-elb-tf"
description = "Creating new ELB for the constructor-io"
subnets = aws_subnet.public.*.id
security_groups = [aws_security_group.lb.id]
}
# Creating a target group for http
resource "aws_alb_target_group" "tg" {
name = "constuctor-target-group-tf"
port = 80
provider = http
vpc_id = aws_vpc.main.id
target_type = "ip"
health_check {
healthy_threshold = "2"
unhealthy_threshold = 1
interval = "20"
protocol = http
matcher = "200"
timeout = "5"
health_check_path = var.health_check_path
}
}
# Redirecting all the traffic from ALB to target group
resource "aws_alb_listener" "listener" {
load_balancer_arn = aws.alb.main.id
port = var.app_port
protocol = http
default_action {
target_group_arn = aws_alb_target_group.tg.id
type = "forward"
}
}
</code></pre>
<p>Wehn I run "terraform apply it was saying,</p>
<pre><code>│ Error: Invalid resource type
│
│ on alb.tf line 12, in resource "aws_lb_target_group" "tg":
│ 12: resource "aws_lb_target_group" "tg" {
│
│ The provider hashicorp/http does not support resource type "aws_lb_target_group".
</code></pre>
<p>I also tried with "aws_alb_target_group" and upgraded using "terraform init -upgrade"
Nothing works.</p>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19683820/"
] |
74,260,059 | <p>The question is, that if i have a string, i.e:</p>
<pre><code>"--Julius.",
</code></pre>
<p>and I want replace "-" and ".". How i can get it?</p>
<p>Finally, I get:</p>
<pre><code>"Julius"
</code></pre>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20320355/"
] |
74,260,064 | <p>The following syntax when migrated to EF Core has the following error</p>
<blockquote>
<p>InvalidOperationException: The LINQ expression 'DbSet()
.Join(
inner: DbSet(),
outerKeySelector: ij => ij.ImportDefinitionId,
innerKeySelector: id => id.ImportDefinitionId,
resultSelector: (ij, id) => new {
ij = ij,
id = id
})
.Join(
inner: DbSet(),
outerKeySelector: <>h__TransparentIdentifier0 => <>h__TransparentIdentifier0.id.ImportTypeId,
innerKeySelector: it => it.ImportTypeId,
resultSelector: (<>h__TransparentIdentifier0, it) => new {
<>h__TransparentIdentifier0 = <>h__TransparentIdentifier0,
it = it
})
.GroupJoin(
inner: DbSet(),
outerKeySelector: <>h__TransparentIdentifier1 => <>h__TransparentIdentifier1.<>h__TransparentIdentifier0.ij.ImportJobId,
innerKeySelector: ijp => ijp.ImportJobId,
resultSelector: (<>h__TransparentIdentifier1, ijpGroup) => new {
<>h__TransparentIdentifier1 = <>h__TransparentIdentifier1,
ijpGroup = ijpGroup
})' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly
by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList',
or 'ToListAsync'. See <a href="https://go.microsoft.com/fwlink/?linkid=2101038" rel="nofollow noreferrer">https://go.microsoft.com/fwlink/?linkid=2101038</a>
for more information.</p>
</blockquote>
<pre><code> (from ij in ImportJobs
join id in ImportDefinitions
on ij.ImportDefinitionId equals id.ImportDefinitionId
join it in ImportTypes
on id.ImportTypeId equals it.ImportTypeId
join ijp in ImportJobParameters
on ij.ImportJobId equals ijp.ImportJobId into ijpGroup
where ij.JobQueuedTimeUtc >= DateTime.Now.AddDays(-30)
orderby ij.JobQueuedTimeUtc descending
select
new
{
ImportDefinition = id,
ImportType = it,
LastImportJob = ij,
LastImportJobParameters = ijpGroup
}).ToList()
</code></pre>
<p>My attempt to change this is as follows</p>
<pre><code> (from ij in ImportJobs
join id in ImportDefinitions
on ij.ImportDefinitionId equals id.ImportDefinitionId
join it in ImportTypes
on id.ImportTypeId equals it.ImportTypeId
from ijp in ImportJobParameters.Where(ijp => ij.ImportJobId == ijp.ImportJobId).DefaultIfEmpty()
where ij.JobQueuedTimeUtc >= DateTime.Now.AddDays(-60)
orderby ij.JobQueuedTimeUtc descending
select
new
{
ImportDefinition = id,
ImportType = it,
LastImportJob = ij,
LastImportJobParameter = ijp
}).ToList()
.GroupBy(i => new { i.ImportDefinition, i.ImportType, i.LastImportJob })
.Select(i => new { i.Key.ImportDefinition, i.Key.ImportType, i.Key.LastImportJob, LastImportJobParameters = i.Select(s => s.LastImportJobParameter) })
</code></pre>
<p>however this results in a IEnumerable of LastImportJobParameters having 1 item of null where previously there would be 0 items. Just wondering if there is an equivalent EF Core statement otherwise I will filter out once materialised.</p>
<p>** Classes simplified **</p>
<pre><code> public class ImportJob
{
[Key]
public int? ImportJobId { get; set; }
[Required]
public Int16? ImportDefinitionId { get; set; }
[NotMapped]
public ImportDefinition ImportDefinition { get; set; }
public DateTime? JobQueuedTimeUtc { get; set; }
[NotMapped]
public List<ImportJobParameter> ImportJobParameters { get; set; }
}
public class ImportJobParameter
{
[Key]
public int? ImportJobParameterId { get; set; }
[Required]
public int? ImportJobId { get; set; }
[Required]
public short? ImportParameterId { get; set; }
public string ParameterName { get; set; }
public string ParameterValue { get; set; }
}
public class ImportDefinition
{
[Key]
public Int16? ImportDefinitionId
{
get;
set;
}
[Required]
[StringLength(255)]
public string Name
{
get;
set;
}
public ImportType ImportType
{
get;
set;
}
[Required]
public Int16? ImportTypeId
{
get;
set;
}
}
public class ImportType
{
[Key]
public Int16? ImportTypeId
{
get; set;
}
[Required]
[StringLength(100)]
public string Name
{
get;
set;
}
}
</code></pre>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15167728/"
] |
74,260,094 | <p>How do I get the <code>.top_box</code> to be fixed in the head of the <code>.content</code>?</p>
<p>With the current code, the <code>.top_box</code> always scrolls along with the <code>.content</code>.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper {
height: 160px;
display: flex;
flex-direction: column;
}
.title_container {
background: pink;
}
.content {
height: 0;
flex: auto;
position: relative;
overflow-y: auto;
overflow-x: hidden;
background-color: bisque;
}
.top_box {
position: absolute;
top: 0;
left: 0;
width: 300px;
height: 16px;
background: royalblue;
}
.scroll_fill {
height: 500px;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="wrapper">
<div class="title_container">anyString</div>
<div class="content">
<div class="top_box"></div>
<div class="scroll_fill"></div>
</div>
</div></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11835712/"
] |
74,260,104 | <p>I have a problem Self sizing Cell problem.
I want make layout like Feed Content with attached Image like twitter</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Profile Image</th>
<th>-</th>
<th>Nickname Label</th>
<th>-</th>
<th>date Label</th>
<th>-</th>
<th>menuBarButton</th>
</tr>
</thead>
<tbody>
<tr>
<td>Vertical - StackView</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>ㄴ</td>
<td>Content Label</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>ㄴ</td>
<td>FSPager CollectionView</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Horizontal - StackView</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<p>Cell height is fine with image or none image cell, but debug console tells the broken Constraints</p>
<p>error is...</p>
<pre><code>"<SnapKit.LayoutConstraint:0x281fab000@FeedCell.swift#207 UILabel:0x134433be0.top == UITableViewCellContentView:0x134437b90.top + 10.0>",
"<SnapKit.LayoutConstraint:0x281fab060@FeedCell.swift#208 UILabel:0x134433be0.height == 25.0>",
"<SnapKit.LayoutConstraint:0x281fab5a0@FeedCell.swift#236 UIStackView:0x1344370d0.top == UILabel:0x134433be0.bottom + 10.0>",
"<SnapKit.LayoutConstraint:0x281fab840@FeedCell.swift#243 UIStackView:0x134437a00.top == UIStackView:0x1344370d0.bottom + 10.0>",
"<SnapKit.LayoutConstraint:0x281fab960@FeedCell.swift#245 UIStackView:0x134437a00.bottom == UITableViewCellContentView:0x134437b90.bottom - 10.0>",
"<NSLayoutConstraint:0x2819478e0 'UISV-canvas-connection' UIStackView:0x1344370d0.top == UILabel:0x1344341a0.top (active)>",
"<NSLayoutConstraint:0x281947930 'UISV-canvas-connection' V:[UILabel:0x1344341a0]-(0)-| (active, names: '|':UIStackView:0x1344370d0 )>",
"<NSLayoutConstraint:0x2819777a0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x134437b90.height == 44 (active)>"
</code></pre>
<p>and my Code is</p>
<pre><code> profileImageView.snp.makeConstraints {
$0.leading.equalToSuperview().offset(10)
$0.top.equalTo(nicknameLabel)
$0.size.equalTo(50)
}
nicknameLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
nicknameLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(10)
$0.height.equalTo(25)
$0.leading.equalTo(profileImageView.snp.trailing).offset(10)
}
dateLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
dateLabel.snp.makeConstraints {
$0.centerY.equalTo(nicknameLabel)
$0.height.equalTo(25)
$0.leading.equalTo(nicknameLabel.snp.trailing)
}
menuBarButton.setContentHuggingPriority(.required, for: .horizontal)
menuBarButton.snp.makeConstraints {
$0.top.equalTo(nicknameLabel)
$0.leading.equalTo(dateLabel.snp.trailing).offset(10)
$0.trailing.equalToSuperview().inset(10)
}
imagePagerView.snp.makeConstraints {
$0.size.equalTo(250)
}
attachmentView.snp.makeConstraints {
$0.top.equalTo(nicknameLabel.snp.bottom).offset(10)
$0.leading.equalTo(nicknameLabel)
$0.trailing.equalTo(menuBarButton)
}
footerStackView.snp.makeConstraints {
$0.top.equalTo(attachmentView.snp.bottom).offset(10)
$0.leading.equalTo(nicknameLabel)
$0.bottom.equalToSuperview().inset(10)
}
</code></pre>
<p><a href="https://i.stack.imgur.com/JR4O3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JR4O3.jpg" alt="enter image description here" /></a></p>
<p>and my tableView code is..
`</p>
<pre><code> lazy var tableView = UITableView().then {
$0.register(FeedCell.self, forCellReuseIdentifier: FeedCell.identifier)
$0.refreshControl = refreshControl
$0.backgroundView = EmptyView(text: "피드가 존재하지 없습니다.")
$0.backgroundView?.isHidden = true
$0.backgroundColor = .white
$0.estimatedRowHeight = 300
$0.rowHeight = UITableView.automaticDimension
}
</code></pre>
<p>`</p>
<p>I read raywenderlich.com self sizing cell and WTFAutolayout is
<a href="https://www.wtfautolayout.com/?constraintlog=%22%3CSnapKit.LayoutConstraint:0x281fab000@FeedCell.swift%23207%20UILabel:0x134433be0.top%20%3D%3D%20UITableViewCellContentView:0x134437b90.top%20%20%2010.0%3E%22,%0A%20%20%20%20%22%3CSnapKit.LayoutConstraint:0x281fab060@FeedCell.swift%23208%20UILabel:0x134433be0.height%20%3D%3D%2025.0%3E%22,%0A%20%20%20%20%22%3CSnapKit.LayoutConstraint:0x281fab5a0@FeedCell.swift%23236%20UIStackView:0x1344370d0.top%20%3D%3D%20UILabel:0x134433be0.bottom%20%20%2010.0%3E%22,%0A%20%20%20%20%22%3CSnapKit.LayoutConstraint:0x281fab840@FeedCell.swift%23243%20UIStackView:0x134437a00.top%20%3D%3D%20UIStackView:0x1344370d0.bottom%20%20%2010.0%3E%22,%0A%20%20%20%20%22%3CSnapKit.LayoutConstraint:0x281fab960@FeedCell.swift%23245%20UIStackView:0x134437a00.bottom%20%3D%3D%20UITableViewCellContentView:0x134437b90.bottom%20-%2010.0%3E%22,%0A%20%20%20%20%22%3CNSLayoutConstraint:0x2819478e0%20%27UISV-canvas-connection%27%20UIStackView:0x1344370d0.top%20%3D%3D%20UILabel:0x1344341a0.top%20%20%20(active)%3E%22,%0A%20%20%20%20%22%3CNSLayoutConstraint:0x281947930%20%27UISV-canvas-connection%27%20V:%5BUILabel:0x1344341a0%5D-(0)-%7C%20%20%20(active,%20names:%20%27%7C%27:UIStackView:0x1344370d0%20)%3E%22,%0A%20%20%20%20%22%3CNSLayoutConstraint:0x2819777a0%20%27UIView-Encapsulated-Layout-Height%27%20UITableViewCellContentView:0x134437b90.height%20%3D%3D%2044%20%20%20(active)%3E%22" rel="nofollow noreferrer">enter link description here</a></p>
| [
{
"answer_id": 74263518,
"author": "RichG",
"author_id": 2227420,
"author_profile": "https://Stackoverflow.com/users/2227420",
"pm_score": 1,
"selected": false,
"text": "https://http-input.<instance-name>.splunkcloud.com:443/services/collector/raw"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19523970/"
] |
74,260,108 | <p>I want to create a role assignment which allows a resource group to contribute to a static ip adresse.
The role assignment looks like the following:</p>
<pre><code> resource "azurerm_role_assignment" "public_ip_role" {
scope = azurerm_public_ip.ingress_nginx.id
role_definition_name = "Contributor"
principal_id = data.azurerm_resource_group.rg_aks.object_id
}
</code></pre>
<p>The data source looks like this:</p>
<pre><code>data "azurerm_resource_group" "rg_aks" {
name = "aks-my-${var.environment}"
}
</code></pre>
<p>The error I get is the following:</p>
<pre><code>│ This object has no argument, nested block, or exported attribute named "object_id".
</code></pre>
| [
{
"answer_id": 74260382,
"author": "Marko E",
"author_id": 8343484,
"author_profile": "https://Stackoverflow.com/users/8343484",
"pm_score": 1,
"selected": false,
"text": ".id"
},
{
"answer_id": 74515762,
"author": "Leo",
"author_id": 19581196,
"author_profile": "http... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19581196/"
] |
74,260,112 | <p>When <code>std::views::split()</code> gets an unnamed string literal as a pattern, it will not split the string but works just fine with an unnamed character literal.</p>
<pre class="lang-cpp prettyprint-override"><code>#include <iomanip>
#include <iostream>
#include <ranges>
#include <string>
#include <string_view>
int main(void)
{
using namespace std::literals;
// returns the original string (not splitted)
auto splittedWords1 = std::views::split("one:.:two:.:three", ":.:");
for (const auto word : splittedWords1)
std::cout << std::quoted(std::string_view(word));
std::cout << std::endl;
// returns the splitted string
auto splittedWords2 = std::views::split("one:.:two:.:three", ":.:"sv);
for (const auto word : splittedWords2)
std::cout << std::quoted(std::string_view(word));
std::cout << std::endl;
// returns the splitted string
auto splittedWords3 = std::views::split("one:two:three", ':');
for (const auto word : splittedWords3)
std::cout << std::quoted(std::string_view(word));
std::cout << std::endl;
// returns the original string (not splitted)
auto splittedWords4 = std::views::split("one:two:three", ":");
for (const auto word : splittedWords4)
std::cout << std::quoted(std::string_view(word));
std::cout << std::endl;
return 0;
}
</code></pre>
<p>See live @ <a href="https://godbolt.org/z/rvrjooYbj" rel="noreferrer">godbolt.org</a>.</p>
<p>I understand that string literals are always lvalues. But even though, I am missing some important piece of information that connects everything together. Why can I pass the string that I want splitted as an unnamed string literal whereas it fails (as-in: returns a range of ranges with the original string) when I do the same with the pattern?</p>
| [
{
"answer_id": 74260337,
"author": "康桓瑋",
"author_id": 11638718,
"author_profile": "https://Stackoverflow.com/users/11638718",
"pm_score": 6,
"selected": true,
"text": "\":.:\""
},
{
"answer_id": 74264841,
"author": "Barry",
"author_id": 2069064,
"author_profile": "ht... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1264543/"
] |
74,260,170 | <p>I am making a game with groups of birds, when I press a key I want all the birds to move at the same time but only one is moving.</p>
<p>There are five birds that I create with a loop, but only one of them is moving.</p>
<p>How can I move all of them at the same time</p>
<pre class="lang-py prettyprint-override"><code>class Birds(pygame.sprite.Sprite):
def __init__(self, image, width, height, pos_x, pos_y):
super().__init__()
self.width = width
self.height = height
self.pos_x = pos_x
self.pos_y = pos_y
self.image = pygame.image.load(
os.path.join("Assets", image)).convert_alpha()
self.image = pygame.transform.scale(self.image, (80, 70))
self.rect = self.image.get_rect()
self.rect.center = [self.pos_x, self.pos_y]
def movement(self):
keys = pygame.key.get_pressed()
if(keys[pygame.K_u]):
if self.pos_x > 400 or self.pos_x < 0:
pos_x, pos_y = self.rect.center
pos_x -= 5
self.rect.center = (pos_x, pos_y)
birds_sprite = pygame.sprite.Group()
for target in range(5):
new_target = Birds("birds.png", 100, 100,
random.randrange(0, BACKGROUND_WIDTH),
random.randrange(0, BACKGROUND_HEIGHT // 3), 3, 3)
birds_sprite.add(new_target)
pygame.init()
clock = pygame.time.Clock()
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
picture = pygame.transform.scale(BACKGROUND_IMAGE, (1000, 540))
pygame.display.flip()
# gunhunter.shoot()
WIN.blit(picture, (0, 0))
birds_sprite.draw(WIN)
new_target.movement()
birds_sprite.update()
clock.tick(60)
pygame.quit()
</code></pre>
| [
{
"answer_id": 74260434,
"author": "Rabbid76",
"author_id": 5577765,
"author_profile": "https://Stackoverflow.com/users/5577765",
"pm_score": 2,
"selected": true,
"text": "movement"
},
{
"answer_id": 74262735,
"author": "Chukwuma Kingsley",
"author_id": 5741710,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5741710/"
] |
74,260,187 | <p>New to js. I am hardcoding an array of objects in javaScript. the structure of it is something like this</p>
<pre><code>const myArray = [
{id:dummy_String_ID1, name: full_name_with_Spaces1, department:department_withSpaces1},
{id:dummy_String_ID2, name: full_name_with_Spaces2, department:department_withSpaces2},
{id:dummy_String_ID3, name: full_name_with_Spaces3, department:department_withSpaces3}
];
</code></pre>
<p>What confuses me is the declaration of these keys( id , name, department), I know the values have to be in inverted quotes. But when shall I use the key fields with inverted quotes (like this "id": "12345", "name": "foo bar", "department": "dept 1" ) and when without them (like this id:"1234", name: "foo bar", dept: "dept 1"). What difference does it make?</p>
| [
{
"answer_id": 74260434,
"author": "Rabbid76",
"author_id": 5577765,
"author_profile": "https://Stackoverflow.com/users/5577765",
"pm_score": 2,
"selected": true,
"text": "movement"
},
{
"answer_id": 74262735,
"author": "Chukwuma Kingsley",
"author_id": 5741710,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17911990/"
] |
74,260,188 | <p>I have data that looks like this <code>[[{'title': 'Line'}], [{'title': 'asd'}]]</code>. I want to add a new key and value for every list inside of lists.</p>
<p>I have tried this but I'm having an error 'list' object is not a mapping. Any suggestion?</p>
<pre class="lang-py prettyprint-override"><code>data = [[{'title': 'Line'}], [{'title': 'asd'}]]
titleID = [{'id': 373}, {'id': 374}]
combine = [{**dict_1, **dict_2}
for dict_1, dict_2 in zip(char_id, data )]
</code></pre>
<p>the output I want is like this:</p>
<pre class="lang-py prettyprint-override"><code>[[{'id': 373, 'title': 'Line'}], [{'id': 374, 'title': 'asd'}]]
</code></pre>
| [
{
"answer_id": 74260434,
"author": "Rabbid76",
"author_id": 5577765,
"author_profile": "https://Stackoverflow.com/users/5577765",
"pm_score": 2,
"selected": true,
"text": "movement"
},
{
"answer_id": 74262735,
"author": "Chukwuma Kingsley",
"author_id": 5741710,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19894724/"
] |
74,260,199 | <p>I am trying to create multiple ec2 instance using terraform modules. As every instance will have different user data, I want to do this but it's giving error</p>
<pre><code>data "local_file" "user_data" {
for_each = { for ec2 in var.ec2_instances : ec2.name => ec2 }
filename = "${path.cwd}/${each.value.user_data}"
}
resource "aws_instance" "instances" {
for_each = { for instance in var.ec2_instances : instance.name => instance }
ami = each.value.ami
instance_type = each.value.type
cpu_core_count = each.value.cpu_core
user_data_base64 = base64encode(data.local_file.user_data[each.value.name].rendered)
}
</code></pre>
<p>module.tf</p>
<pre><code>module "ec2_app_demo" {
source = "./aws-ec2-application/"
ec2_instances = var.ec2_instances
}
</code></pre>
<p>In the tfvars file</p>
<pre><code>ec2_instances= [
{
name = test1
user_data = ec2_1.sh
},
{
name = test2
user_data = ec2_2.sh
}
]
</code></pre>
<p>Error:</p>
<blockquote>
<p>Error: Invalid function argument\n\n on main.tf line 76, in data "local_file" "linux-vm-cloud-init":\n 76: filename = file("${each.value.user_data}")\n</p>
</blockquote>
<p>Please let me know if the file name can be used a variable.</p>
<p>The folder structure is below:
<a href="https://i.stack.imgur.com/YdXGx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YdXGx.png" alt="enter image description here" /></a></p>
| [
{
"answer_id": 74260511,
"author": "Marcin",
"author_id": 248823,
"author_profile": "https://Stackoverflow.com/users/248823",
"pm_score": 1,
"selected": false,
"text": "file"
},
{
"answer_id": 74260514,
"author": "Marko E",
"author_id": 8343484,
"author_profile": "htt... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6894441/"
] |
74,260,259 | <p>I have a curl request like below I'm trying to convert it to guzzle but when I send a request to cloudflare it keeps returning me an error. "decoding error" Is there a bug in my guzzle request? Normal curl request should be stable.</p>
<pre><code>`curl \
-X POST \
-d '{"url":"https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4","meta":{"name":"My First Stream Video"}}' \
-H "Authorization: Bearer <API_TOKEN>" \
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/copy`
</code></pre>
<p>My codes are available below.</p>
<pre><code> $response = $client->request('POST', 'https://api.cloudflare.com/client/v4/accounts/' . $accountId . '/stream/copy', [
'headers' => [
'Authorization' => 'Bearer ' . $token,
],
'form_params' => [
"url" => "https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4",
"meta" => [
"name": "My First Stream Video"
]
]
</code></pre>
| [
{
"answer_id": 74260403,
"author": "Harshana",
"author_id": 6952359,
"author_profile": "https://Stackoverflow.com/users/6952359",
"pm_score": 1,
"selected": false,
"text": "$response = $client->request('POST', 'https://api.cloudflare.com/client/v4/accounts/' . $accountId . '/stream/copy'... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377244/"
] |
74,260,283 | <p>I am developing my project with Vue3 , I am getting this error while running, here is my whole code . Can someone help me fix it. Thank you guys</p>
<pre><code><script>
import axios from 'axios';
export default {
name: "RegisterView",
data() {
return {
user: {
username: "",
password: "",
email: "",
phoneNumber: "",
role: "",
},
role : []
};
},computed:{
getRole(){
axios.get('http://localhost:8080/api/role/get').then(res=>{
this.role = res.data;
})
return [];
}
},
methods: {
register() {
axios.post("http://localhost:8080/api/user/register", this.user).then((res) => {
console.log(res.data);
});
},
},
};
</script>
</code></pre>
<pre><code>// Error Unexpected asynchronous action in "getRole" computed property vue/no-async-in-computed-properties
</code></pre>
<p>I tried async and await , but it seems I got it wrong</p>
| [
{
"answer_id": 74260634,
"author": "Boussadjra Brahim",
"author_id": 8172857,
"author_profile": "https://Stackoverflow.com/users/8172857",
"pm_score": 2,
"selected": true,
"text": "created"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18500877/"
] |
74,260,294 | <pre><code>i=1
if int(n)==sum(int(x)**i for x in str(n); i=i+1)
print("Disarum Number")
else:
print("Non-Disarum Number")
</code></pre>
<p>I expected the value of i to increase after each iteration. I wanted a short version of the following code :-</p>
<pre><code>i=1
s=0
for x in str(n):
s=s+(int(x)**i)
i=i+1
</code></pre>
| [
{
"answer_id": 74260634,
"author": "Boussadjra Brahim",
"author_id": 8172857,
"author_profile": "https://Stackoverflow.com/users/8172857",
"pm_score": 2,
"selected": true,
"text": "created"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377274/"
] |
74,260,297 | <p>I am using jmeter for the first time . I have added a beanShell sampler , I get this eroor
Typed variable declaration : <em><strong>Class: EventRequestDTO not found in namespace</strong></em>
Who know why?
and Here is my code :
**</p>
<pre><code>import event.Events;
import dto.EventRequestDTO;
System.out.println("Hi");
String[] t = {};
EventRequestDTO eDto = new EventRequestDTO("This", "This", "here", "condition_01","100", "It occurred", " return true;", "0", "0", "0", t, false);
</code></pre>
<p>**</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 74260634,
"author": "Boussadjra Brahim",
"author_id": 8172857,
"author_profile": "https://Stackoverflow.com/users/8172857",
"pm_score": 2,
"selected": true,
"text": "created"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14032341/"
] |
74,260,323 | <p>I try to scrape a webpage with hourly energy prices. I want to use the data for home-automation. if the hourly price =< baseload price, certain times should turn on via Mqtt.
I managed to get the data from the baseload price and the hourly prices from its column. The output from the column seems not to be in one list but in 24 lists. correct? how to fix this so that the hourly price can be compared with the baseload price?</p>
<pre class="lang-py prettyprint-override"><code>import datetime
import pytz
import requests
from bs4 import BeautifulSoup as bs
today_utc = pytz.utc.localize(datetime.datetime.utcnow())
today = today_utc.astimezone(pytz.timezone("Europe/Amsterdam"))
text_today = today.strftime("%y-%m-%d")
print(today)
print(text_today)
yesterday = datetime.datetime.now(tz=pytz.timezone("Europe/Amsterdam")) - datetime.timedelta(1)
text_yesterday = yesterday.strftime("%y-%m-%d")
print(yesterday)
print(text_yesterday)
url_part1 = 'https://www.epexspot.com/en/market-data?market_area=NL&trading_date='
url_part2 = '&delivery_date='
url_part3 = '&underlying_year=&modality=Auction&sub_modality=DayAhead&technology=&product=60&data_mode=table&period=&production_period='
url_text = url_part1+text_yesterday+url_part2+text_today+url_part3
print(url_text)
html_text = requests.get(url_text).text
#print(html_text)
soup = bs(html_text,'lxml')
#print(soup.prettify())
baseload = soup.find_all('div', class_='flex day-1')
for baseload_price in baseload:
baseload_price = baseload_price.find('span').text.replace(' ', '')
print(baseload_price)
table = soup.find_all('tr',{'class':"child"})
#print(table)
for columns in table:
column3 = columns.find_all('td')[3:]
#print(columns)
column3_text = [td.text.strip() for td in column3]
column3_text = column3_text
print(column3_text)
</code></pre>
| [
{
"answer_id": 74260634,
"author": "Boussadjra Brahim",
"author_id": 8172857,
"author_profile": "https://Stackoverflow.com/users/8172857",
"pm_score": 2,
"selected": true,
"text": "created"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377233/"
] |
74,260,340 | <p>Initializing the file name via pointer let's crash the gcc on Linux but not on MacOS, can someone explain this?</p>
<pre><code>#include <stdio.h>
int doOpenFile( char *name, FILE **filehdl, char *option );
int doOpenFile( char *name, FILE **filehdl, char *option )
{
if( *filehdl ) fclose( *filehdl );
if( (*filehdl = fopen( name, option )) == NULL ) return( -1 );
return( 0 );
}
int main(int argc, char **argv)
{
char *file = "test.c";
FILE *filePtr;
doOpenFile(file, &filePtr, "r");
if(filePtr != NULL) fclose(filePtr);
printf("%s\n", file);
}
</code></pre>
<p>Linux gcc:</p>
<pre><code>oot@1fa88ab5df9e:/build/open62541-server# gcc -o test test.c
root@1fa88ab5df9e:/build/open62541-server# ./test
Segmentation fault (core dumped)
root@1fa88ab5df9e:/build/open62541-server# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20210110 (Debian 10.2.1-6)
root@1fa88ab5df9e:/build/open62541-server#
</code></pre>
<p>MacOS:</p>
<pre><code>open62541-server % gcc test.c -o test
open62541-server % ./test
test.c
open62541-server % gcc -v
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
open62541-server %
</code></pre>
<p>Weird because even if I don't pass the variable, the gcc on Linux crash</p>
<pre><code>doOpenFile("test.c", &filePtr, "r");
</code></pre>
| [
{
"answer_id": 74260682,
"author": "Lundin",
"author_id": 584518,
"author_profile": "https://Stackoverflow.com/users/584518",
"pm_score": 1,
"selected": false,
"text": "if( *filehdl )"
},
{
"answer_id": 74262029,
"author": "MrKleeblatt",
"author_id": 14794107,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15750238/"
] |
74,260,350 | <p>Me need set random position in Start() for player as minecraft.</p>
<p>Player already have the script, but position don't change of default.</p>
<p>Error in 24 and 25 string.</p>
<p>Code:</p>
<pre><code>
using UnityEngine;
public class RandomRespawn : MonoBehaviour
{
[Header("Игрок")] // player
public GameObject Player;
[Header("Объявление координат")] // have position
public int positionX;
public int positionZ;
[Header("Рандомные координаты")] // random position
public int randomPosX;
public int randomPosZ;
private void Start()
{
System.Random randomPos = new System.Random();
Vector3 positions = transform.position;
positionX = randomPos.Next(1, 50);
positionZ = randomPos.Next(1, 50);
gameObject.positions.x = positionX;
gameObject.positions.z = positionZ;
}
}
</code></pre>
<p>I have error: (25,20): error CS1061: 'GameObject' does not contain a definition for 'positions' and no accessible extension method 'positions' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?), now =(</p>
| [
{
"answer_id": 74260682,
"author": "Lundin",
"author_id": 584518,
"author_profile": "https://Stackoverflow.com/users/584518",
"pm_score": 1,
"selected": false,
"text": "if( *filehdl )"
},
{
"answer_id": 74262029,
"author": "MrKleeblatt",
"author_id": 14794107,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20364027/"
] |
74,260,353 | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const arr = [5,3,2,6,1];
const quickSort = (arr) => {
for(let j = 0; j < arr.length; j++) {
let index = null;
let min = arr[0];
for(let i = 0; i < arr.length; i++) {
if(arr[i] < min) {
min = arr[i]
index = i
}
}
const tmp = arr[j]
arr[0] = min;
arr[index] = tmp
}
return arr;
}
console.log(quickSort(arr), 'res')</code></pre>
</div>
</div>
</p>
<p>In the code above i try to sort the array using the next logic:</p>
<ul>
<li>i compare each array element with the first one and if it is lower than the first then i swap the array elements.
Doing this i don't get the sorted array. <br> Question: What is the issue with my code and how to fix it?</li>
</ul>
| [
{
"answer_id": 74260682,
"author": "Lundin",
"author_id": 584518,
"author_profile": "https://Stackoverflow.com/users/584518",
"pm_score": 1,
"selected": false,
"text": "if( *filehdl )"
},
{
"answer_id": 74262029,
"author": "MrKleeblatt",
"author_id": 14794107,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12540500/"
] |
74,260,357 | <p>Earlier my project was running without error but today i am getting following error. I would appreciate if anyone can help to get out of this issue.</p>
<p><strong>Note- I am not using jCenter in my app, payment sdk flutter_stripe using jCenter</strong></p>
<pre><code>FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.stripe:stripe-android:20.12.+.
Required by:
project :app > project :stripe_android
> Failed to list versions for com.stripe:stripe-android.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/stripe/stripe-android/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/stripe/stripe-android/maven-metadata.xml'.
> Read timed out
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 47s
Exception: Gradle task assembleDebug failed with exit code 1
</code></pre>
| [
{
"answer_id": 74260727,
"author": "Harish Sharma",
"author_id": 7557223,
"author_profile": "https://Stackoverflow.com/users/7557223",
"pm_score": 2,
"selected": false,
"text": "constraints { implementation('com.stripe:stripe-android') { version { strictly '20.11.0' } } }\nconstraints { ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7557223/"
] |
74,260,389 | <p>Can I map an arbitrary directory as a subdirectory of wwwroot? That is, the directory is not under wwwroot in the file system, but within my app, it is treated like so.</p>
<p>For example, I have created an ASP.NET 6.0 Blzor Server project. The programme dll path is in <code>/app/proj1/BlazorApp1.dll</code>. If there is an image at <code>/app/proj1/wwwroot/images/dog.jpg</code>, it can be rendered using <code><img src="images/dog.jpg"/></code> in my page. But what if I do not want to have this <code>images</code> directory actually under the <code>wwwroot</code> directory on the file system? Can the directory be somewhere else like <code>/data/images</code>, and I map that path to <code>wwwroot/images</code>, so that <code>/data/images/dog.jpg</code> can be rendered with <code><img src="images/dog.jpg"/></code> within my app?</p>
| [
{
"answer_id": 74260727,
"author": "Harish Sharma",
"author_id": 7557223,
"author_profile": "https://Stackoverflow.com/users/7557223",
"pm_score": 2,
"selected": false,
"text": "constraints { implementation('com.stripe:stripe-android') { version { strictly '20.11.0' } } }\nconstraints { ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455796/"
] |
74,260,428 | <p>I'm deserializing a JSON list to object[] and expectedly get an array of object. I'd like however to deserialize to more specific types. Is there a way to do that, possibly with supplying the exact type on serialization? Unfortunatly I'm not able to be more specific than object[] in my code...</p>
<pre><code>using System.Text.Json;
namespace Tests.DeSerialize;
class Program
{
public static void Main(string[] args)
{
object[] objs = new object[]{
42,
"foobar",
false,
new Example {
Name = "example",
}
};
foreach (var obj in objs)
{
Console.WriteLine(obj.GetType().Name);
}
var serialized = JsonSerializer.Serialize(objs);
Console.WriteLine();
Console.WriteLine(serialized);
Console.WriteLine();
object[] deSerializedObjs = JsonSerializer.Deserialize<object[]>(serialized);
foreach (var obj in deSerializedObjs)
{
Console.WriteLine(obj.GetType().FullName);
}
}
}
public class Example
{
public string Name { get; set; }
public override string ToString() => $"{GetType().Name}(\"{Name}\")";
}
</code></pre>
<p>Output:</p>
<pre><code>Int32
String
Boolean
Example
[42,"foobar",false,{"Name":"example"}]
System.Text.Json.JsonElement
System.Text.Json.JsonElement
System.Text.Json.JsonElement
System.Text.Json.JsonElement
</code></pre>
<p>Is there a way to somehow encode the exact type into the serialized text?</p>
| [
{
"answer_id": 74260727,
"author": "Harish Sharma",
"author_id": 7557223,
"author_profile": "https://Stackoverflow.com/users/7557223",
"pm_score": 2,
"selected": false,
"text": "constraints { implementation('com.stripe:stripe-android') { version { strictly '20.11.0' } } }\nconstraints { ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20376912/"
] |
74,260,433 | <pre><code>CREATE TABLE IF NOT EXISTS video (key int, value int, PRIMARY KEY (key, value));
</code></pre>
<p>Here Partition Key is <code>key</code> and Clustering Key is <code>value</code>. No regular columns.
Assume, there are 1000000 rows in this partition.</p>
<p>What is the size of the partition?</p>
| [
{
"answer_id": 74263346,
"author": "Madhavan",
"author_id": 10410162,
"author_profile": "https://Stackoverflow.com/users/10410162",
"pm_score": 1,
"selected": false,
"text": "nodetool flush"
},
{
"answer_id": 74263880,
"author": "Erick Ramirez",
"author_id": 4269535,
... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17952301/"
] |
74,260,480 | <p>It is possible to put If inside $message variable? code shown below :</p>
<pre><code>$message = "Semangat Pagi Akang & Teteh Semua!\n"
. "Nyai Iteung mengucapkan selamat ulang tahun &#128172 untuk:\n\n"
if($getNowCuti->AllKaryawan->jenis_kelamin == 'L')
{
. "Pak" . $stringKaryawan . "\n\n"
} else {
. "Bu" . $stringKaryawan . "\n\n"
}
. "Selamat cuti juga yaa untuk:\n\n"
if($getNowCuti->AllKaryawan->jenis_kelamin == 'L')
{
. "Pak" . $stringKaryawan . "\n\n"
} else {
. "Bu" . $stringKaryawan . "\n\n"
}
. "Harap rekan-rekan Kabayan Group tidak memberikan tugas kepada pegawai diatas pada hari ini.";
</code></pre>
<p>It shows an error, how should I fixed it? Thanks guys, have a great day!</p>
| [
{
"answer_id": 74260550,
"author": "Semih SAHIN",
"author_id": 10542740,
"author_profile": "https://Stackoverflow.com/users/10542740",
"pm_score": 3,
"selected": true,
"text": "$message = \"Semangat Pagi Akang & Teteh Semua!\\n\"\n. \"Nyai Iteung mengucapkan selamat ulang tahun 💬 ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18294688/"
] |
74,260,484 | <p>I have a following dataframe where I have one another list of index position based on some condition so just want to create the new dataframe based on the index position and check some condition on that.</p>
<pre><code>df = pd.DataFrame()
df['index'] = [ 0, 28, 35, 49, 85, 105, 208, 386, 419, 512, 816, 888, 914, 989]
df['diff_in_min'] = [ 5, 35, 42, 46, 345, 85, 96, 107, 119, 325, 8, 56, 55, 216]
df['val_1'] = [5, 25, 2, 4, 2, 5, 69, 6, 8, 7, 55, 85, 8, 67]
df['val_2'] = [8, 89, 8, 5, 7, 57, 8, 57, 4, 8, 74, 65, 55, 74]
re_ind = list(np.where(df['diff_in_min'] >= 300))
re_ind = [np.array([85, 512], dtype='int64')]
</code></pre>
<p>Just I want to create another dataframe based on re_ind position, ex:</p>
<pre><code>first_df = df[0:85]
another_df = [85:512]
last_df = [512:]
</code></pre>
<p>and each dataframe I want to check one condition</p>
<pre><code>count = 0
temp_df = df[:re_ind[0]]
if temp_df['diff_in_min'].sum() > 500:
count += 1
temp_df = df[re_ind[0]:re_ind[1]]
if temp_df['diff_in_min'].sum() > 500:
count += 1
if temp_df = df[re_ind[1]:]
if temp_df['diff_in_min'].sum() > 500:
count += 1
</code></pre>
<p>How can I do that using for loop with creating new data frame using existing dataframe?</p>
| [
{
"answer_id": 74260589,
"author": "jezrael",
"author_id": 2901002,
"author_profile": "https://Stackoverflow.com/users/2901002",
"pm_score": 2,
"selected": true,
"text": "df['diff_in_min'] >= 300)"
},
{
"answer_id": 74260743,
"author": "ScottC",
"author_id": 20174226,
... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15543946/"
] |
74,260,519 | <p>I have used p5.js library in order to make a small circle game.</p>
<p><a href="https://i.stack.imgur.com/YwgkG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YwgkG.png" alt="Circle Game" /></a></p>
<p>in which when the user clicks outside the circle, the output is:
<a href="https://i.stack.imgur.com/cOT0m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cOT0m.png" alt="Output when mouse is clicked outside the circle" /></a></p>
<p>But even when I'm clicking inside the circle, still the output says that I've clicked outside the circle.
<a href="https://i.stack.imgur.com/ELYSo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ELYSo.png" alt="Mouse inside the circle" /></a></p>
<p>here is the <code>index.html</code> file's code:</p>
<pre class="lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> A Simple Circle Game </title>
</head>
<body>
<p style="text-align: center"> A Simple Circle Game </b> </p>
<script src="https://cdn.jsdelivr.net/npm/p5@1.5.0/lib/p5.js"></script>
<script type="text/javascript" src="sketch.js"></script>
<script src="condition1.js"></script>
</body>
</html>
</code></pre>
<p>the <code>sketch.js</code> file is as follow:</p>
<pre><code>function setup(){
createCanvas(500,200).center();
noStroke();
background(230);
circle(250,100,100);
}
function draw() {
// Draw a circle
fill(240, 204, 0);
circle(mouseX, mouseY, 5);
}
</code></pre>
<p>the <code>condition1.js</code> file is as follows:</p>
<pre><code>function mousePressed() {
dist = Math.sqrt(250 * 250 + 100 * 100);
if (mouseX > 566 && mouseX < 666 && mouseY < 258 && mouseY > 158 ) {
document.write("You clicked the circle!");
} else {
document.write("You clicked outside the circle!");
}
}
</code></pre>
<p>In the above code, in the <em>if</em> condition, shall I use any other logic or is there any else issue due to which my game isn't behaving in the way it ought to be?</p>
<p>I tried changing the dimensions of mouseX and mouseY but all in vain. SSo, I'm expecting a better approach towards my solution.</p>
| [
{
"answer_id": 74260589,
"author": "jezrael",
"author_id": 2901002,
"author_profile": "https://Stackoverflow.com/users/2901002",
"pm_score": 2,
"selected": true,
"text": "df['diff_in_min'] >= 300)"
},
{
"answer_id": 74260743,
"author": "ScottC",
"author_id": 20174226,
... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19989313/"
] |
74,260,594 | <p>I am making a rest call using a copy activity to write data to a datalake storage. Source is a <strong>rest dataset</strong> and sink is a <strong>json</strong>. If I use a <strong>http binary dataset</strong> it works fine, but then I can not perform pagination in an easy way. I am getting the following <strong>error</strong>:</p>
<pre class="lang-json prettyprint-override"><code>{
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=JsonInvalidDataFormat,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Error occurred when deserializing source JSON file ''. Check if the data is in valid JSON object format.,Source=Microsoft.DataTransfer.ClientLibrary,'",
"failureType": "UserError",
"target": "ingest json to landing",
"details": []
}
</code></pre>
<p>If I only preview the data in adf I am getting the following error:</p>
<p>Error code
21155
Details
Error occurred when deserializing source JSON file ''. Check if the data is in valid JSON object format.</p>
<p><strong>If I make the same call with postman, no issues, but the body comes back as text and looks as follows:</strong>
<a href="https://i.stack.imgur.com/89Ile.png" rel="nofollow noreferrer">enter image description here</a></p>
<pre class="lang-json prettyprint-override"><code>[
{
"Data":1561,
"Number":156,
"ID":1565,
"TypeID":15,
"Type":"sdfg",
"Comments":"jbgijdresbgiesugbiiergburesgbiergb breijfberiugbi iuergiuer erguiergeriu erreuguierh guierhger eu u geir er erug iug eruhiuguiergiuguer er ug e eruhgeuirge erug erugeurhgeueruig .\nTips\n1.\trjgnrig reigeirg eirghi : \nall erjgeriugher ergierig I er gheh erh eirghherigerg ger er ghiergier eh egrigerig eg . \n2. Ewgheri ughergh erh r erhgerh:\ergjoi ihg iergierg iererigiergi er gieriger er gier iergpai g aei[g rhe agieg i[e I erg hhg rggergieerig ei gerh ergio ehaigneigrdrg dosg .\n3. Jsbdiujasbfib:\npay erkgierogh erigerho ig er erh oegiuerghe g e ir oego gerghierghe ge rgerihgeri gegh eregh.\n"
},
{
"Data":1561,
"Number":156,
"ID":1565,
"TypeID":15,
"Type":"sdfg",
"Comments":"jbgijdresbgiesugbiiergburesgbiergb breijfberiugbi iuergiuer erguiergeriu erreuguierh guierhger eu u geir er erug iug eruhiuguiergiuguer er ug e eruhgeuirge erug erugeurhgeueruig .\nTips\n1.\trjgnrig reigeirg eirghi : \nall erjgeriugher ergierig I er gheh erh eirghherigerg ger er ghiergier eh egrigerig eg . \n2. Ewgheri ughergh erh r erhgerh:\ergjoi ihg iergierg iererigiergi er gieriger er gier iergpai g aei[g rhe agieg i[e I erg hhg rggergieerig ei gerh ergio ehaigneigrdrg dosg .\n3. Jsbdiujasbfib:\npay erkgierogh erigerho ig er erh oegiuerghe g e ir oego gerghierghe ge rgerihgeri gegh eregh.\n"
}
]
</code></pre>
<p><strong>This is how the copy activity is configured:</strong></p>
<p><a href="https://i.stack.imgur.com/7LOfk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7LOfk.png" alt="enter image description here" /></a></p>
<p>Does anybody know if a rest dataset supports array of jsonlines?</p>
| [
{
"answer_id": 74260589,
"author": "jezrael",
"author_id": 2901002,
"author_profile": "https://Stackoverflow.com/users/2901002",
"pm_score": 2,
"selected": true,
"text": "df['diff_in_min'] >= 300)"
},
{
"answer_id": 74260743,
"author": "ScottC",
"author_id": 20174226,
... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18814908/"
] |
74,260,604 | <p>How I get data from API link</p>
<p><code>https://get.geojs.io/v1/ip/geo.js</code></p>
<p>I use the code bellow but not working. Please anyone talk what I wrong here?</p>
<p>`</p>
<pre><code><div id="divIDClass"></div>
<script>
$.ajax({
url: 'https://get.geojs.io/v1/ip/geo.js',
success: function(data){
document.getElementById('divIDClass').innerHTML = data.country_code);
}
})
</script>
</code></pre>
<p>`</p>
<p>Show undefined inner html</p>
| [
{
"answer_id": 74260721,
"author": "notrev",
"author_id": 3964564,
"author_profile": "https://Stackoverflow.com/users/3964564",
"pm_score": 1,
"selected": false,
"text": "geoip({ /* data here */ })"
},
{
"answer_id": 74260736,
"author": "Andrey Bessonov",
"author_id": 454... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20373573/"
] |
74,260,607 | <p>I need to center an unordered list, and add a text header and a footer while still keeping the list-items left aligned.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
margin: 0;
padding: 0;
background: #ccc;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
@media (max-width: 600px) {
ul {
transform: scale(0.6);
}
}
@media (min-width: 601px) and (max-width: 700px) {
ul {
transform: scale(0.7);
}
}
@media (min-width: 701px) and (max-width: 800px) {
ul {
transform: scale(0.8);
}
}
ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
ul li {
margin: 0 40px;
}
ul li a .fa {
font-size: 40px;
color: #555;
line-height: 80px;
transition: 0.5s;
}
ul li a {
position: relative;
display: block;
width: 80px;
height: 80px;
background: #fff;
text-align: center;
transform: perspective(1000px) rotate(-30deg) skew(25deg) translate(0,0);
transition: 0.5s;
box-shadow: -20px 20px 10px rgba(0, 0, 0, 0.5);
}
ul li a::before {
content: "";
position: absolute;
top: 10px;
left: -20px;
height: 100%;
width: 20px;
background: #b2b2b2;
transition: 0.5s;
transform: rotate(0deg) skewY(-45deg);
}
ul li a::after {
content: "";
position: absolute;
bottom: -20px;
left: -10px;
height: 20px;
width: 100%;
background: #e5e5e5;
transition: 0.5s;
transform: rotate(0deg) skewX(-45deg);
}
ul li a:hover {
transform: perspective(1000px) rotate(-30deg) skew(25deg) translate(20px,-20px);
box-shadow: -50px 50px 50px rgba(0, 0, 0, 0.5);
}
ul li:hover .fa {
color: #fff;
}
ul li:hover:nth-child(1) a {
background-color: #3b5999;
}
ul li:hover:nth-child(1) a::before {
background-color: #2f477a;
}
ul li:hover:nth-child(1) a::after {
background-color: #4e69a3;
}
ul li:hover:nth-child(2) a {
background-color: #55acee;
}
ul li:hover:nth-child(2) a::before {
background-color: #4489be;
}
ul li:hover:nth-child(2) a::after {
background-color: #66b4ef;
}
ul li:hover:nth-child(3) a {
background-color: #dd4b39;
}
ul li:hover:nth-child(3) a::before {
background-color: #b03c2d;
}
ul li:hover:nth-child(3) a::after {
background-color: #e05d4c;
}
ul li:hover:nth-child(4) a {
background-color: #0077b5;
}
ul li:hover:nth-child(4) a::before {
background-color: #005f90;
}
ul li:hover:nth-child(4) a::after {
background-color: #1984bc;
}
ul li:hover:nth-child(5) a {
background-color: #e4405f;
}
ul li:hover:nth-child(5) a::before {
background-color: #b6334c;
}
ul li:hover:nth-child(5) a::after {
background-color: #e6536f;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://kit.fontawesome.com/9e3f22ff10.js" crossorigin="anonymous"></script>
<ul>
<li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
<li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
</ul></code></pre>
</div>
</div>
</p>
<p>when i added a header or or the text is written on the left side of the icons and cannot be moved on top or center i have entered them in an html tag and body tag also didn't work</p>
| [
{
"answer_id": 74260721,
"author": "notrev",
"author_id": 3964564,
"author_profile": "https://Stackoverflow.com/users/3964564",
"pm_score": 1,
"selected": false,
"text": "geoip({ /* data here */ })"
},
{
"answer_id": 74260736,
"author": "Andrey Bessonov",
"author_id": 454... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17633315/"
] |
74,260,625 | <p>this has been giving me a lot of trouble</p>
<pre><code>URL: http://123.123.123.123
file: php
124.124.124.124|user1|email|phone
URL: http://1.2.3.4
file: php
2.1.3.1|userx|emailx|phonex
</code></pre>
<p>and the file contains more sets of data just like this one</p>
<p>i used</p>
<pre><code>grep http -A 3|tr '\n' ' '|tr '|' ' '|awk '{print $2,$7,$8}'|tr ' ' ':'
</code></pre>
<p>the outcome is only from the first set of data</p>
<pre><code>123.123.123.123:email:phone
</code></pre>
<p>intended outcome</p>
<pre><code>123.123.123.123:email:phone
1.2.3.4:emailx:phonex
</code></pre>
| [
{
"answer_id": 74260708,
"author": "tripleee",
"author_id": 874188,
"author_profile": "https://Stackoverflow.com/users/874188",
"pm_score": 2,
"selected": true,
"text": "grep"
},
{
"answer_id": 74260816,
"author": "M. Nejat Aydin",
"author_id": 13809001,
"author_profi... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377463/"
] |
74,260,629 | <p>I have a 100x100 matrix of rgamma realisations. I need to find the x = (mean(row)/var(row)) in order to find the SD(x). How do I loop through my matrix for this? Please kindly help, I am unsure of R syntax</p>
<pre><code>data = matrix(rgamma(100,4.623371,2.757291), nrow=100)
rowMeans(data)
</code></pre>
| [
{
"answer_id": 74260985,
"author": "RRDK",
"author_id": 8363345,
"author_profile": "https://Stackoverflow.com/users/8363345",
"pm_score": 1,
"selected": false,
"text": "sparseMatrixStats"
},
{
"answer_id": 74261044,
"author": "sindri_baldur",
"author_id": 4552295,
"au... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20375959/"
] |
74,260,649 | <p>I want know how can I pass id by variable is it possible or I have get every button id separately ?
Also I want to know how can implement onClick color changing one button at single time rest should have color prop of none.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const btn = document.getElementById('1');
btn.addEventListener('click', function hadleclick() {
btn.style.background = '#53E247';
})</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><form>
<div><button id="1">1</button></div>
<div><button id="2">2</button></div>
<div><button id="3">3</button></div>
<div><button id="4">4</button></div>
<div><button id="5">5</button></div>
<div><button id="6">6</button></div>
<div><button id="7">7</button></div>
<div><button id="8">8</button></div>
<div><button id="9">9</button></div>
<input type="submit" class="submit" value="Submit" onclick="subFunc()">
</form></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 74260985,
"author": "RRDK",
"author_id": 8363345,
"author_profile": "https://Stackoverflow.com/users/8363345",
"pm_score": 1,
"selected": false,
"text": "sparseMatrixStats"
},
{
"answer_id": 74261044,
"author": "sindri_baldur",
"author_id": 4552295,
"au... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11736274/"
] |
74,260,687 | <blockquote>
<p>Agora Streams disconnects during Live Stream</p>
</blockquote>
<ul>
<li><p>I am using agora for live stream in my mobile app.</p>
</li>
<li><p>I am publishing the stream from web panel.</p>
</li>
<li><p>Sometimes streams work perfectly without any issue but sometimes it show me the below log messages.</p>
<pre><code>12:51:54:277 Agora-SDK [DEBUG]: [track-cam-45e38b11] current video dimensions: 640 480
AgoraRTC_N-4.14.2.js:13 12:52:30:604 Agora-SDK [INFO]: [p2pId: 2]:
P2PConnection.onICEConnectionStateChange(disconnected)
AgoraRTC_N-4.14.2.js:13 12:52:30:604 Agora-SDK [INFO]: [p2pId: 2]:
P2PConnection.onICETransportStateChange(disconnected)
AgoraRTC_N-4.14.2.js:13 12:52:30:604 Agora-SDK [INFO]: [p2pId: 2]:
P2PConnection.onConnectionStateChange(disconnected)
AgoraRTC_N-4.14.2.js:13 12:52:31:855 Agora-SDK [INFO]: [p2pId: 2]:
P2PConnection.onICEConnectionStateChange(connected)
</code></pre>
</li>
<li><p>After the above log messages On audience devices it struck and never start again.</p>
</li>
<li><p>I am very much confused about this, Your small help would be really appropriated.</p>
</li>
</ul>
| [
{
"answer_id": 74260985,
"author": "RRDK",
"author_id": 8363345,
"author_profile": "https://Stackoverflow.com/users/8363345",
"pm_score": 1,
"selected": false,
"text": "sparseMatrixStats"
},
{
"answer_id": 74261044,
"author": "sindri_baldur",
"author_id": 4552295,
"au... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13935335/"
] |
74,260,716 | <p>I have this component:</p>
<pre><code>const updateUrl = (url: string) => history.replaceState(null, '', url);
// TODO: Rename this one to account transactions ATT: @dmuneras
const AccountStatement: FC = () => {
const location = useLocation();
const navigate = useNavigate();
const { virtual_account_number: accountNumber, '*': transactionPath } =
useParams();
const [pagination, setPagination] = useState<PaginatorProps>();
const [goingToInvidualTransaction, setGoingToInvidualTransaction] =
useState<boolean>(false);
const SINGLE_TRANSACTION_PATH_PREFIX = 'transactions/';
// TODO: This one feels fragile, just respecting what I found, but, we could
// investigate if we can jsut rely on the normal routing. ATT. @dmuneras
const transactionId = transactionPath?.replace(
SINGLE_TRANSACTION_PATH_PREFIX,
''
);
const isFirst = useIsFirstRender();
useEffect(() => {
setGoingToInvidualTransaction(!!transactionId);
}, [isFirst]);
const {
state,
queryParams,
dispatch,
reset,
setCursorAfter,
setCursorBefore
} = useLocalState({
cursorAfter: transactionId,
includeCursor: !!transactionId
});
const {
filters,
queryParams: globalQueryParams,
setDateRange
} = useGlobalFilters();
useUpdateEffect(() => {
updateUrl(
`${location.pathname}?${prepareSearchParams(location.search, {
...queryParams,
...globalQueryParams
}).toString()}`
);
}, [transactionId, queryParams]);
useUpdateEffect(() => dispatch(reset()), [globalQueryParams]);
const account_number = accountNumber;
const requestParams = accountsStateToParams({
account_number,
...state,
...filters
});
const { data, isFetching, error, isSuccess } =
useFetchAccountStatementQuery(requestParams);
const virtualAccountTransactions = data && data.data ? data.data : [];
const nextPage = () => {
dispatch(setCursorAfter(data.meta.cursor_next));
};
const prevPage = () => {
dispatch(setCursorBefore(data.meta.cursor_prev));
};
const onRowClick = (_event: React.MouseEvent<HTMLElement>, rowData: any) => {
if (rowData.reference) {
if (rowData.id == transactionId) {
navigate('.');
} else {
const queryParams = prepareSearchParams('', {
reference: rowData.reference,
type: rowData.entry_type,
...globalQueryParams
});
navigate(
`${SINGLE_TRANSACTION_PATH_PREFIX}${rowData.id}?${queryParams}`
);
}
}
};
const checkIfDisabled = (rowData: TransactionData): boolean => {
return !rowData.reference;
};
useEffect(() => {
if (data?.meta) {
setPagination({
showPrev: data.meta.has_previous_page,
showNext: data.meta.has_next_page
});
}
}, [data?.meta]);
const showTransactionsTable: boolean =
Array.isArray(virtualAccountTransactions) && isSuccess && data?.data;
const onTransactionSourceLoaded = (
transactionSourceData: PayoutDetailData
) => {
const isIncludedInPage: boolean = virtualAccountTransactions.some(
(transaction: TransactionData) => {
if (transactionId) {
return transaction.id === parseInt(transactionId, 10);
}
return false;
}
);
if (!goingToInvidualTransaction || isIncludedInPage) {
return;
}
const fromDate = dayjs(transactionSourceData.timestamp);
const toDate = fromDate.clone().add(30, 'day');
setDateRange({
type: 'custom',
to: toDate.format(dateFormat),
from: fromDate.format(dateFormat)
});
setGoingToInvidualTransaction(false);
};
const fromDate = requestParams.created_after || dayjs().format('YYYY-MM-DD');
const toDate = requestParams.created_before || dayjs().format('YYYY-MM-DD');
const routes = [
{
index: true,
element: (
<BalanceWidget
virtualAccountNumber={account_number}
fromDate={fromDate}
toDate={toDate}
/>
)
},
{
path: `${SINGLE_TRANSACTION_PATH_PREFIX}:transaction_id`,
element: (
<TransactionDetails
onTransactionSourceLoaded={onTransactionSourceLoaded}
/>
)
}
];
return (........
</code></pre>
<p>I get this error: <strong>Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.</strong></p>
<p>The useEffect where the issue is, it is this one:</p>
<pre><code> useEffect(() => {
if (data?.meta) {
setPagination({
showPrev: data.meta.has_previous_page,
showNext: data.meta.has_next_page
});
}
}, [data?.meta]);
</code></pre>
<p>Considering previous answers, would the solution be to make sure I return a new object each time? But I am not sure what would be the best approach. Any clues ?</p>
| [
{
"answer_id": 74260985,
"author": "RRDK",
"author_id": 8363345,
"author_profile": "https://Stackoverflow.com/users/8363345",
"pm_score": 1,
"selected": false,
"text": "sparseMatrixStats"
},
{
"answer_id": 74261044,
"author": "sindri_baldur",
"author_id": 4552295,
"au... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19625670/"
] |
74,260,735 | <p>I want to develop a category division like attached picture.</p>
<p>loop all product's category name and category thumbnail (woocommerce), just like post loop.</p>
<p>Anyone can help me ??<a href="https://i.stack.imgur.com/hIc3b.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hIc3b.jpg" alt="enter image description here" /></a></p>
<p>`</p>
<pre><code> <?php
$args = array(
// 'posts_per_page' => -1,
'taxonomy' => 'product_cat',
'orderby' => 'name',
// 'show_count' => 0,
// 'pad_counts' => 0,
// 'hierarchical' => 1,
// 'title_li' => '',
// 'hide_empty' => 0,
);
$loop = new WP_Query( $args );
while ( $loop->has_category( $category = '', $post = null ) ) : $loop->the_post();
global $product; ?>
<!-- !.p-item -->
<li class="p-item">
<a href="<?php get_category_link($loop->post->ID); ?>">
<?php if ( has_post_thumbnail( $loop->post->ID ) ) {
echo get_the_post_thumbnail($loop->post->ID, 'ihossain');
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/img/icon_category_image_1.svg" alt="<?php the_title(); ?>" />
<?php } ?>
<h6 class="icon-title"><?php $categoo = $product->get_categories(); echo $categoo; ?></h6>
</a>
</li>
<!-- !!.p-item -->
<?php endwhile; ?>
</code></pre>
<p>`</p>
| [
{
"answer_id": 74260985,
"author": "RRDK",
"author_id": 8363345,
"author_profile": "https://Stackoverflow.com/users/8363345",
"pm_score": 1,
"selected": false,
"text": "sparseMatrixStats"
},
{
"answer_id": 74261044,
"author": "sindri_baldur",
"author_id": 4552295,
"au... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20366087/"
] |
74,260,772 | <p>I'm trying to refresh a webpage using F5 key. I know I can use:</p>
<pre><code>self.page.reload()
</code></pre>
<p>But this is not a good solution for my problem. How to make the page to be refreshed using the <code>F5</code> key? My code doesn't refresh the page and I don't know why.</p>
<pre><code>self.page.keyboard.press('F5')
</code></pre>
| [
{
"answer_id": 74260985,
"author": "RRDK",
"author_id": 8363345,
"author_profile": "https://Stackoverflow.com/users/8363345",
"pm_score": 1,
"selected": false,
"text": "sparseMatrixStats"
},
{
"answer_id": 74261044,
"author": "sindri_baldur",
"author_id": 4552295,
"au... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5359846/"
] |
74,260,776 | <p>I am trying to Position an Image horizontally in a way that it would cover/overlap on the left side of a container , but can't seem to figure out the right way to do it</p>
<p><strong>Here is what I am trying to achieve:</strong></p>
<p><a href="https://i.stack.imgur.com/KJI7h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KJI7h.png" alt="enter image description here" /></a></p>
<p>Image is covering the Left edge of the Container.</p>
<p><strong>This is what I got:</strong></p>
<p><a href="https://i.stack.imgur.com/Lze83.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lze83.png" alt="enter image description here" /></a></p>
<p>There is a gap between the image and container</p>
<p><strong>Here is my code :</strong></p>
<pre><code> Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Image(
image: AssetImage("assets/images/btc.png"),
height: 47,
width: 43,
fit: BoxFit.contain,
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.height * 0.045,
decoration: BoxDecoration(
color: Color(0xff2e325c),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(6.0),
),
child: Text(
"1 Token",
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xffffffff),
),
),
),
],
),
</code></pre>
<p><strong>UPDATE:</strong></p>
<p>This is what it looks like when I add it into the stack
Positioning is a little bit off how can I align it with the container like above image</p>
<p><a href="https://i.stack.imgur.com/GAj1N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GAj1N.png" alt="enter image description here" /></a></p>
| [
{
"answer_id": 74260876,
"author": "Taber Zameer Qsols",
"author_id": 19983889,
"author_profile": "https://Stackoverflow.com/users/19983889",
"pm_score": 1,
"selected": false,
"text": "Stack(\n children: [\n Container(\n alignment: Alignment.center,\n margin: EdgeIn... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17525248/"
] |
74,260,809 | <p>How to make the model so that each order that a costumer submit is gonna be auto incremented (ie. order_number) without messing with the order obj primary_key?</p>
<h3>Models.py</h3>
<pre class="lang-py prettyprint-override"><code>class Customer(models.Model):
customer_name = models.CharField(max_length=100)
customerID = models.CharField(max_length=100)
class Order(models.Model):
customer = models.ForeignKey(Customer, related_name='order', on_delete=models.CASCADE)
order_name = models.CharField(max_length=100)
order_number = models.IntegerField(default=0)
</code></pre>
<h3>Serializers.py</h3>
<pre><code>from rest_framework import serializers
from .models import *
class OrderSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = '__all__'
class CustomerSerializer(serializers.ModelSerializer):
orders = OrderSerializer(many=True, read_only=True, required=False)
class Meta:
model = Customer
fields = '__all__'
</code></pre>
<h3>views.py</h3>
<pre><code>from rest_framework import generics, status
from rest_framework.views import APIView
from rest_framework.response import Response
from django.shortcuts import get_object_or_404
from .models import *
from .serializers import *
class CustomerListView(generics.ListCreateAPIView):
queryset = Customer.objects.all()
serializer_class = CustomerSerializer
class CustomerDetailView(generics.RetrieveDestroyAPIView):
queryset = Customer.objects.all()
serializer_class = CustomerSerializer
class OrderListView(generics.ListCreateAPIView):
def get_queryset(self):
queryset = Order.objects.filter(customer_id=self.kwargs["pk"])
return queryset
serializer_class = OrderSerializer
class OrderDetailView(generics.RetrieveDestroyAPIView):
serializer_class = OrderSerializer
def get_queryset(self):
queryset = Order.objects.filter(id=self.kwargs["pk"])
return queryset
</code></pre>
<h3>urls.py</h3>
<pre><code>from django.urls import path
from .views import *
urlpatterns = [
path('', CustomerListView.as_view(), name=''),
path('<int:pk>/', CustomerDetailView.as_view(), name=''),
path('<int:pk>/orders/', OrderListView.as_view(), name=''),
path('<int:customer_pk>/orders/<int:pk>/', OrderDetailView.as_view(), name=''),
]
</code></pre>
<h3>JSON Example</h3>
<pre class="lang-json prettyprint-override"><code>[
{
"id": 1,
"order": [
{
"id": 1,
"order_name": "fruit",
"order_number": 1,
"customer": 1
},
{
"id": 2,
"order_name": "chair",
"order_number": 2,
"customer": 1
},
{
"id": 3,
"order_name": "pc",
"order_number": 3,
"customer": 1
}
],
"customer_name": "john doe",
"customerID": "81498"
},
{
"id": 2,
"order": [
{
"id": 4,
"order_name": "phone",
"order_number": 1,
"customer": 2
},
{
"id": 5,
"order_name": "car",
"order_number": 2,
"customer": 2
}
],
"customer_name": "jane doe",
"customerID": "81499"
}
]
</code></pre>
<p>If i need to submit more file such as seriallizers.py etc please let me know. Thank you in advance.</p>
<h3>Edit</h3>
<p>Adding a few more files.</p>
<h3>Solution</h3>
<p>The answer from ilyasbu is working but i need to change this line
<code>last_id = self.objects.all().aggregate(largest=models.Max('display_id'))['largest']</code> into
<code>last_id = Order.objects.filter(customer=self.customer).aggregate(largest=models.Max('display_id'))['largest']</code></p>
| [
{
"answer_id": 74260894,
"author": "ilyasbbu",
"author_id": 16475089,
"author_profile": "https://Stackoverflow.com/users/16475089",
"pm_score": 3,
"selected": true,
"text": "IntegerField"
},
{
"answer_id": 74260904,
"author": "AshSmith88",
"author_id": 20281564,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19859438/"
] |
74,260,814 | <p>i created my react app by <strong>create-react-app</strong> and i'm trying to show a pdf file with react-pdf package. i installed react pdf using <strong>npm install react-pdf</strong> and used it in code as below:</p>
<pre><code>import { Document, Page, pdfjs } from "react-pdf";
import { useState } from "react";
import React from "react";
function PDFLayout(props){
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
const [numPages, setNumPages] = useState(null);
const [pageNumber, setPageNumber] = useState(1);
function onDocumentLoadSuccess({ numPages }) {
setNumPages(numPages);
}
return (
<div>
// the file address is temporary and just for test
<Document file="https://www.orimi.com/pdf-test.pdf" onLoadSuccess={onDocumentLoadSuccess}>
<Page pageNumber={pageNumber} />
</Document>
<p>
Page {pageNumber} of {numPages}
</p>
</div>
);
}
export default PDFLayout;
</code></pre>
<p>and when i route to this react file i get this error:</p>
<blockquote>
<p>Failed to load pdf file</p>
</blockquote>
<p>i checked other Question in SO and GH like :</p>
<ul>
<li><a href="https://stackoverflow.com/questions/72465876/reactjs-react-pdf-error-failed-to-load-pdf-file-on-some-attempts">ReactJS react-pdf error "Failed to load PDF file." on some attempts</a></li>
<li><a href="https://stackoverflow.com/questions/48589169/error-in-displaying-pdf-in-react-pdf">error in displaying pdf in react-pdf</a></li>
<li><a href="https://github.com/wojtekmaj/react-pdf/issues/321" rel="nofollow noreferrer">https://github.com/wojtekmaj/react-pdf/issues/321</a></li>
</ul>
<p>but the answers didn't work for me. so I'm really appreciative of all the help you will give to me.</p>
| [
{
"answer_id": 74261390,
"author": "Animesh Mondal",
"author_id": 14581890,
"author_profile": "https://Stackoverflow.com/users/14581890",
"pm_score": 1,
"selected": false,
"text": "<div class=\"embed-responsive\" style={{ height: \"100vh\" }}>\n <embed\n src=\"https://www... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15529691/"
] |
74,260,820 | <p>How can I adjust the space between images when using <code><figure></code>? I want to reduce the space, but for some reason I just can't get it it to budge.</p>
<p>I want 3 images to sit on one row, but because I can't reduce the space between images to allow them to fit comfortably in the div box, the 3rd is wrapping and sitting below the first two</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.container3 {
width: 1000px;
height: 600px;
box-sizing: border-box;
}
.container3 figure {
display: inline-block;
box-sizing: border-box;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="container3">
<figure>
<img class="image" height="200px" width="300px" src="/images/img-berryblitz.jpg" alt="berry blitz">
<figcaption>
Fall Berry Blitz Tea
</figcaption>
</figure>
<figure>
<img class="image" height="200px" width="300px" src="/images/img-spiced-rum.jpg" alt="spiced rum">
<figcaption>
Spiced Rum Tea
</figcaption>
</figure>
<figure>
<img class="image" height="200px" width="300px" src="/images/img-donut.jpg" alt="donut">
<figcaption>
Seasonal Donuts
</figcaption>
</figure>
</div></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 74260969,
"author": "Kathara",
"author_id": 5621032,
"author_profile": "https://Stackoverflow.com/users/5621032",
"pm_score": 0,
"selected": false,
"text": "display: flex;"
},
{
"answer_id": 74260974,
"author": "F. Müller",
"author_id": 1294283,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20356808/"
] |
74,260,844 | <p>I'm trying to access parent node of an element in a tree using <code>e.find('..)'</code> but it is not working. For the fallowing code:</p>
<pre><code>import xml.etree.ElementTree as etree
xml = "<a> <b> </b> </a>"
root = etree.fromstring(xml)
child = root.find('*')
print(child.find('..'))
</code></pre>
<p>the output is: <code>None</code>, why? and, how can i get parent element (in this case node <\a>)?</p>
<p>I have tried different combination for path and searched the internet, some solution doesn't works and some are specific to the question.</p>
| [
{
"answer_id": 74261000,
"author": "Faisal Nazik",
"author_id": 13959139,
"author_profile": "https://Stackoverflow.com/users/13959139",
"pm_score": 0,
"selected": false,
"text": "None"
},
{
"answer_id": 74266983,
"author": "mzjn",
"author_id": 407651,
"author_profile"... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377484/"
] |
74,260,847 | <p>I have been trying to post request usisng http package in flutter. There are 4 fields I am trying to send post request. Here is my controller code:</p>
<pre><code>
Future<bool> createDisplay(
String name, String category, String templateName, int productId) async {
var url = Uri.parse(
"https://digital-display.betafore.com/api/v1/digital-display/displays/");
var token = localStorage.getItem('access');
try {
// var formdata = new Map<String, dynamic>();
// formdata["name"] = name;
// formdata["category"] = category;
// formdata["template_name"] = templateName;
// formdata["products"] = 1;
var formdata = {
"name": name,
"category": category,
"template_name": templateName,
"products[0]": productId,
};
http.Response response =
await http.post(url, body: json.encode(formdata), headers: {
"Content-Type": "application/json",
'Authorization':
'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjY3MjMzNjEzLCJpYXQiOjE2NjcxNDcyMTMsImp0aSI6IjgyNDg0YWYzMDdmOTQ0YjNhMTQ5ZWIzN2NkNjIzNGI4IiwiaWQiOjV9.qc9fmF4B0V6NTwxsztBb6AkF78kU_06wommCa5gLgOo'
});
Future.error(response.body);
var data = json.encode(response.body) as FormData;
if (response.statusCode == 200) {
print(response.body);
return Future.error("Its working");
} else {
return Future.error("Code Proble");
}
} catch (exception) {
Future.error("Something is wrong with the codes");
return false;
}
}
</code></pre>
<p>Here is the form and code where I try to pass the value.
Here is the var types. As you can see I took _product as Integer but still I am getting string.</p>
<pre><code>
`String _name = "";`
`String _category = "";`
`String _templateName = "";`
`late final int _product;`
</code></pre>
<pre><code>final _form = GlobalKey<FormState>();
void _addDisplay() async {
var isValid = _form.currentState!.validate();
if (!isValid) {
return;
}
_form.currentState!.save();
bool create = await Provider.of<DisplayController>(context, listen: false)
.createDisplay(_name, _category, _templateName, _product);
if (create) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text("Created"),
actions: [
ElevatedButton(
child: const Text("Return"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
} else {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text("Failed to create display!"),
actions: [
ElevatedButton(
child: const Text("Return"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
}
}
</code></pre>
<pre><code>
Here is front end code:
Flexible(
child: Padding(
padding: EdgeInsets.all(10),
child: TextFormField(
keyboardType: TextInputType.number,
validator: (v) {
if (v!.isEmpty) {
return "Please enter valid product Id";
} else {
return null;
}
},
onSaved: (value) {
_product = value as int;
},
autofocus: true,
style: const TextStyle(
fontSize: 15.0, color: Colors.black),
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Product Id',
filled: true,
fillColor: Colors.white,
contentPadding: const EdgeInsets.only(
left: 14.0, bottom: 6.0, top: 8.0),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Color.fromARGB(255, 73, 57, 55)),
borderRadius: BorderRadius.circular(0.0),
),
enabledBorder: UnderlineInputBorder(
borderSide:
const BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(0.0),
),
),
),
),
),
],
So, Here I try to pass the int value and I also took int type. But still I am getting this error I mentioned above.
I tried to pass name, tamplatename and category as string but I tool int type of productId as I attached my code there you can see I tool int type productId. Then in the create display page I also took late final int \_product. In the onSaved function I tried this:
</code></pre>
<p>onSaved: (value) {_product = value as int;} still getting error is there a way to solve this issue?</p>
<pre><code></code></pre>
| [
{
"answer_id": 74261000,
"author": "Faisal Nazik",
"author_id": 13959139,
"author_profile": "https://Stackoverflow.com/users/13959139",
"pm_score": 0,
"selected": false,
"text": "None"
},
{
"answer_id": 74266983,
"author": "mzjn",
"author_id": 407651,
"author_profile"... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19890273/"
] |
74,260,889 | <p>I have a question that confused me for a long time. As you know, when we use an if condition in Modelica, that means if the expression is true, then Modelica will do the corresponding equation.
But when i test the following code, I am confused:</p>
<pre><code>model Model134
Real a(start = 0);
equation
if not sample(0, 2) then
a = 1;
else
a = 3;
end if;
end Model134;
</code></pre>
<p>I think <code>a</code> will be changed every 2s (start time=0), but when I simulate this model, it dose not change and <code>a</code> is equal to 1 all the time.</p>
<p>Dose anybody know the root cause?</p>
| [
{
"answer_id": 74262336,
"author": "marco",
"author_id": 8725275,
"author_profile": "https://Stackoverflow.com/users/8725275",
"pm_score": 2,
"selected": false,
"text": "a"
},
{
"answer_id": 74262999,
"author": "Akhil Nandan",
"author_id": 16020568,
"author_profile": ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17739020/"
] |
74,260,900 | <p>I have a component library, one of its functionalyty is to pass large file from JS to c# code. I split the file into chunks, but I need to know what chunk size should be used.</p>
<p>Default message size is 32 kb, but user can change it in theirs app:</p>
<pre><code>services.AddSignalR(o => {
o.MaximumReceiveMessageSize = long.MaxValue;
});
</code></pre>
<p>How can I determine the message size in my library code?</p>
| [
{
"answer_id": 74261770,
"author": "Brian Parker",
"author_id": 1492496,
"author_profile": "https://Stackoverflow.com/users/1492496",
"pm_score": 2,
"selected": false,
"text": "IOptions<HubOptions> options"
},
{
"answer_id": 74428473,
"author": "Eugene Maksimov",
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834019/"
] |
74,260,926 | <p>I created build yesterday and it was working fine . but when I try to create the release build today I got this. some if the question that are already asked here</p>
<ul>
<li><a href="https://stackoverflow.com/q/66651640/9570734">Question No 1:</a></li>
<li><a href="https://stackoverflow.com/q/66400264/9570734">Question No 2:</a></li>
</ul>
<p>These question are specfic to android and new user of react-native can't understand them easily. so thats why i nam asking another question here specific for react-native users.</p>
<p>The question i mentioned above has answer which help in some specific cases but when it comes to react native in some cases it does nit help, like for some of the dependincies in node_modules.</p>
<p>The Above explination is added beacuse the question was marked as duplicate.</p>
<p>The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33</p>
<pre><code>FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':react-native-community_masked-view:verifyReleaseResources'.
> Could not resolve all task dependencies for configuration ':react-native-community_masked-view:releaseRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-community_masked-view
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Read timed out
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 45s
5 actionable tasks: 5 up-to-date
</code></pre>
<p>I think the issue is due to jcenter deprecation . any possible solution or alternative of jcenter. this is specific for react-native projects where there are many dependencies and you have to change.</p>
| [
{
"answer_id": 74261013,
"author": "Engr.Aftab Ufaq",
"author_id": 9570734,
"author_profile": "https://Stackoverflow.com/users/9570734",
"pm_score": 5,
"selected": true,
"text": "Bintray/JCenter users should start migrating to a new hosting solution."
},
{
"answer_id": 74265617,
... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9570734/"
] |
74,260,929 | <p>I'm relatively new to regex, so bear with me if the question is trivial. I'd like to place a comma between every letter of a string using regex, e.g.:</p>
<pre><code>x <- "ABCD"
</code></pre>
<p>I want to get</p>
<pre><code>"A,B,C,D"
</code></pre>
<p>It would be nice if I could do that using <code>gsub</code>, <code>sub</code> or related on a vector of strings of arbitrary number of characters.</p>
<p>I tried</p>
<pre><code>> sub("(\\w)", "\\1,", x)
[1] "A,BCD"
> gsub("(\\w)", "\\1,", x)
[1] "A,B,C,D,"
> gsub("(\\w)(\\w{1})$", "\\1,\\2", x)
[1] "ABC,D"
</code></pre>
| [
{
"answer_id": 74260955,
"author": "Wiktor Stribiżew",
"author_id": 3832970,
"author_profile": "https://Stackoverflow.com/users/3832970",
"pm_score": 3,
"selected": true,
"text": "> gsub(\"(.)(?=.)\", \"\\\\1,\", x, perl=TRUE)\n[1] \"A,B,C,D\"\n"
},
{
"answer_id": 74260980,
"... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74260929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1586820/"
] |
74,261,014 | <p>C# .net windows form framework.
I was trying to combine two 1-D arrays into one 1-D arrays, that combines element from first and second into one new element pair in third array (like "a" and "b" into "a + b"), that have the length of one with lower element count. I getting error about exceptions but from my understanding it should work.</p>
<pre><code>public partial class Form1 : Form
{
string[] chlopcy = new string[] { "Tomek", "Michał", "Grzegorz", "Damian", "Daniel", "Kamil", "Paweł", "Krzysiu", "Wojtek", "Kuba" };
string[] dziewczyny = new string[] { "Iwona", "Marta", "Ania", "Martyna", "Agnieszka", "Zofia", "Angelika", "Asia", "Joanna", "Ola" };
string[] pary;
private void button4_Click(object sender, EventArgs e)
{
listBox3.Items.Clear();
for (int y = 0; y <= (listBox1.Items.Count - 1); y++)
{
for (int z = 0; z <= (listBox2.Items.Count - 1); z++)
{
if (z == y)
{
string[] pary = new string[z] ;
pary[z] = listBox1.Items[y] + " i " + listBox2.Items[z];
listBox3.Items.Add(pary[z]);
}
if (z > y)
{
string[] pary = new string[y];
pary[y] = listBox1.Items[y] + " i " + listBox2.Items[y];
listBox3.Items.Add(pary[z]);
}
if (z < y)
{
string[] pary = new string[z];
pary[y] = listBox1.Items[z] + " i " + listBox2.Items[z];
listBox3.Items.Add(pary[z]);
}
}
}
}
</code></pre>
| [
{
"answer_id": 74261664,
"author": "Kroepniek",
"author_id": 19699903,
"author_profile": "https://Stackoverflow.com/users/19699903",
"pm_score": 1,
"selected": false,
"text": "public partial class Form1 : Form\n{\n string[] chlopcy = new string[] { \"Tomek\", \"Michał\", \"Grzegorz\",... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377496/"
] |
74,261,026 | <p>Given a string input like this: <code>Key=Value;key1=value1;key2=value2;key3=value3;</code> and using the <code>;</code> as a separator, and also we can use <code>\;</code> in the value to be <code>;</code> in the runtime.</p>
<p>The problem comes when a user put an input like this <code>Key=Value\;key1=value1\;key2=value2\;key3=value3;</code> when I extract the value it gives us a map like this 1 key (Key) and the value (Value;key1=value1;key2=value2;key3=value3;)</p>
<p>Expecting a map of keys and values. 4 keys (Key,Key1,Key2,Key3) and 4 values (Value,Value1,Value2,Value3)</p>
<p>Constraints:</p>
<ol>
<li>The value can be any string.</li>
<li>The value can contain another key. Ex. key=value;key1=value=123; so we have 2 keys and value of the second may includes the first key.</li>
<li>The key can be any string.</li>
<li>can be any number of keys and value.</li>
<li>The value can be empty.</li>
<li>we have a list of the keys, but the user might not add all of them.</li>
</ol>
<p>Tried more than regex, but still not completely getting it right. This is the regex currently using:</p>
<p><code> ([\\n\\s]*(.+?)=(.*?;?);[\\n\\s]*)</code></p>
<p>But can you help with the regex or introduce a new algorithm</p>
| [
{
"answer_id": 74261664,
"author": "Kroepniek",
"author_id": 19699903,
"author_profile": "https://Stackoverflow.com/users/19699903",
"pm_score": 1,
"selected": false,
"text": "public partial class Form1 : Form\n{\n string[] chlopcy = new string[] { \"Tomek\", \"Michał\", \"Grzegorz\",... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377712/"
] |
74,261,037 | <p><code>println</code> always prints 3 s regardless of whether I change the values of <code>delay</code> in the two doXX functions.
Both doXX functions take only 2 seconds, why is the result always 3</p>
<p>I think all three coroutines run concurrently, so I increased the delay in the last coroutine to wait for the first two to finish. Then I print the value of the variable <code>time</code>.
Here is the code.</p>
<pre><code>
fun main() = runBlocking<Unit> {
val time = measureTimeMillis {
launch { doSomethingUsefulOne() }
launch { doSomethingUsefulTwo() }
}
launch {
delay(6000)
println("Completed in $time ms")
}
}
suspend fun doSomethingUsefulOne() {
delay(1000L)
}
suspend fun doSomethingUsefulTwo(){
delay(1000L)
}
</code></pre>
<p>If I put them in a child scope of the runBlocking scope, the result is always correct. That is about 2 second.</p>
<pre><code> fun main() = runBlocking<Unit> {
val time = measureTimeMillis {
doWorld
}
launch {
delay(4000)
println("Completed in $time ms")
}
}
suspend fun doWorld() = coroutineScope { // this: CoroutineScope
launch {
delay(2000L)
println("World 2")
}
launch {
delay(1000L)
println("World 1")
}
println("Hello")
}
</code></pre>
| [
{
"answer_id": 74261119,
"author": "Augusto",
"author_id": 608820,
"author_profile": "https://Stackoverflow.com/users/608820",
"pm_score": 2,
"selected": false,
"text": "launch"
},
{
"answer_id": 74263366,
"author": "Garuno",
"author_id": 5625089,
"author_profile": "h... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16467709/"
] |
74,261,154 | <p>Error getting while creating release build in react native</p>
<pre><code>FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':react-native-community_clipboard:verifyReleaseResources'.
> Could not resolve all task dependencies for configuration ':react-native-community_clipboard:releaseRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-community_clipboard
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Read timed out
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
</code></pre>
<p>Error found during release build in react native</p>
| [
{
"answer_id": 74261228,
"author": "Mochamad Taufik Hidayat",
"author_id": 4168314,
"author_profile": "https://Stackoverflow.com/users/4168314",
"pm_score": 1,
"selected": false,
"text": "jCenter()"
},
{
"answer_id": 74261346,
"author": "steformicola",
"author_id": 931012... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10330434/"
] |
74,261,177 | <p>I have a horizontal ScrollView, all items have different widths</p>
<p>Is there a way to scroll one by one, so it would stop in the center of each item?</p>
<p>If the first answer to question is yes, then is there a way to know the index of item (that is centered), so I can change the index of selected dot?</p>
<p><a href="https://snack.expo.dev/@drujik/horizontal-scroll-diff-widths" rel="nofollow noreferrer">https://snack.expo.dev/@drujik/horizontal-scroll-diff-widths</a></p>
<p><a href="https://i.stack.imgur.com/rDU02.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rDU02.png" alt="enter image description here" /></a></p>
| [
{
"answer_id": 74261228,
"author": "Mochamad Taufik Hidayat",
"author_id": 4168314,
"author_profile": "https://Stackoverflow.com/users/4168314",
"pm_score": 1,
"selected": false,
"text": "jCenter()"
},
{
"answer_id": 74261346,
"author": "steformicola",
"author_id": 931012... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6750655/"
] |
74,261,188 | <p>I have an SFTP trigger in a logic app which fires when a file is added to a certain file area. It is a CSV-formatted file and I want the rows to be parsed and coverted into json. Which is the best way to convert CSV-data into json without using any custom connectors?</p>
<p>I cannot find any built-in connectors doing this job. And as far as I know there are no logic apps functions doing the job either.</p>
| [
{
"answer_id": 74289369,
"author": "vijaya",
"author_id": 20336887,
"author_profile": "https://Stackoverflow.com/users/20336887",
"pm_score": 0,
"selected": false,
"text": "split(body('Get_blob_content_(V2)'),decodeUriComponent('%0D%0A'))\n"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12814645/"
] |
74,261,193 | <p>In Nuxt 3, how to remove trailing slash from urls?</p>
<p>In Nuxt 2, it was done by adding these lines to <code>nuxt.config.js</code>:</p>
<pre><code>router: {
trailingSlash: false
}
</code></pre>
<p>What is the equivalent in Nuxt 3?</p>
| [
{
"answer_id": 74289369,
"author": "vijaya",
"author_id": 20336887,
"author_profile": "https://Stackoverflow.com/users/20336887",
"pm_score": 0,
"selected": false,
"text": "split(body('Get_blob_content_(V2)'),decodeUriComponent('%0D%0A'))\n"
}
] | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3010671/"
] |
74,261,200 | <p>I'm currently working on an angular project and I need some help with this problem...</p>
<p>I displayed the data from an array and next I need to save the value from the element I click so I can display it on another component and play with this value with an API link</p>
<p>This is the code from the component where I display data</p>
<pre><code><div class="popup-content">
<ul class="list-group">
<li mat-dialog-close
routerLink='/admin'
*ngFor="let t of data"
class="list-group-item">
{{t}}
</li>
</ul>
</div>
</code></pre>
<p>How can I save the value of 't' on click so I can use it on another component</p>
<p>The data array is created like this</p>
<pre><code>this.service.getPosts()
.subscribe(response => {
this.posts = response;
this.num = this.posts.body.paginationinfo.numberofelementsTotal;
for(this.i=0;this.i<this.num;this.i++)
{
this.test.push(this.posts.body.listOfUnapprovedChangeRequests[this.i].requestuuid);
}
});
console.log(this.test);
}
openDialog(){
this.dialogRef.open(MenupopupComponent,{data:this.test})
}
</code></pre>
| [
{
"answer_id": 74261295,
"author": "Octavian Mărculescu",
"author_id": 1440005,
"author_profile": "https://Stackoverflow.com/users/1440005",
"pm_score": 3,
"selected": true,
"text": "<ul class=\"list-group\">\n <li\n mat-dialog-close\n routerLink=\"/admin\"\n [queryParams]=\"{ ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19938599/"
] |
74,261,238 | <p>My background is javascript and php. So yesterday I went for an entry level position interview that uses python. There's a test for the interview. The test is an open-book test, so I tried looking on the net and tried to understand every method use out there and the closest method that may solve the problem is by using sent_tokenize method. However, I keep on failing to get the expected output. I think that the sent_tokenize method is not the correct method to solve this. Is it possible to solve the question below by using split method?</p>
<pre><code>Test case 1:
Input: Excuse me, where can I find a chicken rice shop?
Expected output: ["Excuse me", "where can I find a chicken rice shop"]
Test case 2:
Input: OMG!!! It is Friday....where should we go for dinner?
Expected output: ["OMG", "It is Friday", "where should we go for dinner"]
Test case 3:
Input: He’s nervous, but on the surface he looks calm and ready.
Expected output: [“He’s nervous”, “but on the surface he looks calm and ready”]
from nltk.tokenize import sent_tokenize
def tokenise(input, expected_output):
input = "Excuse me, where can I find a chicken rice shop?"
expected_output = ['Excuse me', 'where can I find a chicken rice shop']
result = sent_tokenize(input)
print('Pass' if result == expected_output else 'Failed!')
# Please make sure all test cases return 'Pass'
tokenise(tcase1, tans1)
tokenise(tcase2, tans2)
tokenise(tcase3, tans3)
print('Pass' if result == expected_output else 'Failed!')
</code></pre>
| [
{
"answer_id": 74261330,
"author": "Mathieu CAROFF",
"author_id": 9878263,
"author_profile": "https://Stackoverflow.com/users/9878263",
"pm_score": 1,
"selected": false,
"text": "re.split"
},
{
"answer_id": 74261463,
"author": "Joshua",
"author_id": 17608766,
"author_... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20134724/"
] |
74,261,257 | <p>How to copy the values from column A to column B, if the column B has null values.</p>
<p>DATA:</p>
<pre><code> A B
12525 1FWE23
14654
24798
38945
46456 46485
AD545 45346
A5D66
</code></pre>
<p>EXPECTED :</p>
<pre><code> A B
12525 1FWE23
14654 14654
24798 24798
38945 38945
46456 46485
AD545 45346
A5D66 A5D66
</code></pre>
| [
{
"answer_id": 74261287,
"author": "Paul",
"author_id": 7194474,
"author_profile": "https://Stackoverflow.com/users/7194474",
"pm_score": 0,
"selected": false,
"text": "df.B.fillna(df.A, inplace=True)"
},
{
"answer_id": 74261302,
"author": "Emi OB",
"author_id": 14463396,... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19580067/"
] |
74,261,260 | <p>I am using JS to paginate a data set. I also have the possibility to filter my dataset through tags. I want to hide the pagination navigation when I only have one page of results either for all results or when I use the filter. Here is the JS code:</p>
<pre class="lang-js prettyprint-override"><code>var itemsNumber = 8,
$items,
pages = 1,
current = 1;
function makePages() {
$items = $(".filtered-div:visible");
pages = Math.ceil($items.length / itemsNumber);
$("#pages").empty();
for (var p = 1; p <= pages; p++) {
$("#pages").append($('<a href="#">' + p + "</a>"));
}
showPage(1);
}
function showPage(page) {
$items
.hide()
.slice((page - 1) * itemsNumber, page * itemsNumber)
.show();
current = page;
$("div.ctrl-nav a").show();
if (current == 1) {
$("div.ctrl-nav a:first").hide();
} else if (current == pages) {
$("div.ctrl-nav a:last").hide();
}
$("div.ctrl-nav a.active").removeClass("active");
$("#pages a")
.eq(current - 1)
.addClass("active");
}
makePages();
$("div.ctrl-nav").on("click", "a", function () {
var action = $(this).html();
if (action == '<i class="fas fa-angle-left" aria-hidden="true"></i>') {
current--;
} else if (
action == '<i class="fas fa-angle-right" aria-hidden="true"></i>'
) {
current++;
} else if (+action > 0) {
current = +action;
}
if (current <= 1) {
current = 1;
} else if (current >= pages) {
current = pages;
}
showPage(current);
});
var $myitems = $(".filtered-div");
$(".btn-container").on("click", ".btn", function () {
var value = $(this).data("filter");
if (value == "all") {
$myitems.show();
} else {
var $selected = $myitems
.filter(function () {
return $(this).data("tag").indexOf(value) != -1;
})
.show();
$myitems.not($selected).hide();
}
$(this).addClass("active").siblings().removeClass("active");
makePages();
});
</code></pre>
<p>You can find my code at this <a href="https://codepen.io/sofia-lazrak/pen/RwJNRBE" rel="nofollow noreferrer">codepen</a></p>
| [
{
"answer_id": 74261536,
"author": "Mai Truong",
"author_id": 14527588,
"author_profile": "https://Stackoverflow.com/users/14527588",
"pm_score": 0,
"selected": false,
"text": " var $myitems = $(\".filtered-div\");\n$(\".btn-container\").on(\"click\", \".btn\", function () {\n var value... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13099741/"
] |
74,261,281 | <p>I got this data</p>
<pre><code>employee_detail_list = {
'John Doe': {
'name': 'EMP-0001',
'first_name': 'John',
'last_name': 'Doe',
'full_name': 'John Doe',
'company': 'Company 1'
},
'Tom Smith': {
'name': 'EMP-0002',
'first_name': 'Tom',
'last_name': 'Smith',
'full_name': 'Tom Smith',
'company': 'Company 2'
},
'Andrew Sebastian': {
'name': 'EMP-0003',
'first_name': 'Andrew',
'last_name': 'Sebastian',
'full_name': 'Andrew Sebastian',
'company': 'Company 2'
}, }
</code></pre>
<p>i want output</p>
<pre><code>Tom Smith
Andrew Sebastian
</code></pre>
<p>by filtering value <em>"Company 2"</em>, i've try this code:</p>
<pre><code># list out keys and values separately
key_list = list(employee_detail_list.keys())
val_list = list(employee_detail_list.values())
# print key with val Company 2
position = val_list.index("Company 2")
print(key_list[position])
</code></pre>
<p>but always ended up with this error:</p>
<pre><code>ValueError: 'Company 2' is not in list
</code></pre>
<p>any thought what is wrong? thanks before</p>
| [
{
"answer_id": 74261536,
"author": "Mai Truong",
"author_id": 14527588,
"author_profile": "https://Stackoverflow.com/users/14527588",
"pm_score": 0,
"selected": false,
"text": " var $myitems = $(\".filtered-div\");\n$(\".btn-container\").on(\"click\", \".btn\", function () {\n var value... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7524568/"
] |
74,261,282 | <p>Actually, I'm trying to return a list from the 19th index, but this didn't work for me. This list is split into sub lists. I want to start splitting it from the 19th index not from 0.</p>
<p>This is my code:</p>
<pre><code>static Future<List> local() async {
File textAsset = File('/storage/emulated/0/RPSApp/assets/bluetooth.txt');
final text = await textAsset.readAsString();
final bytes =
text.split(',').map((s) => s.trim()).map((s) => int.parse(s)).toList();
int chunkSize = 19;
List<int> padTo(List<int> input, int count) {
return [...input, ...List.filled(count - input.length, 255)];
}
List<int> padToChunksize(List<int> input) => padTo(input, chunkSize);
List<List<int>> items;
items = bytes.slices(chunkSize).map(padToChunksize).toList();
for (int i = 19; i < bytes.length; i++) {
return items;
}
return items;
}
</code></pre>
<p>this code is for displaying sublists one by one:</p>
<pre><code> final chun = await Utils.local();
await Future.forEach(chun, (ch) async {
await Future.delayed(const Duration(seconds: 4));
await c.write(chun, withoutResponse: true);
await c.read();
await Future.wait(getValue());
}
})
</code></pre>
<p>I don't know what's wrong with this code and why it returns me the list from index 0.</p>
| [
{
"answer_id": 74261536,
"author": "Mai Truong",
"author_id": 14527588,
"author_profile": "https://Stackoverflow.com/users/14527588",
"pm_score": 0,
"selected": false,
"text": " var $myitems = $(\".filtered-div\");\n$(\".btn-container\").on(\"click\", \".btn\", function () {\n var value... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20285309/"
] |
74,261,286 | <p>I am using react routing in my project. Sample below -</p>
<pre><code><BrowserRouter>
<Routes>
<Route path="/" element={<Login />} />
<Route path="admin" element={<Admin />} />
<Route path="/admin/clients" element={<Clients/>} />
</Routes>
</BrowserRouter>
</code></pre>
<p>And in one of my components I am using -</p>
<pre><code><Link to="/admin/clients" key={icon.id}>
<div onClick={e => clickHandler(e, icon)} className='nav__tab'>
<div>{ icon.src }</div>
<span className='nav__name'>{icon.name}</span>
</div>
</Link>
</code></pre>
<p>Above code is redirecting me to the next page with the correct link (admin/clients) which is fine.</p>
<p>However, since it is redirecting me to the new link(admin/clients), I am not able to reuse my navigation buttons that I created.</p>
<p>Screenshots below -</p>
<p>This is my navigation component -</p>
<p><a href="https://i.stack.imgur.com/GT78Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GT78Z.png" alt="enter image description here" /></a></p>
<p>And when I click on Clients, it is redirecting me to the new page -</p>
<p><a href="https://i.stack.imgur.com/a7c41.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a7c41.png" alt="enter image description here" /></a></p>
<p>I want to be on the page(with navigation on the left just like in the screenshot) and the client component should be on the right hand side.</p>
<p>Hope I am clear.</p>
| [
{
"answer_id": 74261358,
"author": "Alauddin Ansari",
"author_id": 1108489,
"author_profile": "https://Stackoverflow.com/users/1108489",
"pm_score": 0,
"selected": false,
"text": "Admin"
},
{
"answer_id": 74265393,
"author": "Drew Reese",
"author_id": 8690857,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19290397/"
] |
74,261,291 | <p>How do I get a list of a given ERC20 token holders?</p>
<p>I use QuickNode + ethers.js or web3.js and I have SC address for the ERC20 token.</p>
<p>Is there a short way to get a list of token holders or do I have to look through transactions?</p>
<p>I've tried Covalent's endpoint for that, but they are not reliable --> 90% of requests are 504.
I need to use a provider that gives me access to multiple chains so polygonscan API doesn't work in my case.</p>
| [
{
"answer_id": 74261358,
"author": "Alauddin Ansari",
"author_id": 1108489,
"author_profile": "https://Stackoverflow.com/users/1108489",
"pm_score": 0,
"selected": false,
"text": "Admin"
},
{
"answer_id": 74265393,
"author": "Drew Reese",
"author_id": 8690857,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12746900/"
] |
74,261,301 | <p>I have a data frame df</p>
<pre><code>df =
Code Bikes Year
12 356 2020
4 378 2020
2 389 2020
35 378 2021
40 370 2021
32 350 2021
</code></pre>
<p>I would like to group the data frame based on Year using df.groupby('Year') and check the close values in column df['Çode'] to find values that are close by at least 3 and retain the row with a maximum value in the df['Bikes'] column out of them.</p>
<p>For instance, in the first group of 2020, values 4 and 2 are close by at least 3 since 4-2=2 ≤ 3 and since 389 (df['Bikes']) corresponding to df['Code'] = 2 is the highest among the two, retain that and drop row where df['code']=4.</p>
<p>The expected out for the given example:</p>
<pre><code>Code Bikes Year
12 356 2020
2 389 2020
35 378 2021
40 370 2021
</code></pre>
| [
{
"answer_id": 74261358,
"author": "Alauddin Ansari",
"author_id": 1108489,
"author_profile": "https://Stackoverflow.com/users/1108489",
"pm_score": 0,
"selected": false,
"text": "Admin"
},
{
"answer_id": 74265393,
"author": "Drew Reese",
"author_id": 8690857,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13021743/"
] |
74,261,304 | <p>How do I make RadioGroup fill the screen's width while being making the radiobuttons equidistant to each other?</p>
<pre><code> <RadioGroup
android:id="@+id/radio_group"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hi3" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hi2" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hi0"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hi"/>
</RadioGroup>
</code></pre>
| [
{
"answer_id": 74261358,
"author": "Alauddin Ansari",
"author_id": 1108489,
"author_profile": "https://Stackoverflow.com/users/1108489",
"pm_score": 0,
"selected": false,
"text": "Admin"
},
{
"answer_id": 74265393,
"author": "Drew Reese",
"author_id": 8690857,
"author... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19729496/"
] |
74,261,316 | <p>I am trying to build a new image in Docker Compose but the following problem occurs</p>
<pre><code>E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt-utils_2.4.7_amd64.deb 404 Not Found [IP: ]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get install -y apt-utils' returned a non-zero code: 100
ERROR: Service 'nginx-service' failed to build : Build failed
</code></pre>
<p>In my Dockerfile I'm running: <code>RUN apt-get install -y apt-utils</code> and with <code>--fix-missing</code>.</p>
<p>None of the related questions or other solutions helped me and I've been stuck for quite a while. What am I missing?</p>
<p>Thanks!</p>
<p>EDIT: The whole Dockerfile</p>
<pre><code>FROM ubuntu:latest
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y nginx
RUN apt-get clean
RUN apt-get install -y curl
RUN apt-get install -y unzip
RUN apt-get install -y wget
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get install -y php php-xml php-curl php-fpm php-mysql
RUN apt-get install -y apt-utils --fix-missing
RUN apt-get install -y php-zip --fix-missing
RUN apt-get install -y php-gd --fix-missing
RUN apt-get install -y mysql-server
RUN curl -sS https://getcomposer.org/installer -o composer-setup.php
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN apt-get install -y nano
RUN apt-get install -y mc
RUN apt-get install -y systemctl
RUN systemctl start nginx.service
</code></pre>
| [
{
"answer_id": 74261409,
"author": "George",
"author_id": 11301941,
"author_profile": "https://Stackoverflow.com/users/11301941",
"pm_score": 2,
"selected": false,
"text": "RUN apt-get update && apt-get install -y apt-utils\n"
},
{
"answer_id": 74263361,
"author": "Yorkata008... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16390253/"
] |
74,261,354 | <p>I have a large dataframe with some ID's that are unique. However, many refer still to the same object. Therefore, I need to create a dataframe that contains two columns: one with the unique ID's, and one with all ID's that refer to the same underlying object. In this case, all of the rows refer to the same object because they are all linked together through the second column.</p>
<p>I already have an ID combination column, but some combinations are lacking, which is what I am trying to adress.</p>
<p>Roughly, the data now looks like this:</p>
<pre><code>> tibble(id = c("x", "y", "z", "q", "w", "p"), t = c("x; y", "x; y; z", "y; z", "q", "w; p", "p"))
# A tibble: 6 × 2
id t
<chr> <chr>
1 x x; y
2 y x; y; z
3 z y; z
4 q q
5 w w; p
6 p p
</code></pre>
<p>And, what I should end up with is the following.</p>
<pre><code>> tibble(id = c("x", "y", "z", "q", "w", "p"), t = c("x; y; z", "x; y; z", "x; y; z", "q", "w; p", "w; p"))
# A tibble: 6 × 2
id t
<chr> <chr>
1 x x; y; z
2 y x; y; z
3 z x; y; z
4 q q
5 w w; p
6 p w; p
</code></pre>
<p>I have tried various forms of collapsing the strings, but it is the ones that are not linked together through the second column I can't get linked, i.e., in this case the ID's y and z.</p>
<p>Hope it make sense, any help is appreciated :-)!</p>
<p>EDIT: Basically, I want to loop through all values of <code>id</code> to see if they have a (partial string) match in <code>t</code> and then return <em>both</em> <code>id</code> and <code>t</code> - potentially pasted together, and then I can take the unique values in <code>t</code> after.</p>
| [
{
"answer_id": 74261409,
"author": "George",
"author_id": 11301941,
"author_profile": "https://Stackoverflow.com/users/11301941",
"pm_score": 2,
"selected": false,
"text": "RUN apt-get update && apt-get install -y apt-utils\n"
},
{
"answer_id": 74263361,
"author": "Yorkata008... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16222617/"
] |
74,261,377 | <p>Trying to understand how the retries are implemented, I'd expect to see something like threads in the source of Spring Retry - but don't. I'd like to know how retrying is implemented, if not as per threads.</p>
<p>Additionally I didn't find an @Aspect that would wrap the method to be retried. Since AOP is a dependency of Spring Retry - I would also expect to see some AOP-stuff. Where is that 'hidden'?</p>
| [
{
"answer_id": 74265719,
"author": "kriegaex",
"author_id": 1082681,
"author_profile": "https://Stackoverflow.com/users/1082681",
"pm_score": 1,
"selected": false,
"text": "StatefulRetryOperationsInterceptor implements MethodInterceptor"
},
{
"answer_id": 74267901,
"author": ... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11862547/"
] |
74,261,383 | <p>I'm trying to get some rudimentary media querying to work, but for some reason the div using the class "container" isn't working on the media query using max width:1200px and min width: 992, it just dissapears from page when I enter that size. I have a very simple example set up and I don't understand why the div just dissapears when I enter that size? It works for the three other sizes just fine.</p>
<p>Am I missing something simple?</p>
<pre><code>@media screen and (max-width: 768px) {
.container {
width:100%;
border:solid 1px black;
height:300px;
}
}
@media screen and (max-width: 992px) and (min-width: 768px) {
.container {
width:100%;
border:solid 1px red;
height:300px;
}
}
@media screen and (max-width: 1200) and (min-width: 992px) {
.container {
margin:auto;
width: 800px;
border:solid 1px green;
height:300px;
}
}
@media screen and (min-width: 1200px) {
.container {
margin:auto;
width: 1000px;
border:solid 1px blue;
height:300px;
}
}
</code></pre>
| [
{
"answer_id": 74261496,
"author": "HackerFrosch",
"author_id": 20357737,
"author_profile": "https://Stackoverflow.com/users/20357737",
"pm_score": -1,
"selected": false,
"text": "min-width"
},
{
"answer_id": 74261521,
"author": "Rushi Sharma",
"author_id": 7246900,
"... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2044135/"
] |
74,261,440 | <p>I have the data in a txt.How should i do to convert the data to Gray Scale Image output?Thx!
The number of rows is 2378 and the number of columns is 5362.
<a href="https://i.stack.imgur.com/cPwaS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cPwaS.png" alt="enter image description here" /></a></p>
<p>I'm a noob in python.I have tried this,but it did not work.</p>
<pre class="lang-py prettyprint-override"><code>from numpy import *
from PIL import Image
def rdnumpy(txtname):
f = open(txtname)
line = f.readlines()
lines = len(line)
for l in line:
le = l.strip('\n').split(' ')
columns = len(le)
A = zeros((lines, columns), dtype=int)
A_row = 0
for lin in line:
list = lin.strip('\n').split(' ')
A[A_row:] = list[0:columns]
A_row += 1
return A
A = rdnumpy('oop.txt')
im = Image.fromarray(array)
im = im.convert('L')
im.save('T7.png')
</code></pre>
| [
{
"answer_id": 74261496,
"author": "HackerFrosch",
"author_id": 20357737,
"author_profile": "https://Stackoverflow.com/users/20357737",
"pm_score": -1,
"selected": false,
"text": "min-width"
},
{
"answer_id": 74261521,
"author": "Rushi Sharma",
"author_id": 7246900,
"... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20281667/"
] |
74,261,466 | <p>Faced with a bit of a problem here that I think I may have stared at for too long, and I'm hoping somebody can point me in the right direction.
I've been attempting some array manipulation that I feel like I've come close with a few approaches, but haven't gotten there yet.</p>
<p>What I'm after is this: Given an array of values (for this example I'll use simple values <code>'A', 'B', 'C', 'D')</code>, and a stated number of minimum required occurrences of each value, the ability to group the collections of these values of the required size. For example:</p>
<pre><code>// when given this list of required amounts
var config = new[] {
{ Value: 'A', AmountRequired: 1 },
{ Value: 'B', AmountRequired: 2 },
{ Value: 'C', AmountRequired: 3 },
{ Value: 'D', AmountRequired: 4 }
};
// and this array of values (matches requirements exactly)
var values = new[] { 'A', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D', 'D' };
// the logic would return
var results = [
['A'],
['B', 'B'],
['C', 'C', 'C'],
['D', 'D', 'D', 'D'],
];
// this array of values (with one extra of each value) would also return the same result
// because there aren't enough added values for a second combined group
var values = new[] { 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D' };
</code></pre>
<p>The use-case that's easiest to describe the behaviour is probably like a videogame crafting menu where you would see something like "You need 1 A, 2 B's, 3 C's and 4 D's to be able to craft this item", and so all you're interested in is how many complete sets of those values you have, any spares can be ignored.</p>
<p>I've attempted this using <code>Linq</code>, and I had it working when the required amount was the same for all fields, which obviously isn't going to meet all use cases. I wasn't planning on posting my code attempt here as I was hoping to get a fresh perspective on the problem, but I can make it available if it will help.</p>
<p>Thanks in advance,</p>
<p>Mark</p>
| [
{
"answer_id": 74262032,
"author": "Astrid E.",
"author_id": 17213526,
"author_profile": "https://Stackoverflow.com/users/17213526",
"pm_score": 2,
"selected": true,
"text": "KeyValuePair"
},
{
"answer_id": 74262174,
"author": "D A",
"author_id": 13840530,
"author_pro... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5020874/"
] |
74,261,472 | <p>I would like to print a text using python [ on pycharm terminal ] with a URL. Can any one suggest how can I do that.</p>
<pre><code>`url = https://stackoverflow.com/.com
print ("Click me")`
</code></pre>
<p>I am expecting the text "<a href="https://www.stackoverflow.com/">Click me</a>" to be printed as a clickable text, which can go to <a href="https://stackoverflow.com/.com">https://stackoverflow.com/.com</a></p>
| [
{
"answer_id": 74262032,
"author": "Astrid E.",
"author_id": 17213526,
"author_profile": "https://Stackoverflow.com/users/17213526",
"pm_score": 2,
"selected": true,
"text": "KeyValuePair"
},
{
"answer_id": 74262174,
"author": "D A",
"author_id": 13840530,
"author_pro... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19850033/"
] |
74,261,513 | <p>I'm trying out solution of <a href="https://stackoverflow.com/questions/207309/sql-query-for-parent-child-relationship">SQL Query for Parent Child Relationship</a> with the queries:</p>
<pre><code>with [CTE] as (
select [ParentId]
, [NodeId]
from [TheTable] c where c.[ParentId] = 1
union all
select [ParentId]
, [NodeId]
from [CTE] p, [TheTable] c where c.[ParentId] = p.[NodeId]
)
select * from [CTE]
</code></pre>
<p>the errors:</p>
<blockquote>
<p>The multipart identifier "p.[NodeId]" could not be bound</p>
<p>All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.</p>
</blockquote>
<p>Not sure what to do next.</p>
<p>I expect it to return child at all level of a parent category.</p>
<p>e.g. for nodeId = 1, it should return 3, 4, 5, 6.</p>
| [
{
"answer_id": 74262032,
"author": "Astrid E.",
"author_id": 17213526,
"author_profile": "https://Stackoverflow.com/users/17213526",
"pm_score": 2,
"selected": true,
"text": "KeyValuePair"
},
{
"answer_id": 74262174,
"author": "D A",
"author_id": 13840530,
"author_pro... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20223061/"
] |
74,261,546 | <p>Is there a way to define a readable store, with its <code>set</code> function, however delay the calling of that function until certain criteria is met?</p>
<p>I'm thinking of using them for API calls, however I want to decide when to call the the set function, which would then fetch the data and populate the store with the results.</p>
| [
{
"answer_id": 74262564,
"author": "H.B.",
"author_id": 546730,
"author_profile": "https://Stackoverflow.com/users/546730",
"pm_score": 2,
"selected": true,
"text": "subscribe"
},
{
"answer_id": 74264437,
"author": "Corrl",
"author_id": 15388872,
"author_profile": "ht... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/114203/"
] |
74,261,587 | <p>I have the following construction
Delphi Form > ADO Connection > Otero ODBC Driver > RBase database</p>
<p>(ignore please exotic names)</p>
<p>From the user's logic side, it's all classic:
ADO Connection > ADO Query > DataSource > DBGrid</p>
<p>This construction works perfectly on majority of the machines, but one.
On the machine, when it does not work as expected, ADO return columns descriptions instead of columns names.</p>
<p>Normally it's like this</p>
<pre><code>Select * from SystemUsers
</code></pre>
<pre><code> SystemUserId SystemUserName
------------ ------------------------------------------------------------
1 Administrator
</code></pre>
<p>but on the problematic machine I'm getting</p>
<pre><code> SystemUserId System Autonumber Numero unico de identificacao da Collection FK
------------------------------ ------------------------------------------------------------
1 Administrator
</code></pre>
<p>The problematic system is Windows 2019 - but on other Windows 2019 the same app works well. I can take the app ape copy to any other machine, and it works as expected. The machine has installed the same version of the DB and ODBC driver.</p>
<p>As effect, when I call</p>
<pre><code>myAdoQuery.FieldByName('SystemUserId').asInteger ....
</code></pre>
<p>I'm getting error:</p>
<blockquote>
<p>Field SystemUserId does not exist</p>
</blockquote>
<p>I tried naming columns</p>
<pre><code>Select SystemUserId as mycolumn from SystemUsers
</code></pre>
<p>... no luck</p>
<p>I tried adding fields to Fields editor - same effect.</p>
<p>I could call fields by its indexes (Field[i]), but this mean re-engineering entire app.</p>
<p>Does anybody know what could go wrong here??</p>
| [
{
"answer_id": 74264471,
"author": "Jens",
"author_id": 10388596,
"author_profile": "https://Stackoverflow.com/users/10388596",
"pm_score": -1,
"selected": false,
"text": "procedure TestTable1;\nvar cnt : Integer;\n msgStr: String;\nbegin\ntry\n msgStr := '';\n with Table1 do\n b... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2901046/"
] |
74,261,634 | <p>I have an issue with my project.</p>
<p>I have this code to make disappear my div :</p>
<pre><code>@keyframes hideAnimation {
to {
visibility: hidden;
}
}
</code></pre>
<p>On my div I do this animation to make disappear my div after 6 seconds</p>
<pre><code>.env{
animation: hideAnimation 0s ease-in 6s;
animation-fill-mode: forwards;
}
</code></pre>
<p>My issue is : I want to create a button to reappear my div</p>
<p>The div disappear automatically after 6 seconds and the user can make reappear the div with a click on a button.</p>
<p>I don't know how to do that.</p>
<p>I think I will use JS or jQuery but I'm lost.
Can someone can help me ?</p>
| [
{
"answer_id": 74261708,
"author": "Mina",
"author_id": 11887902,
"author_profile": "https://Stackoverflow.com/users/11887902",
"pm_score": 0,
"selected": false,
"text": "click"
},
{
"answer_id": 74261723,
"author": "Rory McCrossan",
"author_id": 519413,
"author_profi... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377940/"
] |
74,261,654 | <p>I have list of struct for store basket of online store :</p>
<pre><code>pub struct UserTransationHistory<T: Config> {
transactionId: <T as frame_system::Config>::Hash,
items: Vec<UserBasketItemItem<T>>,
customerPay: bool,
confirmPay: bool,
storeOwner: T::AccountId,
storeId: <T as frame_system::Config>::Hash,
}
pub struct UserBasketItemItem<T: Config> {
itemId: <T as frame_system::Config>::Hash,
count: u32,
price: u32,
}
</code></pre>
<p>i wanna to calcualte all basket price , i wrote this code :</p>
<pre><code> Baskets::<T>::mutate(storeId, |basket| -> DispatchResult {
match basket {
Some(basket) => {
let mut total_price = 0;
basket.items.iter().map(|x| total_price += x.price).rev();
log::info!("**************** Total Price {:?}", total_price);
Ok(())
},
_ => Err(<Error<T>>::StoreItemNotFound.into()),
}
});
</code></pre>
<p>i aded items on basket with price <code>10</code> but every time i log the <code>total_price</code> it shows me <code>0</code> .</p>
<p>**whats the problem ? how can i solve this problem ? **</p>
<pre><code>Baskets::<T>::mutate(storeId, |basket| -> DispatchResult {
match basket {
Some(basket) => {
let mut total_price = 0;
basket.items.iter().map(|x| total_price += x.price).rev();
log::info!("**************** Total Price {:?}", total_price);
Ok(())
},
_ => Err(<Error<T>>::StoreItemNotFound.into()),
}
});
</code></pre>
| [
{
"answer_id": 74261757,
"author": "cameron1024",
"author_id": 9186783,
"author_profile": "https://Stackoverflow.com/users/9186783",
"pm_score": 2,
"selected": false,
"text": "fn main() {\n let numbers = [1, 2, 3];\n\n let mut sum = 0;\n numbers.iter().map(|x| sum += *x).rev();\... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5599745/"
] |
74,261,680 | <p>I have a CSV file that goes something like this:</p>
<pre><code>Report Name: Stackoverflow parse data
Date of Report: 31 October, 2022
Col1, Col2, Col3,...
Data, Data, Data, ...
</code></pre>
<p>The values before Headers, essentially data that states what the CSV is for and when it was created (can contain multiple values, hence has dynamic number of rows), need to be removed from the CSV so I can parse it in Pentaho. Now, the CSV files are on an S3 bucket and I am fetching them using <code>S3 CSV Input</code> but I am not sure how to proceed with filtering the non-required data so I can successfully parse the CSV files.</p>
| [
{
"answer_id": 74261757,
"author": "cameron1024",
"author_id": 9186783,
"author_profile": "https://Stackoverflow.com/users/9186783",
"pm_score": 2,
"selected": false,
"text": "fn main() {\n let numbers = [1, 2, 3];\n\n let mut sum = 0;\n numbers.iter().map(|x| sum += *x).rev();\... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11334569/"
] |
74,261,682 | <p>I am trying to understand the use of callback, promise, and <code>async</code>/<code>await</code>.</p>
<p>The code I pasted below is working fine but I am wondering if it is the best way to present the same meaning in using callbacks, given that callback style might lead to "callback hell", or should I train myself writing all codes using async/await?</p>
<pre class="lang-js prettyprint-override"><code>// working code:
const loginCheck = (data, callback) => {
let formData = new FormData();
formData.append('method', "login");
formData.append('mobile', data.mobile);
formData.append('password', data.password);
formData.append('region', memberRegion);
axios.post(API_MIDDLEWARE, formData).then(function(response) {
callback(response.data);
}).catch(function(error) {
console.log(error);
callback(false);
});
}
</code></pre>
<p>Am I correct to use it like this:</p>
<pre class="lang-js prettyprint-override"><code>const loginCheck = async (data) => {
let formData = new FormData();
formData.append('method', "login");
formData.append('mobile', data.mobile);
formData.append('password', data.password);
formData.append('region', memberRegion);
await axios.post(API_MIDDLEWARE, formData).then(function(response) {
}).catch(function(error) {
console.log(error);
});
}
</code></pre>
<p>What and how is the best way in order to have the same meaning as the original code using a callback?</p>
| [
{
"answer_id": 74261831,
"author": "Keith",
"author_id": 6870228,
"author_profile": "https://Stackoverflow.com/users/6870228",
"pm_score": 1,
"selected": true,
"text": "async"
},
{
"answer_id": 74261839,
"author": "Trevor Dixon",
"author_id": 711902,
"author_profile":... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18316189/"
] |
74,261,711 | <p>Im trying to extract all Product Names, Product Codes, Prices, and Specs from a website, but there's no classes I can use to dig deeper into the html tree, so I have to use data-type and data-id, and all the tr and td info inside of it. However, if I now search for data-id, it only shows me the names, but not actually the content inside of it.</p>
<p>Right now the code is a little chaotic, Ive been trying as many solutions as I can, but none of them worked so far</p>
<p>Heres my code:</p>
<pre><code>
from cgitb import text
from pickle import TRUE
from bs4 import BeautifulSoup
import requests
import urllib
import pandas as pd
import json
url = "https://www.albelli.nl/prijsoverzicht"
result = requests.get(url)
doc = BeautifulSoup(result.text, "html.parser")
WholeDoc = doc.find('div', 'arc3-container arc3-margin--bottom-none arc3-margin--top-none price-overview--content')
for letstry in WholeDoc.find_all('div', attrs={'data-type' : 'Photobook'}):
for item in letstry.find_all('tbody'):
for moop in item.find_all('tr', attrs=('data-id')):
print(moop)
</code></pre>
<p>I tried using the attrs=() function, but it doesnt get me the content INSIDE of the data-id, however, it seems to work with the data-type</p>
<pre><code>.find_all('tr', attrs=('data-id'))
</code></pre>
| [
{
"answer_id": 74261831,
"author": "Keith",
"author_id": 6870228,
"author_profile": "https://Stackoverflow.com/users/6870228",
"pm_score": 1,
"selected": true,
"text": "async"
},
{
"answer_id": 74261839,
"author": "Trevor Dixon",
"author_id": 711902,
"author_profile":... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20340060/"
] |
74,261,729 | <p>I want to clean usb using diskpart from C#. I have written below code in C# to get all connect USB. And I iterate thru all usb and clean each usb using diskpart below cmd command.</p>
<pre><code> diskpart
list disk
select disk <0/1/2>
clean
</code></pre>
<p>I want to get disk number <0/1/2> from drive name so that I can clean each usb one after another.</p>
<pre><code>foreach (DriveInfo drive in DriveInfo.GetDrives())
{
if (drive.IsReady == true)
{
if (drive.DriveType == DriveType.Removable)
{
string usbName = drive.Name;
}
}
}
</code></pre>
<p><a href="https://i.stack.imgur.com/antbE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/antbE.png" alt="USB without partition" /></a></p>
| [
{
"answer_id": 74261831,
"author": "Keith",
"author_id": 6870228,
"author_profile": "https://Stackoverflow.com/users/6870228",
"pm_score": 1,
"selected": true,
"text": "async"
},
{
"answer_id": 74261839,
"author": "Trevor Dixon",
"author_id": 711902,
"author_profile":... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16629582/"
] |
74,261,774 | <p>here is the list which i get from server
`</p>
<pre><code>[
{
"Name": "101 Working hours",
"Balance": "8.00",
"Date": "2022-10-19",
"ShiftName": "AU128"
},
{
"Name": "102 Bonus pay",
"Balance": "3:48",
"Date": "2022-10-19",
"ShiftName": ""
},
{
"Name": "110 Split Shift",
"Balance": "1:00",
"Date": "2022-10-19",
"ShiftName": ""
},
{
"Name": "111 Wage reduction",
"Balance": "1:00",
"Date": "2022-10-19",
"ShiftName": ""
},
{
"Name": "111 Wage reduction",
"Balance": "1:00",
"Date": "2022-10-20",
"ShiftName": ""
},
{
"Name": "101 Working hours",
"Balance": "8.00",
"Date": "2022-10-21",
"ShiftName": "AU128"
},
{
"Name": "102 Bonus pay",
"Balance": "3:48",
"Date": "2022-10-21",
"ShiftName": ""
},
{
"Name": "110 Split Shift",
"Balance": "1:00",
"Date": "2022-10-21",
"ShiftName": ""
},
{
"Name": "111 Wage reduction",
"Balance": "1:00",
"Date": "2022-10-21",
"ShiftName": ""
},
]
</code></pre>
<p>`</p>
<p>here you can see date is repeating and all i want to avoid date repetition on FE. you can see app Screenshot to get an idea which i get and which i want to achieve.</p>
<p>the data i get.</p>
<p><a href="https://i.stack.imgur.com/mTgbh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mTgbh.png" alt="enter image description here" /></a></p>
<p>the data i want to be achieved</p>
<p><a href="https://i.stack.imgur.com/lZbYu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lZbYu.png" alt="enter image description here" /></a></p>
<p>I tried to avoid date repetition and insert data on same list if date is same but all the time i get repetition date and data as you can see in image.</p>
<p>my code:</p>
<pre><code> Expanded(
child: Consumer<EmployeeWageAccountsProvider>(
builder: (context, data, child) {
if (!data.isLoading) {
int length = data.getEmployeeAccountsData!.length;
if (data.getEmployeeAccountsData!.isNotEmpty) {
wageAccountsData = data.getEmployeeAccountsData!;
return ListView.builder(
itemCount: length,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemBuilder: (context, i) {
return WageAccountsCard(
date: Helper.formatStringDate(
wageAccountsData[i].date!),
balance: wageAccountsData[i].balance,
name: wageAccountsData[i].name,
shiftName: wageAccountsData[i].shiftName,
);
},
);
}
return noDataFound(context, 50);
}
return const WageAccountsShimmer();
}),
)
</code></pre>
<p>wageacount card</p>
<pre><code>class WageAccountsCard extends StatelessWidget {
final String? date;
final String? balance;
final String? name;
final String? shiftName;
const WageAccountsCard(
{Key? key, this.date, this.name, this.balance,
this.shiftName})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(8),
decoration: CustomBoxDecoration.cardDecoration(context,
shadow: true),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
shiftName!,
style: wageTextStyle,
),
Text(
date.toString(),
style: wageTextStyle,
),
],
),
SizedBox(
height: Styles.height(context) * 0.01,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
S.of(context).wage_type,
style: cTextStyle,
),
Text(
S.of(context).balance,
style: cTextStyle,
),
],
),
const Divider(
color: Colors.black,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
name!,
style: cTextStyle,
),
Text(
balance.toString(),
style: cTextStyle,
),
],
),
SizedBox(
height: Styles.height(context) * 0.01,
),
],
),
);
}
}
</code></pre>
<p>model class</p>
<pre><code>class EmployeeWageAccountsModel {
String? name;
String? balance;
String? date;
String? shiftName;
EmployeeWageAccountsModel({this.name, this.balance, this.date,
this.shiftName});
EmployeeWageAccountsModel.fromJson(Map<String, dynamic> json) {
name = json['Name'];
balance = json['Balance'];
date = json['Date'];
shiftName = json['ShiftName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['Name'] = name;
data['Balance'] = balance;
data['Date'] = date;
data['ShiftName'] = shiftName;
return data;
}
}
</code></pre>
<p>parsing data from API</p>
<pre><code>List<EmployeeWageAccountsModel> employeeWageAccountsList =
List<EmployeeWageAccountsModel>.from(
employeeWageAccountsResponse.map((model) =>
EmployeeWageAccountsModel.fromJson(model)));
</code></pre>
| [
{
"answer_id": 74261831,
"author": "Keith",
"author_id": 6870228,
"author_profile": "https://Stackoverflow.com/users/6870228",
"pm_score": 1,
"selected": true,
"text": "async"
},
{
"answer_id": 74261839,
"author": "Trevor Dixon",
"author_id": 711902,
"author_profile":... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12204643/"
] |
74,261,785 | <p>I have jdk-8 in my local, and I using gradle to build my project. I try to update my hsqldb from version 2.5.2 to 2.7.1. After I update my gradle script:</p>
<pre><code>runtime "org.hsqldb:hsqldb:2.5.2"
</code></pre>
<p>to</p>
<pre><code>runtime "org.hsqldb:hsqldb:2.7.1"
</code></pre>
<p>Then I build with gradle but it download the java-11 version. Which led an UnsupportedClassVersionError in my project. I found there is a java-8 version in the maven central repository <a href="https://repo1.maven.org/maven2/org/hsqldb/hsqldb/2.7.1/.But" rel="nofollow noreferrer">https://repo1.maven.org/maven2/org/hsqldb/hsqldb/2.7.1/.But</a> it will not be downloaded automatically.</p>
<p>I wish can update hsqldb to the latest version, then run gradle build and it can download the correct version. And I can run my project sucessfully.</p>
| [
{
"answer_id": 74261846,
"author": "Nadeem Nayeck",
"author_id": 15512394,
"author_profile": "https://Stackoverflow.com/users/15512394",
"pm_score": 1,
"selected": false,
"text": "<dependency>\n <groupId>org.hsqldb</groupId>\n <artifactId>hsqldb</artifactId>\n <version>2.7.1</ve... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10975118/"
] |
74,261,797 | <p>I have to extract all the list of countries. however in the datatable under country column (2nd column), it includes continent as well, which is not what i want.</p>
<p>I realised those with the first column (iso_code) with only 3 characters are data with countries, while those with more than 3 characters are continents/non country. How do i go about extracting this?</p>
<p><img src="https://i.stack.imgur.com/Wf2bl.png" alt="enter image description here" /></p>
<p>this is my current code when extracting everything (including continent that are under country column) :</p>
<pre><code>select count(distinct country) as "Number of Countries"
FROM owid_energy_data
</code></pre>
| [
{
"answer_id": 74261866,
"author": "codeulike",
"author_id": 22194,
"author_profile": "https://Stackoverflow.com/users/22194",
"pm_score": 0,
"selected": false,
"text": "select count(distinct country) as \"Number of Countries\" \nFROM owid_energy_data \nwhere len(iso_code) = 3\n"
},... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20378251/"
] |
74,261,872 | <p>I have just installed AIOHTTP on my mac</p>
<p>Python 3.10.8</p>
<p>Visual Studio Code Version: 1.72.2</p>
<pre><code>Package Version
------------------ -------
aiodns 3.0.0
aiohttp 3.8.3
aiosignal 1.2.0
async-timeout 4.0.2
attrs 22.1.0
cffi 1.15.1
charset-normalizer 2.1.1
frozenlist 1.3.1
idna 3.4
multidict 6.0.2
pip 22.3
pycares 4.2.2
pycparser 2.21
setuptools 65.5.0
wheel 0.37.1
yarl 1.8.1
</code></pre>
<p>Ex. code</p>
<pre><code>import aiohttp
import asyncio
async def main():
async with aiohttp.ClientSession() as session:
async with session.get('http://python.org') as response:
print("Status:", response.status)
print("Content-type:", response.headers['content-type'])
html = await response.text()
print("Body:", html[:15], "...")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
</code></pre>
<p>When I try to run the code above <a href="https://docs.aiohttp.org/en/stable/index.html" rel="nofollow noreferrer">Client example</a> I getting lot of errors, this is just a few of them. What do I miss?</p>
<pre><code>test.py:15: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host python.org:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
</code></pre>
| [
{
"answer_id": 74261866,
"author": "codeulike",
"author_id": 22194,
"author_profile": "https://Stackoverflow.com/users/22194",
"pm_score": 0,
"selected": false,
"text": "select count(distinct country) as \"Number of Countries\" \nFROM owid_energy_data \nwhere len(iso_code) = 3\n"
},... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6593987/"
] |
74,261,946 | <p>sample_list = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])</p>
<pre><code>Required to take the average of every 4
like 1,2,3,4 average is 2.5
followed by 5,6,7,8 is 6.5
followed by 9,10,11,12 is 10.5
followed by 13,14,15,16 is 14,5
</code></pre>
<p>expexted output:</p>
<pre><code>[2.5, 6.5, 10.5, 14.5]
</code></pre>
<p>so far i tried with refering this questions
<a href="https://stackoverflow.com/questions/54620614/average-of-each-consecutive-segment-in-a-list">Average of each consecutive segment in a list</a></p>
<p><a href="https://stackoverflow.com/questions/42444046/calculate-the-sum-of-every-5-elements-in-a-python-array">Calculate the sum of every 5 elements in a python array</a></p>
| [
{
"answer_id": 74261967,
"author": "Faisal Nazik",
"author_id": 13959139,
"author_profile": "https://Stackoverflow.com/users/13959139",
"pm_score": 3,
"selected": true,
"text": "reshape"
},
{
"answer_id": 74262249,
"author": "Gonçalo Peres",
"author_id": 7109869,
"aut... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20016854/"
] |
74,261,965 | <p>Assume I have the following dataframe</p>
<pre class="lang-py prettyprint-override"><code>iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')
</code></pre>
<p>which looks like this</p>
<pre><code> sepal_length sepal_width petal_length petal_width species
0 5.1 3.5 1.4 0.2 setosa
1 4.9 3.0 1.4 0.2 setosa
2 4.7 3.2 1.3 0.2 setosa
3 4.6 3.1 1.5 0.2 setosa
4 5.0 3.6 1.4 0.2 setosa
5 5.4 3.9 1.7 0.4 setosa
6 4.6 3.4 1.4 0.3 setosa
7 5.0 3.4 1.5 0.2 setosa
8 4.4 2.9 1.4 0.2 setosa
9 4.9 3.1 1.5 0.1 setosa
10 5.4 3.7 1.5 0.2 setosa
11 4.8 3.4 1.6 0.2 setosa
12 4.8 3.0 1.4 0.1 setosa
13 4.3 3.0 1.1 0.1 setosa
14 5.8 4.0 1.2 0.2 setosa
15 5.7 4.4 1.5 0.4 setosa
16 5.4 3.9 1.3 0.4 setosa
17 5.1 3.5 1.4 0.3 setosa
18 5.7 3.8 1.7 0.3 setosa
19 5.1 3.8 1.5 0.3 setosa
20 5.4 3.4 1.7 0.2 setosa
21 5.1 3.7 1.5 0.4 setosa
22 4.6 3.6 1.0 0.2 setosa
23 5.1 3.3 1.7 0.5 setosa
24 4.8 3.4 1.9 0.2 setosa
25 5.0 3.0 1.6 0.2 setosa
26 5.0 3.4 1.6 0.4 setosa
27 5.2 3.5 1.5 0.2 setosa
28 5.2 3.4 1.4 0.2 setosa
29 4.7 3.2 1.6 0.2 setosa
30 4.8 3.1 1.6 0.2 setosa
31 5.4 3.4 1.5 0.4 setosa
32 5.2 4.1 1.5 0.1 setosa
33 5.5 4.2 1.4 0.2 setosa
34 4.9 3.1 1.5 0.2 setosa
35 5.0 3.2 1.2 0.2 setosa
36 5.5 3.5 1.3 0.2 setosa
37 4.9 3.6 1.4 0.1 setosa
38 4.4 3.0 1.3 0.2 setosa
39 5.1 3.4 1.5 0.2 setosa
40 5.0 3.5 1.3 0.3 setosa
41 4.5 2.3 1.3 0.3 setosa
42 4.4 3.2 1.3 0.2 setosa
43 5.0 3.5 1.6 0.6 setosa
44 5.1 3.8 1.9 0.4 setosa
45 4.8 3.0 1.4 0.3 setosa
46 5.1 3.8 1.6 0.2 setosa
47 4.6 3.2 1.4 0.2 setosa
48 5.3 3.7 1.5 0.2 setosa
49 5.0 3.3 1.4 0.2 setosa
50 7.0 3.2 4.7 1.4 versicolor
51 6.4 3.2 4.5 1.5 versicolor
52 6.9 3.1 4.9 1.5 versicolor
53 5.5 2.3 4.0 1.3 versicolor
54 6.5 2.8 4.6 1.5 versicolor
55 5.7 2.8 4.5 1.3 versicolor
56 6.3 3.3 4.7 1.6 versicolor
57 4.9 2.4 3.3 1.0 versicolor
58 6.6 2.9 4.6 1.3 versicolor
59 5.2 2.7 3.9 1.4 versicolor
60 5.0 2.0 3.5 1.0 versicolor
61 5.9 3.0 4.2 1.5 versicolor
62 6.0 2.2 4.0 1.0 versicolor
63 6.1 2.9 4.7 1.4 versicolor
64 5.6 2.9 3.6 1.3 versicolor
65 6.7 3.1 4.4 1.4 versicolor
66 5.6 3.0 4.5 1.5 versicolor
67 5.8 2.7 4.1 1.0 versicolor
68 6.2 2.2 4.5 1.5 versicolor
69 5.6 2.5 3.9 1.1 versicolor
70 5.9 3.2 4.8 1.8 versicolor
71 6.1 2.8 4.0 1.3 versicolor
72 6.3 2.5 4.9 1.5 versicolor
73 6.1 2.8 4.7 1.2 versicolor
74 6.4 2.9 4.3 1.3 versicolor
75 6.6 3.0 4.4 1.4 versicolor
76 6.8 2.8 4.8 1.4 versicolor
77 6.7 3.0 5.0 1.7 versicolor
78 6.0 2.9 4.5 1.5 versicolor
79 5.7 2.6 3.5 1.0 versicolor
80 5.5 2.4 3.8 1.1 versicolor
81 5.5 2.4 3.7 1.0 versicolor
82 5.8 2.7 3.9 1.2 versicolor
83 6.0 2.7 5.1 1.6 versicolor
84 5.4 3.0 4.5 1.5 versicolor
85 6.0 3.4 4.5 1.6 versicolor
86 6.7 3.1 4.7 1.5 versicolor
87 6.3 2.3 4.4 1.3 versicolor
88 5.6 3.0 4.1 1.3 versicolor
89 5.5 2.5 4.0 1.3 versicolor
90 5.5 2.6 4.4 1.2 versicolor
91 6.1 3.0 4.6 1.4 versicolor
92 5.8 2.6 4.0 1.2 versicolor
93 5.0 2.3 3.3 1.0 versicolor
94 5.6 2.7 4.2 1.3 versicolor
95 5.7 3.0 4.2 1.2 versicolor
96 5.7 2.9 4.2 1.3 versicolor
97 6.2 2.9 4.3 1.3 versicolor
98 5.1 2.5 3.0 1.1 versicolor
99 5.7 2.8 4.1 1.3 versicolor
100 6.3 3.3 6.0 2.5 virginica
101 5.8 2.7 5.1 1.9 virginica
102 7.1 3.0 5.9 2.1 virginica
103 6.3 2.9 5.6 1.8 virginica
104 6.5 3.0 5.8 2.2 virginica
105 7.6 3.0 6.6 2.1 virginica
106 4.9 2.5 4.5 1.7 virginica
107 7.3 2.9 6.3 1.8 virginica
108 6.7 2.5 5.8 1.8 virginica
109 7.2 3.6 6.1 2.5 virginica
110 6.5 3.2 5.1 2.0 virginica
111 6.4 2.7 5.3 1.9 virginica
112 6.8 3.0 5.5 2.1 virginica
113 5.7 2.5 5.0 2.0 virginica
114 5.8 2.8 5.1 2.4 virginica
115 6.4 3.2 5.3 2.3 virginica
116 6.5 3.0 5.5 1.8 virginica
117 7.7 3.8 6.7 2.2 virginica
118 7.7 2.6 6.9 2.3 virginica
119 6.0 2.2 5.0 1.5 virginica
120 6.9 3.2 5.7 2.3 virginica
121 5.6 2.8 4.9 2.0 virginica
122 7.7 2.8 6.7 2.0 virginica
123 6.3 2.7 4.9 1.8 virginica
124 6.7 3.3 5.7 2.1 virginica
125 7.2 3.2 6.0 1.8 virginica
126 6.2 2.8 4.8 1.8 virginica
127 6.1 3.0 4.9 1.8 virginica
128 6.4 2.8 5.6 2.1 virginica
129 7.2 3.0 5.8 1.6 virginica
130 7.4 2.8 6.1 1.9 virginica
131 7.9 3.8 6.4 2.0 virginica
132 6.4 2.8 5.6 2.2 virginica
133 6.3 2.8 5.1 1.5 virginica
134 6.1 2.6 5.6 1.4 virginica
135 7.7 3.0 6.1 2.3 virginica
136 6.3 3.4 5.6 2.4 virginica
137 6.4 3.1 5.5 1.8 virginica
138 6.0 3.0 4.8 1.8 virginica
139 6.9 3.1 5.4 2.1 virginica
140 6.7 3.1 5.6 2.4 virginica
141 6.9 3.1 5.1 2.3 virginica
142 5.8 2.7 5.1 1.9 virginica
143 6.8 3.2 5.9 2.3 virginica
144 6.7 3.3 5.7 2.5 virginica
145 6.7 3.0 5.2 2.3 virginica
146 6.3 2.5 5.0 1.9 virginica
147 6.5 3.0 5.2 2.0 virginica
148 6.2 3.4 5.4 2.3 virginica
149 5.9 3.0 5.1 1.8 virginica
</code></pre>
<p>I would like to write this to an excel file where I add a background color based on the value of the <code>species</code> columns. <strong>I want to highlight the entire row, not just the <code>species</code> column.</strong> I want to cycle between two colors, such that <code>setosa</code> is red, <code>versicolor</code> is blue, <code>virginica</code> is red, and so on. <strong>In general I do not know how many groups I have, so it must be general enough to account for this</strong></p>
<p>How would I go about achieving this? The <code>df.style.apply</code> works in individual rows. I thought I could do a groupby and then apply the color to all rows within the group, but I was not able to "combine" the formatted groups into one dataframe.</p>
| [
{
"answer_id": 74262073,
"author": "jezrael",
"author_id": 2901002,
"author_profile": "https://Stackoverflow.com/users/2901002",
"pm_score": 2,
"selected": true,
"text": "Styler.apply"
},
{
"answer_id": 74262099,
"author": "Faisal Nazik",
"author_id": 13959139,
"autho... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6218849/"
] |
74,261,977 | <p>I have a form on my .blade that has a filed "type_id" and it must a number between 0 and 4</p>
<p>is it possible to create a multiple size? for example 'size:0 || size:1 || size:2 || size:3 || size 4' ???</p>
<p>that's my function store: (but the most important part is the type_id field)</p>
<pre><code>public function store(Request $request)
{
$toCreate = $request->validate([
'type_id' => ['required','integer','size:4'],
'name' => ['required', 'string', 'max:255'],
'partitaIva' => ['max:255'],
'codiceFiscale' => ['max:255'],
'sedeAmministrativa' => ['max:255'],
'indirizzoNotifica' => ['max:255'],
'referente' => ['max:255'],
'responsabile' => ['max:255'],
'telefono' => ['max:255'],
'fax' => ['max:255'],
'email' => ['max:255'],
'pec' => ['max:255'],
'capitale' => ['max:255'],
'nDipendenti' => ['max:255'],
'convenzioniDeleghe' => [],
'note' => []
]);
Administration::create($toCreate);
return redirect()->route('administrations.index')->with('success','Amministratore aggiunto con successo.');
}
</code></pre>
<hr />
| [
{
"answer_id": 74262466,
"author": "Harkhenon",
"author_id": 19118257,
"author_profile": "https://Stackoverflow.com/users/19118257",
"pm_score": 0,
"selected": false,
"text": "('type_id' => ['required', 'integer', 'size:4', 'between:0,4'])\n"
},
{
"answer_id": 74262474,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20378336/"
] |
74,261,979 | <p>looking for some help with adding mesh colliders in Unity via script. For example, I want to select GameObject and have script add mesh colliders to each other child gameobject, with exception of said gameobject of having Mesh Filter.</p>
<p>Any help would be appreciated. I'd like to be able to use the script in Editor mode, so I don't have to manually select gameobjects and set colliders to them.</p>
<p>I'm not really too sure how to go about that at the moment.</p>
<pre><code>public GameObject object4col;
public void AddMeshColliders(){
if (object4col.GetComponent<MeshFilter>() == null)
{
object4col.AddComponent<MeshCollider>();
}
}
</code></pre>
<p>Thanks!</p>
| [
{
"answer_id": 74262466,
"author": "Harkhenon",
"author_id": 19118257,
"author_profile": "https://Stackoverflow.com/users/19118257",
"pm_score": 0,
"selected": false,
"text": "('type_id' => ['required', 'integer', 'size:4', 'between:0,4'])\n"
},
{
"answer_id": 74262474,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9580535/"
] |
74,261,980 | <p>I am converting a Delphi app from using a TTreeView to using a TVirtualStringTree; The node data is held in TItemData records in a TList.</p>
<pre><code>type
TItemData = record
idName: string;
end;
PItemData = ^TItemData
TMyForm = class(TForm)
...
private
itemData: TList<TItemData>;
..
end;
</code></pre>
<p>I wanted to get the displayed tree up and running in the most straightforward way possible, and then gradually convert the app little by little as I got to understand how to use the VirtualStringTree. So, I have a buildTreeFromItemData() method, which iterates through the TList elements and creates child nodes in the VirtualStringTree. I [tried to] pass a pointer to each TItemData record in each call to VST.addChild() which would then be dereferenced in vstGetText(), something like this:</p>
<pre><code>procedure buildTreeFromItemData;
var
i: integer;
idA: TItemData;
begin
for i := 0 to itemData.count - 1 do begin
idA := itemData[i];
vst.addChild(NIL, @idA);
end;
end;
</code></pre>
<p>Dereference the pointer:</p>
<pre><code>procedure TMyForm.vstGetData(...);
var
idB: TItemData;
begin
idB := node.getData^;
CellText := idB.idName;
end;
</code></pre>
<p>It quickly became apparent that no matter how many different ways I tried to code this, e.g. @itemData[i], the only times my code compiled every vst node was actually getting the address of the idA local variable, and every tree node was pointing to the most recent TItemData record pointed to by idA. I was then getting access violations in vstGetText() once buildTreeFromItemData() had completed and the local idA variable went out of scope, i.e. every node's data pointer in vst was now invalid.</p>
<p>Most of my attempts to somehow deference idA and get at the address location of the TItemData stored in idA generated an "invalid typecast" from the Delphi syntax checker, let alone the compiler.</p>
<p>At one point I tried something like this:</p>
<pre><code> ptr1^ := @idA;
</code></pre>
<p>I have no idea what that actually means to the Delphi compiler. I know what I wanted it to mean: I wanted it to mean "set ptr1 to the [dereferened] address stored at the address of the idA local variable". To my surprise, it compiled but went bang as soon as the debugger hit that statement. (What does the compiler think "ptr1^ := " means?)</p>
<p>Eventually I hit upon the idea of typecasting idA to a TObject; at least then, my thinking went, the compiler would know we were at least in the realms of dereferencing and might actually let me, eventually, get to the pointer I really needed to pass to vst.addChild().</p>
<p>After much experimentation, and many more "invalid typecast"s, unbelievably [at least to me] the following code works!.....</p>
<pre><code>procedure buildTreeFromItemData;
var
i: integer;
idA: TItemData;
myObj: TObject;
ptr1: pointer;
ptr2: PItemData;
begin
for i := 0 to itemData.count - 1 do begin
idA := itemData[i];
myObj := TObject(@idA);
ptr1 := pointer(myObj)
ptr2 := PItemData(ptr1^);
vst.addChild(NIL, ptr2);
end;
end;
</code></pre>
<p>ptr2 is now so far removed, syntactically and semantically, from idA, that the compiler <em>finally</em> allows the dereference in PItemData(ptr1^), although it only allowed it after I added the PItemData(...) typecast.</p>
<p>I don't even have to dereference this pointer in vstGetText!...</p>
<pre><code>procedure TMyForm.vstGetText(...);
var
idB: PItemData;
begin
idB := PItemData(node.getData);
CellText := idB.idName;
end;
</code></pre>
<p>The tree displays perfectly and the access violations are gone. <em>(NB. The actual code in buildTreeFromItemData() is a lot more involved and creates child nodes of child nodes to create a complex tree structure several levels deep.)</em></p>
<p>Although I eventually found a solution at gone 1am this morning after <em>a lot</em> of trial and error, I find it difficult to believe that my jiggerypokery with the local variable is really necessary for something so simple. So my question is this: what is the correct Delphi syntax for getting the address of my TItemData record stored in a plain "idA: TItemData;" local variable?</p>
<p><em>(I think this is my first ever question to stackoverflow; I hope I have formulated it well enough. I've kept the code to the absolute bare bones necessary to illustrate the issue and I wasn't able to completely reproduce the exact experimentation code I went through. The solution in the final two code blocks, though, is my working code. If I can improve how I've formulated the question and the explanation to meet stackoverflow's stringent standards, please let me know.)</em></p>
| [
{
"answer_id": 74262971,
"author": "IVO GELOV",
"author_id": 5962802,
"author_profile": "https://Stackoverflow.com/users/5962802",
"pm_score": 1,
"selected": false,
"text": "NodeDataSize"
},
{
"answer_id": 74264653,
"author": "Ken Bourassa",
"author_id": 258986,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7183852/"
] |
74,261,996 | <p>I have this column of widgets. They are containers with a row for the label and text.
On a big enough screen size, it looks nice.</p>
<p><a href="https://i.stack.imgur.com/4PK8E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4PK8E.jpg" alt="Big screen" /></a></p>
<p>However, when I decrease the screen size, the text starts to wrap and it aligns left.</p>
<p><a href="https://i.stack.imgur.com/rKMy5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rKMy5.jpg" alt="Small screen" /></a></p>
<p>I want it to keep staying to the right and be aligned with the other texts. Is there a way to do it?</p>
<p>Here's the widget code:</p>
<pre><code>const LrListItem({Key? key, required this.label, required this.text})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: bPadding25,
child: Container(
height: 40,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(width: 1, color: lrDarkBlue.withOpacity(0.3)),
)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: 150,
child: BoxText(
text: label,
size: 16,
color: lrDarkBlue.withOpacity(0.3),
),
),
Flexible(
child: Align(
alignment: Alignment.centerRight,
child: BoxText(
text: text,
size: 16,
color: lrDarkBlue,
lines: 2,
),
),
),
],
),
),
);
}
</code></pre>
<p>I tried Wrap, Expanded, Flexible and Align, but nothing quite worked.</p>
<p>Thank you!</p>
| [
{
"answer_id": 74262971,
"author": "IVO GELOV",
"author_id": 5962802,
"author_profile": "https://Stackoverflow.com/users/5962802",
"pm_score": 1,
"selected": false,
"text": "NodeDataSize"
},
{
"answer_id": 74264653,
"author": "Ken Bourassa",
"author_id": 258986,
"auth... | 2022/10/31 | [
"https://Stackoverflow.com/questions/74261996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13516622/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.