instruction stringlengths 0 30k ⌀ |
|---|
PROGRAM 4: Rolling Table
Using the ROL and ROR instructions, write a program to produce a rolling table. This table should be built from a single int8 value provided by the user and print 3 rows from the starting value, each offset by one from the starting value. In each individual row, the entered number should be ROL'ed and then ROR'ed and then ROL'ed and then ROR'ed, as shown below. For example, the following output should be produced when the user inputs the starting value 4:
Gimme a starting value: 4
Rolling Table
4: 8 2 16 1
5: 10 2 20 1
6: 12 3 24 1
This is my current code
program RollingTable;
#include ("stdlib.hhf" );
//Declaring Variables
static
value: int8;
num: int8;
begin RollingTable;
//Getting user's input
stdout.put( "Enter an integer value: ");
stdin.get( value );
stdout.put( "Rolling Table",nl);
//first row
stdout.put( value, ":" );
mov(value, ah);
rol(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
ror(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
rol(2, ah);
mov(ah, num);
stdout.put( num, " " );
shr(4, ah);
mov(ah, num);
stdout.put ( num, nl );
//Adding 1 to user's input
inc( value );
stdout.put( value, ":" );
//second row
mov(value, ah);
rol(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
ror(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
rol(2, ah);
mov(ah, num);
stdout.put( num, " " );
shr(4, ah);
mov(ah, num);
stdout.put ( num, nl );
When I input 4 I get
Rolling Table
4:8 2 16 1
5:10 -126 20 1
I tried rol(0,ah) instead of rol(1,ah) and this was my output
4:8 2 16 1
5:10 5 20 1 |
I have imported 1000 sample rows from various tables in a SQL server (lets call it SQLSever1).
I have imported the rows into the second SQL Server(SQLServer2).
When I execute the following query on SQLServer2 I get no results, however when I execute the same query on SQLServer1 I get the expected results.
This is because I haven't imported all the rows from SQLServer1 to SQLServer2.
The problem is that I can't import all the data from SQLServer1 to SQLServer2 because some tables contain over 3 million rows.
Therefore, can someone let me know if there is a way to find out exactly data is required from the tables in SQLServer1 to get a result from SQLServer 2?
Basically, I need to import only those rows into SQL Server 2, that will produce the same result in SQL Server 1.
I believe I would need to do apply somekind of DISTINCT clause or a LEFT / RIGHT JOIN to determine the rows/fiels/data that is present in SQL Server 1 that is not present in SQL Server 2, but I'm not sure.
The tables look like the following:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/zjRrR.png
Sample code is as follows:
CREATE TABLE #tmpTable (
MakeName nvarchar(100),
ModelName nvarchar(150),
Cost money)
INSERT #tmpTable VALUES
(N'Ferrari',N'Testarossa',52000.00),
(N'Ferrari',N'355',176000.00),
(N'Porsche',N'911',15600.00),
(N'Porsche',N'924',9200.00),
(N'Porsche',N'944',15960.00),
(N'Ferrari',N'Testarossa',176000.00),
(N'Aston Martin',N'DB4',23600.00),
(N'Aston Martin',N'DB5',39600.00)
Any thoughts
The code is as follows:
```
SELECT Make.MakeName, Model.ModelName, Stock.Cost
FROM Data.Stock
INNER JOIN Data.Model
ON Model.ModelID = Stock.ModelID
INNER JOIN Data.Make
ON Make.MakeID = Model.MakeID
```
|
I agree with @Gabe that there is a column that is missing `unique: true`
in nestJs entity but I was able to detect which column raising the issue by adding a console log in `node_modules/typeorm/driver/mysql/MysqlQueryRunner.js` in the beginning of `changeColumn` function like
```
console.log(`changeColumn params`,{
tableOrName,
oldColumnOrName,
newColumn
})
```
Then I found which column was logged before the error which make the issue |
I am plotting some lines with Seaborn:
```python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
fig, ax = plt.subplots()
for label, df in dfs.items():
sns.lineplot(
data=df,
x="Time step",
y="Loss",
errorbar="sd",
label=label,
ax=ax,
)
ax.set(xscale='log', yscale='log')
```
The result looks like:
[](https://i.stack.imgur.com/FanHR.png)
Note the clipped negative values in the `effector_final_velocity` curve, since the standard deviation of the loss between runs is larger than its mean, in this case.
However, if `ax.set(xscale='log', yscale='log')` is called *before* the looped calls to `sns.lineplot`, the result looks like this:
[](https://i.stack.imgur.com/JVGG4.png)
I'm not sure where the unclipped values are arising.
Looking at the source of `seaborn.relational`: at the end of `lineplot`, the `plot` method of a `_LinePlotter` instance is called. It plots the error bands by passing the already-computed standard deviation bounds to `ax.fill_between`.
Inspecting the values of these bounds right before they are passed to `ax.fill_between`, the negative values (which would be clipped) are still present. Thus I had assumed that the "unclipping" behaviour must be something matplotlib is doing during the call to `ax.fill_between`, since `_LinePlotter.plot` appears to do no other relevant post-transformations of any data before it returns, and `lineplot` returns immediately.
However, consider a small example that calls `fill_between` where some of the lower bounds are negative:
```python
import numpy as np
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
np.random.seed(5678)
ax.fill_between(
np.arange(10),
np.random.random((10,)) - 0.2,
np.random.random((10,)) + 0.75,
)
ax.hlines(0, 0, 10, color='black', linestyle='--')
ax.set_yscale('log')
```
Then it makes no difference if `ax.set_yscale('log')` is called before `ax.fill_between`; in both cases the result is:
[](https://i.stack.imgur.com/ctRUi.png)
I've spent some time searching for answers about this in the Seaborn and matplotlib documentation, and looked for answers on SA and elsewhere, but I haven't found any information about what is going on here.
|
how to use ldap authentication with permission taken from db without needing password in UserDetails |
|spring|spring-boot|spring-security| |
ultralytics_crop_objects is a list with like 20 numpy.ndarray, which are representing pictures (59, 381, 3) e.g.:[ultralytics_crop_objects[5]](https://i.stack.imgur.com/x6QvJ.png).
I started passing a single picture out of the list to recognize.
pipeline.recognize([ultralytics_crop_objects[5]])
--> ji856931
The result is "ji856931". So not all characters where detected.
But when I pass the entire list of pictures and look at the result for the 6th picture, the result is different. See: [Different Results][1]
results = pipeline.recognize(ultralytics_crop_objects)
results[5] --> ji8569317076
I don't understand it at all. I would be super happy if someone could provide a hint. My only explanation would be that Keras OCR is using a different detection threshold for a single picture than for a list of more than one picture. Could that be the case?
3 out of 20 Pictures having a different result
I have checked multiple times to ensure that I did not accidentally use another pipeline or that the input pictures are different. However, they are the same. I have also done extensive research online.
Heres the complete Code:
import keras_ocr
pipeline = keras_ocr.pipeline.Pipeline()
results = pipeline.recognize([ultralytics_crop_objects[5]])
print(results)
results = pipeline.recognize(ultralytics_crop_objects)
print(results[5])
|
With JS, it's a known problem that `\b` does not work well with strings containing special chars (JS engine believes chars like `ç` are word bondaries).
So I have this code:
"aaa aabb cc ccc abba".replace(/\b((.)\2+)\b|(.)\3+/g,"$1$3");
It correctly returns `aaa ab cc ccc aba`. However, if the input string has special chars, it does not work anymore, for example:
"ááá áább çç ççç ábbá".replace(/\b((.)\2+)\b|(.)\3+/g,"$1$3");
The code above returns `á ább ç ç ábbá` which is not expecetd, it should have been `ááá áb çç ççç ábá`.
So I decided I didnt want to use `\b` anymore because I will only accept word boundaries as ` ` (space) and begginig/end of string (^ or $). So I tried this regex:
"ááá áább çç ççç ábbá".replace(new RegExp("(^| )((.)\\3+)( |$)|(.)\\5+","g"),"$1$2$4$5");
It returned `ááá áb çç ç ábá` which is almost correct, it should have returned `ááá áb çç ççç ábá`.
How can I make the last regex work without using lookheads, lookbehind, lookaround... Is there an easy fix to the last regex? Or, is there a fix to the `\b` that makes `\b` work as expected? |
In the `getJob` function, you can use the [`map`][q] RxJS operator to change the observable value as:
```ts
import { map } from 'rxjs';
getJob(id: string) {
const { apiUrl } = environment;
return this.http.get<Record<string, Job>>(`${apiUrl}/jobs.json?orderBy="job_id"&equalTo="${id}"`)
.pipe(map((resp: Record<string, Job>) => resp["0"] as Job));
}
```
If the key is dynamic, you can get the first value from `Object.values()` function.
```ts
import { map } from 'rxjs';
getJob(id: string) {
const { apiUrl } = environment;
return this.http.get<Record<string, Job>>(`${apiUrl}/jobs.json?orderBy="job_id"&equalTo="${id}"`)
.pipe(map((resp: Record<string, Job>) => Object.values(resp)[0] as Job));
}
```
[1]: https://www.learnrxjs.io/learn-rxjs/operators/transformation/map |
Return empty object when $arrayToObject missing keys upon Mongo aggregation |
|mongodb|aggregation| |
I have a package in SSIS which in a first step executes these two queries:
truncate table mytable;
insert into mytable
select * from myview
Then, a second step read data from view that takes data from mytable in join with other tables, and writes all the data into a csv file.
The job has never given me any problems, in the last three days however the csv file that is written only contains the header row with the name of the fields.
I specify that the job also does not fail, the execution is successful.
The csv file that is written is very bih, about 1.5 gb as I have to upload it to an application that requires the entire data history each time it is loaded so I cannot remove any data by appying a filter before write the file.
Can you help me?
I've tried to change the timeout options of the first step to 300 seconds (it was 0), the exported file is still empty.
[![Timeout Settings][1]][1]
Then I tried to change the contraint option in the connection between the first and the second step
It was "Success" I tried with "Completion". File still empty.
[![Precedence constraint editor][2]][2]
[1]: https://i.stack.imgur.com/U73md.png
[2]: https://i.stack.imgur.com/Pt90Y.png |
you must add text.ads in web.config file on server to can Authorization your web site from google ads my friends .
Example :
<add input="{REQUEST_URI}" pattern="(/ads.txt)" negate="true" /> |
I have been using Azure containers for my project . I'm using different containers for backend app and frontnend. i have created a sidekiq process enclosed in radis cahce server on azure. as i trigger a task to run sidekiq process , sidekiq container is not processing jobs/task |
```
{
"type": "SERVER",
"errorCode": "SEC_DENY",
"message": "Permission denied because of missing FFOCUS in the user attributes"
},
{
"type": "SERVER",
"errorCode": "SEC_DENY",
"message": "Permission denied because of missing ORGFQD in the user attributes"
}
```
when I call the Revalidate Itinerary Rest APi it shows the above exception with the responseStatusCode: 200.
Anyone kindly help me on it. I don't understand the exception properly and if the responseStatusCode is 200 why response giving me this Exception
I have tried by changing the Authorization token but it didn't helped |
Isssue with Revalidate Itinerary Rest Api |
|asp.net|rest|sabre|server-error| |
null |
Check configuration whether SSL is enabled or not. If SSL is not enabled then use http in the url instead of https. |
I have a list of form [[[key1,value1],[key2,value2],...,500],...,n] - aka L2 orderbook data with 500 levels.
I want to translate this list into a dataframe, containing columns key_1,...,key_500 and value_1,...,value_500. - A dataframe that has a price + volume column for each level (e.g. level_1_volume, level_2_volume, ..., level_500_volume)
My current solution is simply looping through the existing dataframe (which simply has this list as a column) with df.iterrows(), extracting the values into separate lists, then creating dataframes using these lists and merging these as columns. Doesn't feel terribly efficient compared to other operations on my data set, is there some way to do this with built-in methods?
List1 = [[key1.1,val1.1],[key2.1,val2.1],...]
List2 = [[key1.2,val1.2],[key2.2,val2.2],...]
key1_column, val1_column, key2_column, val2_column
Row_List1 key1.1 val1.1 key2.1 val2.1
Row_List2 key1.2 val1.2 key2.2 val2.2
Current Solution
["bids"] and ["asks"] simply contain dictionary/Json object of form {key1:value1; key2:value2} for 500 pairs.
# Initialize empty lists for prices and volumes
prices_bids = [[] for _ in range(500)]
volumes_bids = [[] for _ in range(500)]
prices_asks = [[] for _ in range(500)]
volumes_asks = [[] for _ in range(500)]
# Iterate through each row
for index, row in df.iterrows():
attributes = row["bids"]
result_bids = [[key,attributes[key]] for key in sorted(attributes.keys(), reverse=True)]
attributes = row["asks"]
result_asks = [[key,attributes[key]] for key in sorted(attributes.keys(), reverse=False)]
for i in range(500):
prices_bids[i].append(np.float64(result_bids[i][0]))
volumes_bids[i].append(np.float64(result_bids[i][1]))
prices_asks[i].append(np.float64(result_asks[i][0]))
volumes_asks[i].append(np.float64(result_asks[i][1]))
# Create DataFrame from lists
for i in range(500):
# Expressing prices as spreads
df[f"bid_level_{i}_price"] = pd.Series((df["mid_price"]/pd.Series(prices_bids[i],dtype='float64')-1)*10000,dtype="float64")
df[f"bid_level_{i}_volume"] = pd.Series(volumes_bids[i],dtype='float64')
df[f"ask_level_{i}_price"] = pd.Series((df["mid_price"]/pd.Series(prices_asks[i],dtype='float64')-1)*10000,dtype="float64")
df[f"ask_level_{i}_volume"] = pd.Series(volumes_asks[i],dtype='float64')
|
How can i redirect pull request from main branch to another branch |
|git|github|version-control|open-source|pull| |
Here are all product attributes listing:
$product_attributes = get_post_meta( $post->ID, '_product_attributes' );
foreach ( $product_attributes as $group_attributes ) {
foreach ( $group_attributes as $attributes ) {
echo $attributes['name'].'=>'.$attributes['value'];
}
} |
Why docker-compose volume binding didn't work during the build? Should I always COPY necessary for build files? |
You passed a pointer to host memory to `process_bytes`. The WASM module instance gets its entirely separate block of memory, so when it tries to access that pointer, it's a pointer to nowhere. You'll have to copy the byte array to the instance's memory.
Sorry, this is only a sketch of how to do that:
1. You'll somehow have to obtain a valid instance memory pointer on the host. One way of doing that is to export malloc (and call it):
```rust
#[no_mangle]
pub extern "C" fn alloc(len: u32) -> u32 {
let layout = std::alloc::Layout::array::<u8>(len.try_into().unwrap()).unwrap();
unsafe {
(std::alloc::alloc(layout) as usize).try_into().unwrap()
}
}
```
2. Write the data to instance memory:
```
memory.view(&store).write(pointer_from_alloc, &byte_array);
```
3. Call your function:
```
function.call(&mut store, &[Value::I32(pointer_from_allc), Value::I32(byte_array.len() as i32)])
4. Dealloc ;)
Of course, there's other ways of getting valid writable pointers, for example `Memory::grow`, call a host import from wasm with a pointer (that'd be what wasi's `fd_write` does), which can then call `process_bytes`, or just reserving a static array at a specific location.
|
I am trying to add Lottie animation in my view from URL. I am able to load from local asset folder. But When I try to load from URL it is not showing.
This is my code:
String cacheKey ="LOTTIE_CACHE_KEY";
mLottieDrawable = new LottieDrawable();
mLottieDrawable.enableMergePathsForKitKatAndAbove(true);
mLottieDrawable.setCallback(this);
/*LottieResult<LottieComposition> result =
LottieCompositionFactory.fromAssetSync(getContext().getApplicationContext(),
"woman_singer.json");
mLottieDrawable.setComposition(result.getValue());*/
String url = "https://assets5.lottiefiles.com/packages/lf20_GoeyCV7pi2.json";
mLottieDrawable.setComposition(LottieCompositionFactory.fromUrlSync(getContext(), url, cacheKey).getValue());
mLottieDrawable.setRepeatCount(LottieDrawable.INFINITE);
mLottieDrawable.addAnimatorUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
invalidate();
}
});
mLottieDrawable.start(); |
When using `redirect` in a server component you should move it to the `finally` block. Here is how:
```typescript
export default async function Page() {
let redirectPath: string | null = null
try {
//Rest of the code
redirectPath = `/dashboard`
} catch (error) {
//Rest of the code
redirectPath = `/`
} finally {
//Clear resources
if (redirectPath)
redirect(redirectPath)
}
return <>{/*Rest of JSX*/}</>
}
```
From the [redirect documentation](https://nextjs.org/docs/app/building-your-application/routing/redirecting#redirect-function):
> `redirect` internally throws an error so it should be called outside of `try/catch` blocks.
In `api routes` you should use the `NextResponse` from `next/server`. Here is how
```typescript
import { NextRequest, NextResponse } from "next/server";
export function GET(request: NextRequest) {
try {
//Code
return NextResponse.redirect(`<an absolute url>`)
} catch {
//Error handling code
return NextResponse.redirect(`<an absolute url>`)
} finally {
//Clear resources
//No redirect here
}
}
``` |
How are negative errorbar bounds transformed, when log axis scaling is applied before constructing a Seaborn lineplot? |
|matplotlib|seaborn| |
null |
Bom dia pessoal, feliz Páscoa!! Estou fazendo um curso de JavaScript com o Gustavo Guanabara e estou tento problemas no resultado da function em um exercício. Alguém por favor poderia me ajudar a achar o erro? obs: Minha primeira vez aqui na plataforma.
```
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="assets/main.css">
</head>
<body>
<header>
<h1>Verificador de idade</h1>
</header>
<section>
<div>
<p>
Ano de Nascimento:
<input type="number" name="txtano" id="txtano">
</p>
<p>
Sexo:
<input type="radio" name="radsex" id="mas" checked>
<label for="masc">Masculino</label>
<input type="radio" name="radsex" id="fem">
<label for="fem">Feminino</label>
</p>
<p>
<input type="button" value="Verificar" onclick="verificar()">
</p>
</div>
<div id="res"></div>
</section>
<footer>
<p>
© Todos os direitos reservados 2024
</p>
</footer>
<script src="assets/script.js"></script>
</body>
</html>
function verificar() {
let data = new Date()
let anoAtual = data.getFullYear()
let fAno = document.getElementsByName('txtano')
let res = window.document.querySelector('div#res')
if (fAno == 0 || fAno > anoAtual) {
window.alert ('Verifique os dados e tente novamente!')
} else {
let fSex = window.document.getElementsByName( 'radsex' )
let idade = anoAtual - Number(fAno)
res.innerHTML = `Idade calculada: ${idade}`
}
}
```
[enter image description here](https://i.stack.imgur.com/mffd4.png) |
function JavaScript retornando NaN |
|javascript|html| |
null |
{"OriginalQuestionIds":[69367997],"Voters":[{"Id":209103,"DisplayName":"Frank van Puffelen","BindingReason":{"GoldTagBadge":"firebase"}}]} |
I'm currently trying to figure out what the six passcode integers are for this function. Every other example I've looked at, on this site and others, has used a "je" instruction for the first comparison, which allows us to deduce what the first integer input should be, however, the "bomb" that I'm working on seems to be using a "js" after the first comparison. I can't for the life of me figure out what the first input should be, let alone the other 5. Any help or guidance would be much appreciated.
Here is assembly for the phase_2 with my annotations of what I believe is going on:
[![enter image description here][1]][1]
I've been able to figure out that the read_six_numbers function is expecting six integers seperated by a space as input. Though, without the first correct integer input, I can't step through the function enough to examine any register values that might hold the next correct integers that the input is compared against. I'm at a loss.
[1]: https://i.stack.imgur.com/12lNQ.png |
I need to add specific header for all browser interactions during the test run. When I test my application locally I am using "modheader" extension and it solves the problem.
I am using SDK 11. And super easy setup in terms of dependencies:
pom.xml
```xml
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.2</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.16.1</version>
</dependency>
<dependency>
<groupId>com.browserup</groupId>
<artifactId>browserup-proxy-core</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.54.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.54.Final</version>
</dependency>
</dependencies>
```
And the code itself:
```java
public class ProxyTest {
@Test
void test() {
Configuration.baseUrl = "https://stackoverflow.com/";
Configuration.proxyEnabled = true;
open();
BrowserUpProxy proxy = WebDriverRunner.getSelenideProxy().getProxy();
proxy.addHeader("test", "test");
open("https://stackoverflow.com/");
}
}
```
And the output:
```
Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}) on port 23805
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Jun 23, 2023 6:23:31 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
org.openqa.selenium.WebDriverException: unknown error: net::ERR_PROXY_CONNECTION_FAILED
(Session info: chrome=114.0.5735.133)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'XXX', ip: 'fe80:0:0:0:18e1:70ad:16f6:3409%en0', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '13.4', java.version: '11.0.14.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
selenide.url: https://stackoverflow.com/
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 114.0.5735.133, chrome: {chromedriverVersion: 114.0.5735.90 (386bc09e8f4f..., userDataDir: /var/folders/b3/yvg5vgxd0h3...}, goog:chromeOptions: {debuggerAddress: localhost:50711}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(manual, http=..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: https://stackoverflow.com/
Session ID: d3b57891836cdb0338ac1e84aac64df0
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:277)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:857)
at com.codeborne.selenide.drivercommands.Navigator.navigateTo(Navigator.java:72)
at com.codeborne.selenide.drivercommands.Navigator.open(Navigator.java:32)
at com.codeborne.selenide.SelenideDriver.open(SelenideDriver.java:84)
at com.codeborne.selenide.Selenide.open(Selenide.java:49)
at ProxyTest.test(ProxyTest.java:30)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
```
1) what am I doing wrong?
If I turn off the proxy with `Configuration.proxyEnabled = false;` and of course comment out lines related to proxy - I am able to reach the site.
2) Could someone please suggest any other solutions that may help to achieve the goal? |
I'm trying to use Android Native Module on Flutter web(by WASM), and create Android module and imported on flutter app.
It works on Android app but not on browser.
`android/app/src/main/kotlin/com/example/flutter_application_1/MainActivity.kt`
```
package com.example.flutter_application_1
import kotlin.random.Random
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "example.com/channel").setMethodCallHandler {
call, result ->
if(call.method == "getRandomNumber") {
val rand = Random.nextInt(100)
result.success(rand)
}
else {
result.notImplemented()
}
}
}
}
```
`lib/main.dart`
```
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
static const platform = MethodChannel('example.com/channel');
Future<void> _generateRandomNumber() async {
int random;
try {
random = await platform.invokeMethod('getRandomNumber');
} on PlatformException catch (e) {
random = 0;
}
setState(() {
_counter = random;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Kotlin generates the following number:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineLarge,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _generateRandomNumber,
tooltip: 'Generate',
child: const Icon(Icons.refresh),
),
);
}
}
```
On Browser, this error continuously occured, but not on mobile(on Android, but not tested on iOS)
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/oKwXp.png
I wonder that flutter WASM not yet supports the Native module importing.
|
Is the flutter wasm support native module import? |
|android|flutter|webassembly| |
PROGRAM 4: Rolling Table
Using the ROL and ROR instructions, write a program to produce a rolling table. This table should be built from a single int8 value provided by the user and print 3 rows from the starting value, each offset by one from the starting value. In each individual row, the entered number should be ROL'ed and then ROR'ed and then ROL'ed and then ROR'ed, as shown below. For example, the following output should be produced when the user inputs the starting value 4:
Gimme a starting value: 4
Rolling Table
4: 8 2 16 1
5: 10 2 20 1
6: 12 3 24 1
This is my current code
program RollingTable;
#include ("stdlib.hhf" );
//Declaring Variables
static
value: int8;
num: int8;
begin RollingTable;
//Getting user's input
stdout.put( "Enter an integer value: ");
stdin.get( value );
stdout.put( "Rolling Table",nl);
//first row
stdout.put( value, ":" );
mov(value, ah);
rol(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
ror(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
rol(2, ah);
mov(ah, num);
stdout.put( num, " " );
shr(4, ah);
mov(ah, num);
stdout.put ( num, nl );
//Adding 1 to user's input
inc( value );
stdout.put( value, ":" );
//second row
mov(value, ah);
rol(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
ror(1, ah);
mov(ah, num);
stdout.put( num, " " );
mov(value, ah);
rol(2, ah);
mov(ah, num);
stdout.put( num, " " );
shr(4, ah);
mov(ah, num);
stdout.put ( num, nl );
When I input 4 I get
Rolling Table
4: 8 2 16 1
5:10 -126 20 1
I tried rol(0,ah) instead of rol(1,ah) and this was my output
4:8 2 16 1
5:10 5 20 1 |
I couldn't figure out why function does not work for a second time in Kivy |
|python|kivy|widget|kivy-language| |
null |
### Summary
There is a difference between `any` in type parameter and `any` in regular function parameter. Your case is the former one for generics. So you need to instantiate `T` first when assigning the concrete variables to it.
Ref. https://stackoverflow.com/questions/71628061/difference-between-any-interface-as-constraint-vs-type-of-argument
### In detail
It's because in `GetAllProducts`, type `T` is not decided yet. So it is impossible to assign `[]models.Products` to `T`.
```golang
func (db *DbConnection[T]) GetAllProducts() {
var re []models.Products
re, _ = db.GetAll()
}
```
But you can assign `models.Products` to `T` if `T` is decided as `models.Products`, like this.
```golang
db := DbConnection[models.Products]{}
var re []models.Products
re, _ = db.GetAll()
```
I reproduce your problem in the simplified version(https://go.dev/play/p/GHkDThFLOKG). You can find the same error `GetAllProducts()` but in the main code, it works. |
{"Voters":[{"Id":2395282,"DisplayName":"vimuth"},{"Id":11182,"DisplayName":"Lex Li"},{"Id":354577,"DisplayName":"Chris"}]} |
You can simulate a pipe function as follows *:
```cpp
=LET(
PIPE,LAMBDA(Functions,Initial,
LET(plusOne,LAMBDA(n,n+1),
multTwo,LAMBDA(n,n*2),
fxNames,{"plusOne";"multTwo"},
CHOOSER_,LAMBDA(name,CHOOSE(XMATCH(name,fxNames),plusOne,multTwo)),
REDUCE(Initial,Functions,LAMBDA(prev,cur,CHOOSER_(cur)(prev))))),
PIPE({"plusOne","multTwo"},2)
)
```
[![enter image description here][1]][1]
We are essentially using the [`REDUCE`](https://support.google.com/docs/answer/12568597?hl=en) function with an array of current values that is an array of functions and calling them in the [LAMBDA parameter](https://support.google.com/docs/answer/12568597?hl=en#:~:text=Notes,the%20named%20function.) with:
```cpp
CHOOSER_(cur)(prev)
```
Where `CHOOSER_` is a custom function that selects the function of interest by running [`XMATCH`](https://support.google.com/docs/answer/12406049?hl=en) to pick the index of the function in `fxNames` and [`CHOOSE`](https://support.google.com/docs/answer/3093371?hl=en) to pick the actual function.
<hr>
<sup><i>*Credit for this method goes to Shay</i></sup>
[1]: https://i.stack.imgur.com/kXmsb.png |
I'm having the below shell script which works fine(generates file with timestamp) when I execute it from linux. But generate file touch command is not working when I execute it from jenkins pipeline.
echo "Generating file"
touch "genfile_$(date +"%Y_%m_%d_%I_%M_%p")"
echo "end of file..."
Pipeline script
---------------
pipeline {
agent any
stages {
stage('Hello') {
steps {
sh '/dir/Jenkins/genfile.sh'
}
}
}
}
I only see echo commands output in Jenkins console(Generating file and end of file). But in the backend touch command is not working though the script executed. |
Shellscript touch command not working in jenkins pipeline |
null |
*("if I were to do several thousand lines arrays")*
The data structure for this is a [Trie][1] (Prefix Tree): A tree-like data structure used to store a dynamic set of strings where each node represents a single character.
* Time Efficiency: Search, Insertion & Deletion: With a time-complexity of **O(m)** where m is the length of the string.
* Space Efficiency: Store the unique characters present in the strings. This can be a space advantage compared to storing the entire strings.
--
Trie Visualization for your input (Green nodes are marked: endOfString):
[![enter image description here][3]][3]
--
PHP implementation:
```php
<?php
class TrieNode
{
public $childNode = []; // Associative array to store child nodes
public $endOfString = false; // Flag to indicate end of a string
}
class Trie
{
private $root;
public function __construct()
{
$this->root = new TrieNode();
}
public function insert($string)
{
if (!empty($string)) {
$this->insertRecursive($this->root, $string);
}
}
private function insertRecursive(&$node, $string)
{
if (empty($string)) {
$node->endOfString = true;
return;
}
$firstChar = $string[0];
$remainingString = substr($string, 1);
if (!isset($node->childNode[$firstChar])) {
$node->childNode[$firstChar] = new TrieNode();
}
$this->insertRecursive($node->childNode[$firstChar], $remainingString);
}
public function commonPrefix()
{
$commonPrefix = '';
$this->commonPrefixRecursive($this->root, $commonPrefix);
return $commonPrefix;
}
private function commonPrefixRecursive($node, &$commonPrefix)
{
if (count($node->childNode) !== 1 || $node->endOfString) {
return;
}
$firstChar = array_key_first($node->childNode);
$commonPrefix .= $firstChar;
$this->commonPrefixRecursive($node->childNode[$firstChar], $commonPrefix);
}
}
// Example usage
$trie = new Trie();
$trie->insert("Softball - Counties");
$trie->insert("Softball - Eastern");
$trie->insert("Softball - North Harbour");
$trie->insert("Softball - South");
$trie->insert("Softball - Western");
echo "Common prefix: " . $trie->commonPrefix() . PHP_EOL;
?>
```
Output:
Common prefix: Softball -
[Demo][2]
[1]: https://en.wikipedia.org/wiki/Trie
[2]: https://onecompiler.com/php/428w3k8pe
[3]: https://i.stack.imgur.com/aY2XN.png |
I have a table in which I want to show the names of columns which contain unique values and aren't null. In other words I want to display the candidate keys from the table. Note that while creating the table, the UNIQUE or NOT NULL constraint may or may not have been provided for the required columns.
My thought process was to somehow check if `COUNT(DISTINCT columnn_name) = COUNT(*)' for every column in the table, and print the column names for which the condition is true. But I don't know how to write this in a query.
Any help is appreciated, thanks! |
How to display the column names which have only unique non-null values in MySQL table? |
|mysql| |
{"Voters":[{"Id":37231,"DisplayName":"jdigital"},{"Id":7635569,"DisplayName":"JGH"},{"Id":9214357,"DisplayName":"Zephyr"}],"SiteSpecificCloseReasonIds":[18]} |
There is no such thing as a "normal shell". You have "interactive shells" and "non-interactive shells", which differ, among other things, by what `*rc` file they source at startup and by *whether aliases are expanded or not*. And there are other types, even.
By default Vim uses a *non-interactive shell* for `:!` and `$ man bash` as the following to say about aliases in non-interactive shells:
> Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt (see the description of shopt under SHELL BUILTIN COMMANDS below).
Now, you *could* try to play with `shopt` or try to convince Vim to use an interactive shell with `:help 'shellcmdflag'` but these don't sound like solutions to me.
The only proper solution, IMO, is to turn your aliases into actual shell scripts, somewhere in your `$PATH`, where they will be accessible to all kinds of shells. |
This is more a hint than a question:
The goal is to parse a command line **AND** create a useful *usage* message
code:
for arg ; do
case "${1:-}" in
--edit) # edit file
cd "$(dirname $0)" && exec $0;;
--noN) # do NOT create 'NHI1/../tags'
let noN=1;;
--noS) # do NOT create 'HOME/src/*-latest/tags'
let noS=1;;
--help) # write this help message
;&
*) echo -e "usage: $(basename $0) options...\n$(awk '/--?\w+\)/' "$0")" && exit ;;
esac
done
this create the *usage* message:
> build_tags.bash -x
usage: build_tags.bash options...
--edit) # edit file
--noN) # do NOT create 'NHI1/../tags'
--noS) # do NOT create 'HOME/src/*-latest/tags'
--help) # write this help message
the clue is that the *definition* of the *case* target is also the *documentation* of the *case* target.
|
In my development I have a tag system that closely matches the one SO has. And it also allows non-Latin characters.
* User can enter new tag and it is saved to the DB.
* Existing tags are shown to the user when they type tag prefix. Fetch API is used for this.
I'm using Razor pages. At what point and how should I sanitize/encode strings in this flow? |
When sanitize/encode while implementing tags system like on SO |
|security|encoding|fetch-api|razor-pages|sanitization| |
I've set up a basic player.
It works when I place only one instance of it in a scene. I need two instances due to local multiplayer.
However, once I place two instances of it in a scene, it just moves out of my vision.
By observing where it's positioned using a basic print function, it starts moving in random directions crazily super fast for a few seconds, and then it's movement becomes normal.
Here's my code for it.
```gdscript
extends CharacterBody2D
@export var speed = 100
@export var dash_speed = 300
@export var prefix = ''
var dashing = false
@export var texture: Texture2D:
set(v):
$Sprite2D.set_texture(v)
func _ready():
$CPUParticles2D.emitting = false
func get_input():
var input_direction = Input.get_vector(prefix + "left", prefix + "right", prefix + "up", prefix + "down")
velocity = input_direction * speed
if Input.is_action_pressed(prefix + "dash-jump"):
velocity += input_direction * dash_speed
dashing = true
func _physics_process(_delta):
get_input()
if dashing:
$CPUParticles2D.process_material.gravity = Vector3(-velocity.x, -velocity.y, 0) / 2
$CPUParticles2D.restart()
move_and_slide()
dashing = false
```
I don't know if the problem's in move_and_slide or something else. Don't mind the particles, and the input prefix is so the second player can use different input actions from the first one and be independent.
By the way, the texture variable exists so I can easily change it from Inspector, in case I wanna have a different sprite for player 2. |
I am building a restaurant recommender system, and I think the model is not loaded correctly. So everytime the reomm. system giving the output "Restaurant not found. Please enter a valid restaurant name." on entering the restaurant name.
Anyone can help into this.
Highly appreciated
Trying to get an output , but the system giving "Restaurant not found. Please enter a valid restaurant name." |
Issue in loading model in recommender system using streamlit |
|nltk|streamlit|recommendation-engine| |
null |
I have many functions which share the same structure and base signature:
```python
async def get_stuff_from_external_api(*, client: Client | None, id: int) -> Ressource:
if not client:
client = make_client()
return Ressource(await client.get(id))
```
To DRY my code I extracted this logic into a decorator, both the decorator and the functions now being:
```python
def external_api_decorator(func):
@functools.wraps(func)
def wrapped_func(*args, **kwargs):
client = kwargs.pop(client, None)
if not client:
client = make_client()
return await func(*args, client=client, **kwargs)
return inner
@external_api_decorator
async def get_stuff_from_external_api(*, client: Client, id: int) -> Ressource:
return Ressource(await client.get(id))
```
My problem is now that I can't properly type `external_api_decorator` to keep both decorated functions initial parameters (`id` in my example) and returned value (`Ressource` in my example).
I have tried many solutions (`Protocol`, `Generic`, `ParamSpec`, ...) but I think I'm stuck on `Concatenate`/`ParamSpec` not supporting keyword arguments. Am I missing something? It looks like a super classic use-case.
Here is [a mypy playground to reproduce][1].
[1]: https://mypy-play.net/?mypy=latest&python=3.12&gist=ba14f71f92e6cd6a807edfe6af8aafb9 |
I need to improve general heap sort using C# multithreading.
I don't have clear idea about implementation of improvements.
One of the suggestions which I got is to separate array for N part and heapsort each part in specific thread.
And after merge each part of array.
In this case I think it will not be so efficient cause of merging in general stream after using heapsort.
Can you suggest other ideas?
Or maybe if it will be not efficient, do you have any ideas how i can use multithreading in the other way in heap sort, than i wrote. |
I used data binding to connect the UI, but when I rebuild the project, I get this error:
```
error: cannot find symbol
View root = inflater.inflate(R.layout.toolbar, parent, false);
^
symbol: variable toolbar
location: class layout
```
ToolbarBinding.java (generated file) :
```
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
android:fitsSystemWindows="true"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
tools:ignore="MissingPrefix">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_weight="0.9">
<ImageView
android:id="@+id/btn_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_chevron_left"
android:paddingBottom="10dp"
android:clickable="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingTop="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<TextView
android:id="@+id/txt_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Edit Profile"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="18sp"
fontPath="fonts/Proxima_Nova_Bold.otf"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:layout_weight="1">
<TextView
android:id="@+id/btn_save"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:clickable="true"
android:text="Save"
android:background="?attr/selectableItemBackgroundBorderless"
android:textColor="@color/white"
android:textSize="16sp"
fontPath="fonts/Proxima_Nova_Regular.otf"/>
</LinearLayout>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
```
toolbar.xml :
```
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
android:fitsSystemWindows="true"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
tools:ignore="MissingPrefix">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_weight="0.9">
<ImageView
android:id="@+id/btn_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_chevron_left"
android:paddingBottom="10dp"
android:clickable="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingTop="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<TextView
android:id="@+id/txt_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Edit Profile"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="18sp"
fontPath="fonts/Proxima_Nova_Bold.otf"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:layout_weight="1">
<TextView
android:id="@+id/btn_save"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:clickable="true"
android:text="Save"
android:background="?attr/selectableItemBackgroundBorderless"
android:textColor="@color/white"
android:textSize="16sp"
fontPath="fonts/Proxima_Nova_Regular.otf"/>
</LinearLayout>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
```
This error only occurs in toolbar.xml, I don't know why, please help me solve this error
Notes (just in case if you need it) :
i used Android studio Koala 2023.3.2 Canary 2 |
error: cannot find symbol View root = inflater.inflate(R.layout.toolbar, parent, false); |
|android|xml|android-layout|android-databinding| |
null |
use this code, tested its working
OutlinedTextField(
value ="hello",
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
onValueChange = {"ssss"},
placeholder = { Text("Username") },
leadingIcon = {
Image(painter = painterResource(id = R.drawable.ic_settings_black_24dp), contentDescription = null)
},
colors = TextFieldDefaults.colors(
focusedPlaceholderColor = Color.Red,
unfocusedTextColor = Color.Green
)
) |
|cicd| |
null |
_Microsoft documentation:_
> [Range.Collapse method (Word)](https://learn.microsoft.com/en-us/office/vba/api/word.range.collapse?WT.mc_id=M365-MVP-33461&f1url=%3FappId%3DDev11IDEF1%26l%3Den-US%26k%3Dk(vbawd10.chm157155429)%3Bk(TargetFrameworkMoniker-Office.Version%3Dv16)%26rd%3Dtrue)
> [Selection.TypeText method (Word)](https://learn.microsoft.com/en-us/office/vba/api/word.selection.typetext?WT.mc_id=M365-MVP-33461&f1url=%3FappId%3DDev11IDEF1%26l%3Den-US%26k%3Dk(vbawd10.chm158663163)%3Bk(TargetFrameworkMoniker-Office.Version%3Dv16)%26rd%3Dtrue)
> [Selection object (Word)](https://learn.microsoft.com/en-us/office/vba/api/word.selection?WT.mc_id=M365-MVP-33461&f1url=%3FappId%3DDev11IDEF1%26l%3Den-US%26k%3Dk(vbawd10.chm2421)%3Bk(TargetFrameworkMoniker-Office.Version%3Dv16)%26rd%3Dtrue)
```vb
Set wdDoc = wdApp.Documents.Add
Const wdCollapseEnd = 0
With wdApp.Selection
.Font.Bold = True
.Typetext "Severity: "
.Collapse wdCollapseEnd
.Font.Bold = False
.Typetext Sheets("CleanSheet").Cells(2, 2).Value & vbCr
End With
```
---
- If you prefer to use `.Content`
```vb
Set wdDoc = wdApp.Documents.Add
Set WordRange = wdDoc.Content
With WordRange
.Font.Bold = False
.Text = "Severity: "
iEnd = .End
.InsertAfter Sheets("CleanSheet").Cells(2, 2).Value & vbCr
wdDoc.Range(0, iEnd - 1).Font.Bold = True
End With
``` |
I am in desperate need of help with an issue that i'm facing while updating my system with the "yum update" command. My server is CentOS 7 converted to CloudLinux 7. I've been trying to find a solution for days, but no success as of now. Due to this error, I am unable to install "alt-php" versions too. I don't have the "yum update --nobest" option, I presume it isn't available on CentOS 7/Cloudlinux 7. I will highly appreciate any help!
Here's the complete error log:
```
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mysql8.0
Error: alt-python27-cllib conflicts with lve-stats-3.0.7-2.el7.noarch
Error: Package: alt-php73-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php82-8.2.17-1.el7.x86_64 (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-54
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php51-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php51-mariadb1011
Error: Package: alt-php53-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php53-mariadb1011
Error: Package: alt-php73-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php73-mariadb1011
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mysql5.1
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mysql5.0
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mysql5.7
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mysql5.6
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mysql5.5
Error: Package: lve-utils-6.6.2-1.el7.cloudlinux.x86_64 (cloudlinux-updates-testing)
Requires: alt-pylve >= 2.1-15
Available: alt-pylve-1.5-16.el7.cloudlinux.x86_64 (cloudlinux-base)
alt-pylve = 1.5-16.el7.cloudlinux
Available: alt-pylve-2.0-4.el7.cloudlinux.x86_64 (cl7h)
alt-pylve = 2.0-4.el7.cloudlinux
Available: alt-pylve-2.0-4.el7h.cloudlinux.x86_64 (cl7h)
alt-pylve = 2.0-4.el7h.cloudlinux
Available: alt-pylve-2.1-8.el7.cloudlinux.x86_64 (cl7h)
alt-pylve = 2.1-8.el7.cloudlinux
Available: alt-pylve-2.1-8.el7h.cloudlinux.x86_64 (cl7h)
alt-pylve = 2.1-8.el7h.cloudlinux
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mysql8.0
Error: Package: alt-php56-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb1011
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb10
Error: lve-utils conflicts with lve-stats-3.0.7-2.el7.noarch
Error: Package: alt-php72-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php72-mariadb1011-zts
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mysql5.1
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mysql5.0
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mysql5.7
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mysql5.6
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mysql5.5
Error: Package: alt-php82-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb1011
Error: Package: alt-ruby25-rubygem-rack-3.0.8-2.el7.x86_64 (cloudlinux-updates-testing)
Requires: alt-ruby25-rubygem-rackup
Error: Package: alt-php-xray-0.6-21.el7.x86_64 (cloudlinux-updates-testing)
Requires: lvemanager-xray
Error: cagefs conflicts with lve-stats-3.0.7-2.el7.noarch
Error: Package: alt-python27-cllib-3.4.0-1.el7.cloudlinux.x86_64 (cloudlinux-updates-testing)
Requires: liblve >= 2.1-15
Available: liblve-1.5-16.el7.cloudlinux.x86_64 (cloudlinux-base)
liblve = 1.5-16.el7.cloudlinux
Available: liblve-2.0-4.el7.cloudlinux.x86_64 (cl7h)
liblve = 2.0-4.el7.cloudlinux
Available: liblve-2.0-4.el7h.cloudlinux.x86_64 (cl7h)
liblve = 2.0-4.el7h.cloudlinux
Available: liblve-2.1-8.el7.cloudlinux.x86_64 (cl7h)
liblve = 2.1-8.el7.cloudlinux
Installing: liblve-2.1-8.el7h.cloudlinux.x86_64 (cl7h)
liblve = 2.1-8.el7h.cloudlinux
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mysql5.7
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mysql5.6
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mysql5.5
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mysql5.1
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mysql5.0
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-percona5.7
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-percona5.6
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-percona5.5
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: lvemanager-7.11.0-1.el7.cloudlinux.noarch (cloudlinux-updates-testing)
Requires: lve-stats >= 4.2.0-1
Installing: lve-stats-3.0.7-2.el7.noarch (cloudlinux-base)
lve-stats = 3.0.7-2.el7
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb10
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb104
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb106
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb101
Error: lvemanager conflicts with lve-stats-3.0.7-2.el7.noarch
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb103
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb102
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb10
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb101
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb103
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb102
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb105
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb104
Error: Package: alt-php51-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-mariadb106
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-percona5.7
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-percona5.6
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-percona5.5
Error: Package: lve-utils-6.6.2-1.el7.cloudlinux.x86_64 (cloudlinux-updates-testing)
Requires: liblve >= 2.1-15
Available: liblve-1.5-16.el7.cloudlinux.x86_64 (cloudlinux-base)
liblve = 1.5-16.el7.cloudlinux
Available: liblve-2.0-4.el7.cloudlinux.x86_64 (cl7h)
liblve = 2.0-4.el7.cloudlinux
Available: liblve-2.0-4.el7h.cloudlinux.x86_64 (cl7h)
liblve = 2.0-4.el7h.cloudlinux
Available: liblve-2.1-8.el7.cloudlinux.x86_64 (cl7h)
liblve = 2.1-8.el7.cloudlinux
Installing: liblve-2.1-8.el7h.cloudlinux.x86_64 (cl7h)
liblve = 2.1-8.el7h.cloudlinux
Error: Package: alt-php55-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: lve-utils-6.6.2-1.el7.cloudlinux.x86_64 (cloudlinux-updates-testing)
Requires: lve >= 2.1-15
Available: lve-1.5-16.el7.cloudlinux.x86_64 (cloudlinux-base)
lve = 1.5-16.el7.cloudlinux
Available: lve-2.0-4.el7.cloudlinux.x86_64 (cl7h)
lve = 2.0-4.el7.cloudlinux
Available: lve-2.0-4.el7h.cloudlinux.x86_64 (cl7h)
lve = 2.0-4.el7h.cloudlinux
Available: lve-2.1-8.el7.cloudlinux.x86_64 (cl7h)
lve = 2.1-8.el7.cloudlinux
Installing: lve-2.1-8.el7h.cloudlinux.x86_64 (cl7h)
lve = 2.1-8.el7h.cloudlinux
Error: Package: alt-php53-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb105
Error: Package: alt-php72-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php55-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php55-mariadb1011
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb105
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php56-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php56-mariadb1011
Error: Package: alt-php71-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php71-mariadb1011
Error: Package: cagefs-7.6.9-1.el7.cloudlinux.x86_64 (cloudlinux-updates-testing)
Requires: liblve >= 2.1-15
Available: liblve-1.5-16.el7.cloudlinux.x86_64 (cloudlinux-base)
liblve = 1.5-16.el7.cloudlinux
Available: liblve-2.0-4.el7.cloudlinux.x86_64 (cl7h)
liblve = 2.0-4.el7.cloudlinux
Available: liblve-2.0-4.el7h.cloudlinux.x86_64 (cl7h)
liblve = 2.0-4.el7h.cloudlinux
Available: liblve-2.1-8.el7.cloudlinux.x86_64 (cl7h)
liblve = 2.1-8.el7.cloudlinux
Installing: liblve-2.1-8.el7h.cloudlinux.x86_64 (cl7h)
liblve = 2.1-8.el7h.cloudlinux
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-percona5.7
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-percona5.6
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php80-percona5.5
Error: Package: alt-php70-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php54-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mariadb1011
Error: Package: alt-php54-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php54-mariadb1011
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb104
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb106
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb101
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb103
Error: Package: alt-php81-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php81-mariadb102
Error: Package: alt-php52-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php52-mariadb1011
Error: Package: alt-php52-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: dracut-squash-049-191.git20210920.el7h.cloudlinux.1.x86_64 (cl7h)
Requires: squashfs-tools
Error: Package: alt-php72-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php72-mariadb1011
Error: Package: alt-ruby26-rubygem-rack-3.0.8-2.el7.x86_64 (cloudlinux-updates-testing)
Requires: alt-ruby26-rubygem-rackup
Error: Package: alt-php70-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php70-mariadb1011
Error: Package: alt-php80-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
Error: Package: alt-php74-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php74-mysql8.0
Error: Package: alt-php71-mysql-meta-3-10.el7.noarch (cloudlinux-updates-testing)
Requires: alt-php-config >= 1-52
Available: alt-php-config-1-29.1.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-29.1.el7
Available: alt-php-config-1-33.el7.noarch (cloudlinux-imunify360)
alt-php-config = 1-33.el7
Available: alt-php-config-1-38.el7.noarch (cl-ea4)
alt-php-config = 1-38.el7
Available: alt-php-config-1-39.el7.noarch (cloudlinux-base)
alt-php-config = 1-39.el7
You could try using --skip-broken to work around the problem
** Found 23 pre-existing rpmdb problem(s), 'yum check' output follows:
alt-python27-cllib-3.2.49-1.el7.cloudlinux.x86_64 has missing requires of liblve >= ('0', '2.1', '14')
cagefs-7.5.6-1.el7.cloudlinux.x86_64 has missing requires of cagefs-lve = ('0', '1.27', None)
cagefs-7.5.6-1.el7.cloudlinux.x86_64 has missing requires of liblve >= ('0', '2.1', '12')
cagefs-7.5.6-1.el7.cloudlinux.x86_64 has missing requires of libsecureio.so.0
criu-lve-3.13-6.el7.x86_64 has missing requires of liblve.so.0()(64bit)
criu-lve-3.13-6.el7.x86_64 has missing requires of liblve.so.0(LVE_1_5)(64bit)
governor-mysql-1.2-92.el7.cloudlinux.x86_64 has missing requires of lve-stats >= ('0', '0.9', '27')
liblve-devel-2.1-14.el7.cloudlinux.x86_64 has missing requires of liblve = ('0', '2.1', '14.el7.cloudlinux')
liblve-devel-2.1-14.el7.cloudlinux.x86_64 has missing requires of liblve.so.0()(64bit)
liblve-devel-2.1-14.el7.cloudlinux.x86_64 has missing requires of libsecureio.so.0()(64bit)
lve-utils-6.4.13-1.el7.cloudlinux.x86_64 has missing requires of lve >= ('0', '0.8', None)
lve-utils-6.4.13-1.el7.cloudlinux.x86_64 has missing requires of liblve >= ('0', '2.1', '12')
lve-utils-6.4.13-1.el7.cloudlinux.x86_64 has missing requires of alt-pylve
lve-wrappers-0.7.9-1.el7.cloudlinux.x86_64 has missing requires of cagefs-lve >= ('0', '0.1', None)
lve-wrappers-0.7.9-1.el7.cloudlinux.x86_64 has missing requires of liblve >= ('0', '2.1', '12')
lve-wrappers-0.7.9-1.el7.cloudlinux.x86_64 has missing requires of liblve.so.0()(64bit)
lve-wrappers-0.7.9-1.el7.cloudlinux.x86_64 has missing requires of liblve.so.0(LVE_1_5)(64bit)
lve-wrappers-0.7.9-1.el7.cloudlinux.x86_64 has missing requires of libsecureio.so.0()(64bit)
lvemanager-7.9.1-1.el7.cloudlinux.noarch has missing requires of lve-stats >= ('0', '4.1.4', '1')
pam_lve-0.4-3.el7.cloudlinux.x86_64 has missing requires of cagefs-lve >= ('0', '0.1', None)
pam_lve-0.4-3.el7.cloudlinux.x86_64 has missing requires of liblve.so.0()(64bit)
pam_lve-0.4-3.el7.cloudlinux.x86_64 has missing requires of liblve.so.0(LVE_1_5)(64bit)
pam_lve-0.4-3.el7.cloudlinux.x86_64 has missing requires of libsecureio.so.0()(64bit)
```
I searched through all the sources that had fixes to similar issues, but none of them worked for me. The best solution that I could encounter was the use of "yum update --nobest" command; however, it doesn't work on my server with CentOS 7 installed.
I couldn't find any solution hat worked |
Facing fatal errors while running "yum update" command on CentOS 7/Cloudlinux 7 |
|linux|server|linux-kernel|centos|yum| |
null |
So my issue is a bit weird, and I'm hoping I can get some help with it.
In the game I'm porting, it uses a boolean array to determine whether a tile is illuminated.
In the original source code, the game would apply a dithered pattern over areas that aren't illuminated/are out of the player's view:
[Old light system](https://i.stack.imgur.com/elRaw.jpg)
What I originally wanted to do was send the boolean array directly to the shader, but upon learning this wouldn't be easily manageable, I figured I'd take another approach, which would be to convert the light values to a pair of integers via the following function:
```
public void rebuildLightmap() {
boolean[] storage = new boolean[64];
for(int z=0;z<SIZE;z++) {
for(int x=0;x<SIZE;x++) {
storage[z*SIZE+x]=this.dungeonFloor.isLit(x+(xPos * SIZE), z+(zPos * SIZE));
}
}
for(int i=0;i<2;i++) {
lightMap[i]=0;
int len = 31;
for(int j=0;j<32;j++) {
if(storage[i * 32+j]) {
lightMap[i] += 1<<len--;
}
}
}
}
```
From there, I was planning on sending the lightmap integers to the shader as a pair of ints, then use bitwise operations to check the relevant bits and shade the tile accordingly.
However, when I tried compiling the shader, it told me that the '&' operand was undefined for integers in glsl, which goes against some examples I've seen on shadertoy and discussed by other people in the OpenGL community.
My question is how do I perform bitwise AND operations in GLSL shaders? I'm using Version 400 Core, if it helps.
As some additional info, I'm using a chunk-based system for rendering the tiles, where the map is broken up into 8x8 tile sections and loaded into a frame buffer, like so:
[Chunk](https://i.stack.imgur.com/DiZNF.jpg)
My main attempt was to build a lightmap out of a pair of integers, then pass the integers to GLSL, where I attempted to do the following:
1. Figure out the "index" of the tile in the lightmaps through the equations (z*4+x).
2. Bitshift the relevant lightmap by the index.
3. Apply the Bitwise AND operation to this new value. This is where the issue arises, because GLSL throws an error with my usage of '&', claiming that the operand is unassigned. |
null |
{"Voters":[{"Id":3776858,"DisplayName":"Cyrus"},{"Id":213269,"DisplayName":"Jonas"},{"Id":10971581,"DisplayName":"jhnc"}],"SiteSpecificCloseReasonIds":[18]} |
I have a requirement for Android app development using Pega DX APIs. I have gone through the Pega documentation, but I'm not entirely sure about the feasibility of implementing it in Android using the Pega DX APIs. I am using XML layout for the design, not Jetpack Compose. When I searched the Pega website, I found sample SDKs for iOS, but no SDK samples were provided for Android. If anyone has any insight into implementing Pega APIs in an Android app, it would be very helpful.
Any source for the Android app implemetated using Pega DX API would be deeply appreciated.
Thanks in advance. |
Implementation of Pega DX API in Android |
|android|kotlin|pega|fiware-pegasus| |
null |
I'm working on a Unity project where I need to draw on each face of a cube independently. However, when I draw on one face, the changes are reflected on all six faces of the cube simultaneously.
I've implemented a drawing functionality using a Drawer script. This script manages drawing points between the mouse clicks and interpolates them to create smooth lines. However, it seems that the interpolation logic is causing the drawn lines to appear on all faces of the cube.
[![enter image description here][1]][1]
Here's the relevant part of my Drawer script:
// Relevant code snippet from the Drawer script
private void SetPixelsBetweenDrawPoints()
{
while (drawPoints.Count > 1)
{
Vector2Int startPos = drawPoints.Dequeue();
Vector2Int endPos = drawPoints.Peek();
InterpolateDrawPositions(startPos, endPos);
}
}
IEnumerator DrawToCanvas()
{
while(true)
{
SetPixelsBetweenDrawPoints();
yield return new WaitForSeconds(drawInterval);
}
}
void InterpolateDrawPositions(Vector2Int startPos, Vector2Int endPos)
{
int dx = endPos.x - startPos.x;
int dy = endPos.y - startPos.y;
float xinc, yinc, x, y;
int steps = (Math.Abs(dx) > Math.Abs(dy)) ? Math.Abs(dx) : Math.Abs(dy);
xinc = ((float)dx / steps) * interpolationPixelCount;
yinc = ((float)dy / steps) * interpolationPixelCount;
x = startPos.x;
y = startPos.y;
for(int k=0; k < steps; k += interpolationPixelCount)
{
canvasDrawOrEraseAt((int)Math.Round(x), (int)Math.Round(y));
x += xinc;
y += yinc;
}
canvasDrawOrEraseAt(endPos.x, endPos.y);
}
void AddDrawPositions(Vector2Int newDrawPos)
{
drawPoints.Enqueue(newDrawPos);
}
I want to modify this script so that when I draw on one face of the cube, the changes are confined to that specific face only. How can I achieve this? Should I modify the interpolation logic or is there a better approach to handle drawing on individual faces of a cube?
Any insights or suggestions would be greatly appreciated. Thank you!
[1]: https://i.stack.imgur.com/tzn13.png |
{"Voters":[{"Id":472495,"DisplayName":"halfer"},{"Id":839601,"DisplayName":"gnat"},{"Id":794749,"DisplayName":"gre_gor"}],"SiteSpecificCloseReasonIds":[13]} |
Godot 4 CharacterBody2D movement goes haywire on multiple instances |
|godot|gdscript|godot4| |
The following code is using Selenium library. The problem is the trace command never gets printed given that it should be printed n times until the element becomes visible.
```cs
WebDriverWait wait = new WebDriverWait(new SystemClock(), driver, TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(500));
driver.Navigate().GoToUrl("test.com");
// Thread.Sleep(1000);
wait.Until(_ =>
{
Trace.WriteLine("aa");
return ExpectedConditions.ElementIsVisible(By.XPath("//button[@data-a-target='change-country-button']"));
});
```
When I activate the commented line it works (most of the time).
|
I'm building a Node.js chatbot using the @google/generative-ai library. I'm encountering an error when handling the chat history between the user and the model.
Here's a breakdown of the problem:
- First Query Success: The initial user query works fine, likely because the history sent to the model is empty.
- Second Query Error: Subsequent user queries result in the following error:
GoogleGenerativeAIError: [GoogleGenerativeAI Error]: Content should have 'parts' property with an array of Parts
This suggests the model expects a specific format for the history object, which might not be being sent correctly.
Relevant Code Snippets:
App.js (Client-side):
```
const getResponse = async () => {
if (!value) {
setError("Please enter something!");
return;
}
try {
const options = {
method: "POST",
body: JSON.stringify({
history: chatHistory,
message: value,
}),
headers: {
"Content-Type": "application/json",
},
};
const response = await fetch("http://localhost:8000/gemini", options);
const data = await response.text();
console.log(data);
setChatHistory((oldChatHistory) => [
...oldChatHistory,
{
role: "user",
parts: value,
},
{
role: "model",
parts: data,
},
]);
setValue("");
} catch (error) {
console.log(error);
setError("Something went wrong!");
}
};
```
server.js (Server-side):
```
app.post("/gemini", async (req, res) => {
const model = genAI.getGenerativeModel({ model: "gemini-pro" });
const chat = model.startChat({
history: req.body.history,
});
const msg = req.body.message;
const result = await chat.sendMessage(msg);
const response = await result.response;
const text = response.text();
res.send(text);
});
```
Additional Information:
Node.js version: 18.17.0
@google/generative-ai version: 0.3.1
What I'm Asking:
- How can I ensure the history object sent to the model is formatted correctly with the parts property as an array of Parts?
- Are there any specific considerations for handling empty history on the server-side?
- Any other suggestions to resolve the "Content should have 'parts' property with an array of Parts" error. |
Node.js Chatbot Error: GoogleGenerativeAIError - Content should have 'parts' property with an array of Parts |
|node.js|api|artificial-intelligence|chatbot|google-generativeai| |
I try to scrape some data from the site https://bloks.io/live
The first problem is that I have no way to access the refreshing data in that table. My idea is to check if the first column changes. If it does I have to check, which account and so on...
So I need to read constantly the first column but it doesn't work.
I tried it with CSS-selectors, but no success.
```
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
link = 'https://bloks.io/live'
driver = webdriver.Chrome(service=Service((ChromeDriverManager().install())))
driver.get(link)
page =driver.page_source
tSoup = BeautifulSoup(driver.find_element(By.CSS_SELECTOR, '#info>tbody>tr:nth-child(2)').get_attribute('outerHTML'), 'html.parser')
```
This got me an no such element error message.
Could anyone help me?
**UPDATE**: my code is finding the element, which I want to check constantly, but the element doesn't refresh. My code so far:
```
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
import time
def connection():
driver = webdriver.Chrome(service=Service((ChromeDriverManager().install())))
return driver
def search_first_entry(driver, link):
driver.get(link)
# wait until page has buffered
wait = WebDriverWait(driver, 5)
element_prev = 0
element = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '#info>tbody>tr:nth-child(2)')))
while True:
element = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '#info>tbody>tr:nth-child(2)')))
print(element)
time.sleep(1)
if element != element_prev:
element_prev = element
def main():
link = 'https://bloks.io/live'
driver = connection()
search_first_entry(driver, link)
main()
``` |
In a Google spreadsheet I pull some numbers from Google Analytics via Apps script and the Analytics API.
One of the numbers is the bounce rate, which is returned in the format 42.380071394743425. I want to display this with two digits after the decimal point (and I need to add a percentage sign). I would like to do this via setNumberFormat.
However a [format token][1] like "0.00", "#,##" etc. result in output like "4.238.007.139.4743.425" which is not at all what I want. I somewhat suspect a part of the problem might be that my document is in German, with a comma as decimal delimiter, and the number from the API returned has a decimal point (or I might be overlooking something simple, which is just as likely).
So, can I use setNumberFormat, and what format token do I have to use to turn "42.380071394743425" into "42,38%"?
I am using the build-in App service. I do not have problems with other types of KPIs, just percentage values like bounceRate.
var viewId = "<myViewId>"
var options = {};
options['max-results'] = 1;
metric = "ga:bounceRate"; // actually this is passed in as a function parameter
// formatDate is a wrapper that calls Utilities.formatDate
var startDate = formatDate(pDate, 'yyyy-MM-dd');
var endDate = formatDate(pDate, 'yyyy-MM-dd');
var report = Analytics.Data.Ga.get(viewId, startDate, endDate, metric, options);
.....
token = [];
// format is passed in as a function parameter to fit the metric
switch(format) {
case("percentage"):
token.push(["0.00%"]);
break;
default:
token.push(["0.00"]); // tried different options to no avail
break;
}
sheet.getRange(<row>,<col>).setValue(report.rows).setNumberFormats(token);
As I said the code itself is working fine if the API returns unformatted numbers (so I don't think the problem is in the code), but I can't get the bounceRate to display the way I want.
Thank you for your time.
[1]: https://developers.google.com/sheets/api/guides/formats#number_format_tokens |
I am getting into async operations in Python and would like to use it properly, yet I found a few ways to retrieve data from multiple coroutines and am not sure which one to use.
The idea is as follows: for multiple records in a form of input-output objects, get the input, asynchronously run the API queries, gather results and update initial objects with them. Also, could you please suggest me on how to limit the tasks run concurrently to predefined value? I am afraid of spamming the server with thousands of requests at once and getting flagged because of that.
Currently I use a dict with object:asyncio.create_task pairs, wait for completion of all the tasks, then for each pair get the result and update the dicts key object.
Something along the following lines:
```python
class myobj:
text:str=''
result:str=''
def __init__(self, text:str) -> None:
self.text=text
items:list[myobj]=[myobj('lorem'), myobj('ipsum')]
tasks={}
for item in items:
tasks[item] = asyncio.create_task(api_query(item.text))
await asyncio.wait(tasks.values())
for item,query in tasks.items():
item.result = query.result()
```
It feels awkward though, as if I was doing something wrong, although it seems to work properly.
I also tried multiple variants of gathering results of multiple tasks and wondered which one (if not all) is correct. Below is my code:
```python
import asyncio
import time
async def reverse(text:str) -> str:
await asyncio.sleep(len(text)/10)
return text[::-1]
async def main() -> None:
names = [
"Rowan Adams",
"Leo Ferrell",
"Lottie Mccullough",
"Lina Riggs",
"Hope Garrett",
"Humza Galvan",
"Felix Carr",
"Sam English",
"Trinity Moyer",
"Lennon Osborn",
"Nicolas Chapman",
"Bushra Bowers",
"Izabella Banks",
"Malik Fitzgerald",
"Maisha Donovan",
"Kathleen Patel",
"Kiara Odling",
"Abby Larsen",
"Kye Joyce",
"Jimmy Davidson"
]
t1_s = time.perf_counter()
results1 = await asyncio.gather(*[asyncio.create_task(reverse(name)) for name in names])
t1_e = time.perf_counter()
print(results1)
print(t1_e-t1_s,'\n')
t2_s = time.perf_counter()
results2 = await asyncio.gather(*[reverse(name) for name in names])
t2_e = time.perf_counter()
print(results2)
print(t2_e-t2_s,'\n')
t3_s = time.perf_counter()
tasks1 = [asyncio.create_task(reverse(name)) for name in names]
await asyncio.wait(tasks1)
t3_e = time.perf_counter()
print([task.result() if task.done() is True else 'waiting' for task in tasks1])
print(t3_e-t3_s,'\n')
t4_s = time.perf_counter()
tasks2 = [reverse(name) for name in names]
results4 = await asyncio.gather(*tasks2)
t4_e = time.perf_counter()
print(results4)
print(t4_e-t4_s,'\n')
t5_s = time.perf_counter()
tasks3 = [asyncio.create_task(reverse(name)) for name in names]
results5 = await asyncio.gather(*tasks3)
t5_e = time.perf_counter()
print([task.result() for task in tasks3])
print('-----')
print(results5)
print(t5_e-t5_s,'\n')
if __name__ == "__main__":
asyncio.run(main())
```
From this testing I conclude that:
- asyncio.wait returns a list of tasks with their status, so it could be used to gather results from already completed tasks
- asyncio.gather returns results no matter if it was provided with coroutine or task
- when working with tasks, you can access results by running a .result() function for each completed task (ex. 3 and 5)
- I assume holding onto variables with coroutines/tasks after completion and filling result variables is pointless, but it may be reasonable to keep tasks and access results from them, instead of creating dedicated variable to store them
I have seen solutions where results from gather were zipped with the original list, I also considered using for loop like:
```
results = asyncio.gather(*[api_query(item.text) for item in items])
for i in range(0, len(items)):
items[i].result = results[i]
```
But it seems even more cumbersome than the dict solution. |
If you know that it will be separate by two empty lines, you can just load the file as a string and split them before you pass them to a csv reader.
Sample file:
```
col_1,col2_,col_3
1,2,3
c1,c2,c3,c4,c5
1,2,3,4,5
```
Code:
```
import pandas as pd
from io import StringIO
with open('file.csv') as f:
files = f.read().split('\n\n')
for file in files:
df = pd.read_csv(StringIO(file))
print(df.to_dict(orient='list'))
```
Result:
```
{'col_1': [1], 'col2_': [2], 'col_3': [3]}
{'c1': [1], 'c2': [2], 'c3': [3], 'c4': [4], 'c5': [5]}
```
|
you must add text.ads in web.config file on server to can Authorization your web site from google ads my friends .
Example :
<add input="{REQUEST_URI}" pattern="(/ads.txt)" negate="true" /> |
I asked a similar question before, when I didnt know what was the problem of my code. Just as I was recommended I will give it in a better format.
This is an example of what happens to my code.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct
{
int id_prod;
} producto;
void carga_producto(producto **productos)
{
int n = 1;
printf("Productos before the calloc: %d\n ", productos);
*productos = (producto *)calloc(1, sizeof(producto));
printf("Productos after the calloc: %d\n ", productos);
while (n < 3)
{
printf("Value of n %d\n", n);
producto *temp = realloc(*productos, (n + 1) * sizeof(producto));
*productos = temp;
printf("position of temp: %d\n", temp);
printf("Productos: %d\n ", productos);
n++;
}
}
int main()
{
producto *productos;
carga_producto(&productos);
}
As you can clearly see, no pointer is being changed neither by the realloc or the = . both *productos and *temp stay intact.
Since their values dont change I cant add more. Both the calloc and realloc arent doing anything.
I tried playing with the realloc and malloc and checking for ways to fix this but I cant find a way to change the ptrs.
//THIS IS THE RESULT I OBTAINED
PS C:\Users\Usuario\Desktop\Esizon\test> ./datos.exe
Productos before the calloc: 719321432
Productos after the calloc: 719321432
Value of n 0
position of temp: 1280342752
Productos: 719321432
Value of n 1
position of temp: 1280342752
Productos: 719321432
//I WAS EXPECTING A CHANGE OF VALUES SUCH AS THIS,
where the calloc finds a positions for the pointer and then, when Temp is updated, asigning the value of the ptr temp to the pointer productos.
And on the second cycle I expected it to change the value of temp when it was assigned more memory, but it didnt do anything.
PS C:\Users\Usuario\Desktop\Esizon\test> ./datos.exe
Productos before the calloc: 719321432
Productos after the calloc: 426416321
Value of n 0
position of temp: 1280342752
Productos: 1280342752
Value of n 1
position of temp: 512346132
Productos: 512346132
--------------------------------------------
Applying your changes
```c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct
{
int id_prod;
} producto;
void carga_producto(producto **productos)
{
int n = 0;
printf("Productos before the calloc: %d\n ", productos);
*productos = (producto *)calloc(1, sizeof(producto));
printf("Productos after the calloc: %d\n ", productos);
while (n < 2)
{
printf("Value of n %d\n", n);
producto *temp = realloc(*productos, (n + 1) * sizeof(producto));
*productos = temp;
printf("position of temp: %d\n", *temp);
printf("Productos: %d\n ", *productos);
n++;
}
}
int main()
{
producto *productos;
carga_producto(&productos);
}
```
The result is
PS C:\Users\Usuario\Desktop\Esizon\test> ./datos.exe
Productos before the calloc: -1270876504
Productos after the calloc: -1270876504
Value of n 0
position of temp: 0
Productos: -1072923936
Value of n 1
position of temp: 0
Productos: -1072923936
Still no change to productos and temp is not even initialized.
try it:
```
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 3
typedef struct {
int id_prod;
} producto;
producto* carga_producto(int max) {
producto *productos = calloc(1, sizeof(producto));
if (productos) {
printf("Producto[0]: id=%d\n", productos->id_prod);
for (int n = 1; n < max; n++) {
producto *temp = productos;
productos = realloc(temp, (n + 1) * sizeof(producto));
if (productos) productos[n].id_prod = n; else { printf("%s\n", "Something wrong"); free(temp); break; }
printf("Producto[%d]: id=%d\n", n, productos[n].id_prod);
}
}
return productos;
}
int main() {
producto *productos = carga_producto(MAX);
if (!productos) return 1;
free(productos);
return 0;
}
```
This works instead of sending the data through ref I just receive a product array. It is not a fix (and I have tried wwhat every other comment said one by one till 5 am) but it will do the work I need. Thanks for the help guys. |