row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
14,671 | A dynamic fintech startup has established a substantial userbase through its payment platform. Now, they aim to introduce a credit
product to cater to their customers' needs. However, credit products entail significant risks. Hence, the startup seeks assistance from a Data
Science team to create a model/solution that enables effective risk profiling of potential customers. The goal is to identify risk-free potential
customers for the credit product.
As a member of data science team what would be your approach to tackle this problem? | 5dec98c285a4f21a3b09c4358ccd41d1 | {
"intermediate": 0.22334788739681244,
"beginner": 0.35827940702438354,
"expert": 0.4183727204799652
} |
14,672 | ciao | 8752ace6927959ab2f4bd4cbe637aa16 | {
"intermediate": 0.3386206328868866,
"beginner": 0.30121153593063354,
"expert": 0.36016789078712463
} |
14,673 | 3 | de237d14a77da046c0d777e73acb81e2 | {
"intermediate": 0.32598400115966797,
"beginner": 0.29279351234436035,
"expert": 0.3812224864959717
} |
14,674 | please create a player controller script in unity for a flying object that includes an attack command that triggers a tractor beam on long press, please use wasd and space bar for pc control, and tilt control for android and tilt controls for ios | 37b235f4a3e46dd2c6baef5a725d679d | {
"intermediate": 0.44884249567985535,
"beginner": 0.23296815156936646,
"expert": 0.3181892931461334
} |
14,675 | please create a player controller script in unity for a flying object that includes an attack command that triggers a tractor beam on long press, please use wasd and space bar for pc control, and tilt control for android and tilt controls for ios, please include a feature that would kill the player if it touches the ground | 88ef2acb6a01bc59ee535afba806bd44 | {
"intermediate": 0.3976685106754303,
"beginner": 0.29943785071372986,
"expert": 0.3028936982154846
} |
14,676 | i have a game im working on in unity, i have a ufo, id like a tractor beam script that lets me pull and object to my ufo slowly and despawn the object when it touches the ufo | 253c612848db8f4277e68d1ba1b8aa08 | {
"intermediate": 0.4947151839733124,
"beginner": 0.2663138210773468,
"expert": 0.23897092044353485
} |
14,677 | id like a unity script for an item that the flying player character can pick up and drop off at a set destination | 0055f9511dc9d9bfe3504d12c3ccf03a | {
"intermediate": 0.40127861499786377,
"beginner": 0.3058648705482483,
"expert": 0.2928565442562103
} |
14,678 | please create a unity script to control a player that is a flying character, please control its direction with WASD in pc, and with tilting in IOS and android. please make it able to pick up and object from a platform if landing gear is out and it lands slowly. please make it able to deploy and retract landing gear with a button press on pc and a touch on ios and android | 2e24d222da7cbd43d180cc86ad4948f1 | {
"intermediate": 0.4437067210674286,
"beginner": 0.2036447674036026,
"expert": 0.3526484966278076
} |
14,679 | whats the windows cmd command to disable windows defender. i forgot. | dd1bad61cd5e20b9ab58d7814cb96180 | {
"intermediate": 0.34460243582725525,
"beginner": 0.3460681438446045,
"expert": 0.30932945013046265
} |
14,680 | how can i enter multiple commands with one line in cmd? | 5f1bd1122c77f3d701c663fb94820b00 | {
"intermediate": 0.37602439522743225,
"beginner": 0.26831313967704773,
"expert": 0.35566240549087524
} |
14,681 | SyntaxError: Unexpected reserved word
в строке
const shaderCode = await loadShaderFile('glsl.glsl');
код:
import * as THREE from 'three';
import Stats from 'three/addons/libs/stats.module.js';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
async function loadShaderFile(url) {
const response = await fetch(url);
const shaderCode = await response.text();
return shaderCode;
}
async function main() {
// Создаем загрузчик gltf
const loader = new GLTFLoader();
loader.load(
'card3.glb',
(gltf) => {
const phone = gltf.scene;
let container, stats, clock;
let camera, scene, renderer;
let line;
const segments = 1000;
const r = 800;
let t = 0;
init();
const controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.05;
scene.add(controls.target);
animate();
function init() {
container = document.getElementById( 'container' );
//
camera = new THREE.PerspectiveCamera( 27, window.innerWidth / window.innerHeight, 1, 4000 );
camera.position.z = 2750;
scene = new THREE.Scene();
clock = new THREE.Clock();
const shaderCode = await loadShaderFile('glsl.glsl');
const geometry = new THREE.BufferGeometry();
//const material = new THREE.LineBasicMaterial( { vertexColors: true } );
const material = new THREE.ShaderMaterial({
fragmentShader: shaderCode
})
const positions = [];
const colors = [];
for ( let i = 0; i < segments; i ++ ) {
const x = Math.random() * r - r / 2;
const y = Math.random() * r - r / 2;
const z = Math.random() * r - r / 2;
// positions
positions.push( x, y, z );
// colors
colors.push( ( x / r ) + 0.5 );
colors.push( ( y / r ) + 0.5 );
colors.push( ( z / r ) + 0.5 );
}
geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
geometry.computeBoundingSphere();
line = new THREE.Line( geometry, material );
scene.add( line );
//
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.useLegacyLights = false;
container.appendChild( renderer.domElement );
//
stats = new Stats();
container.appendChild( stats.dom );
//
window.addEventListener( 'resize', onWindowResize );
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
//
function animate() {
requestAnimationFrame( animate );
controls.update();
render();
stats.update();
}
function render() {
const delta = clock.getDelta();
const time = clock.getElapsedTime();
t += delta * 0.5;
renderer.render( scene, camera );
}
}
);
};
main() | 7374f71eb58fb6f86fa27419ddb6a925 | {
"intermediate": 0.3584987223148346,
"beginner": 0.4656738042831421,
"expert": 0.1758275330066681
} |
14,682 | Создайте пакет model
3. Создайте подпакеты account, constants, money, score
Часть 2. Иерархия пользователей.
1) Создайте класс прав пользователей Principal с полями
private String firstName;
private String lastName;
private String secondName;
private short age;
2) Добавьте конструкторы, геттеры/сеттеры для Principal
public Principal(String firstName, String lastName, String
secondName, short age) {
18
this.firstName = firstName;
this.lastName = lastName;
this.secondName = secondName;
this.age = age;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getSecondName() {
return secondName;
}
public void setSecondName(String secondName) {
this.secondName = secondName;
}
public short getAge() {
return age;
}
public void setAge(short age) {
this.age = age;
}
3) Создайте класс пользователя Account с полями
private Principal principal;
private String login;
private String password;
private Map<Integer,Score> scoreMap;
4) Добавьте конструкторы, геттеры/сеттеры для Account
public Account(Principal principal, String login, String
password) {
this.principal = principal;
this.login = login;
this.password = password;
scoreMap = new HashMap<Integer, Score>();
}
public Map<Integer, Score> getScoreMap() {
return scoreMap;
}
public void setScoreMap(Map<Integer, Score> scoreMap) {
this.scoreMap = scoreMap;
}
public Principal getPrincipal() {
return principal;
}
19
public void setPrincipal(Principal principal) {
this.principal = principal;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
Часть 3. Иерархия «деньги».
1. Создайте класс Currency с полями
private String name;
private float usdCource;
2. Добавьте конструкторы, геттеры/сеттеры для Currency
public Currency(String name, float usdCource) {
this.name = name;
this.usdCource = usdCource;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getUsdCource() {
return usdCource;
}
public void setUsdCource(float usdCource) {
this.usdCource = usdCource;
}
3. Создайте интерфейс MoneyInterface
public interface MoneyInterface {
void addMoney(Money money);
Money getMoney(double balanceLess);
Money getMoneyWithoutLess();
}
4. Создайте класс Money с полями
private Currency currency;
private double value;
5. Добавьте конструкторы, геттеры/сеттеры для Currency
public Money(double value, String currencyName) {
this.value = value;
this.currency =
20
CurrencyHolder.getCurrencyByName(currencyName);
}
public Currency getCurrency() {
return currency;
}
public double getValue() {
return value;
}
public void setValue(double value) {
this.value = value;
}
6. Создайте класс держателя валют
public class CurrencyHolder {
private static final Map<String,Currency> currencies = new
HashMap<String, Currency>();
static {
currencies.put("USD",new Currency("USD", 1));
currencies.put("RUR",new Currency("RUR", 65.5f));
}
public static Currency getCurrencyByName(String name) {
return currencies.get(name);
}
}
Часть 4. Иерархия «счета».
1. Создайте базовый абстрактный класс Score
public abstract class Score implements MoneyInterface {
private Money balance;
private Account owner;
private Integer number;
2. Добавьте конструкторы, геттеры/сеттеры для Score, а также реализуйте в
нем методы интерфейса MoneyInterface
public Score(Money balance, Account owner, Integer number) {
this.balance = balance;
this.owner = owner;
this.number = number;
}
public Money getBalance() {
return balance;
}
public void setBalance(Money balance) {
this.balance = balance;
}
public Account getOwner() {
return owner;
}
public void setOwner(Account owner) {
this.owner = owner;
}
public Integer getNumber() {
return number;
}
21
public void setNumber(Integer number) {
this.number = number;
}
@Overridepublic void addMoney(Money money){
double usdValueIn = money.getValue() *
money.getCurrency().getUsdCource();
double usdValueThis = this.balance.getValue() *
this.balance.getCurrency().getUsdCource();
if(usdValueThis < usdValueIn) {
System.out.println("You have no so much!");
return;
}
if(checkBefore()) {
this.balance.setValue((usdValueThis + usdValueIn) *
this.balance.getCurrency().getUsdCource());
} else {
System.out.println("No check!");
return;
}
}
@Override
public Money getMoney(double balanceLess){
if(balanceLess > 30000) {
throw new IllegalArgumentException("Wrong balance less!");
}
this.balance.setValue(this.balance.getValue() - balanceLess);
return this.balance;
}
@Override
public Money getMoneyWithoutLess(){
return this.balance;
}
3. Создайте классы наследники от Scorepublic class CreditScore extends Score {
public CreditScore(Money balance, Account owner, Integer
number) {
super(balance, owner, number);
}
…
public class DebetScore extends Score {
private CreditScore creditScore;
public DebetScore(Money balance, Account owner, Integer
number, CreditScore creditScore) {
super(balance, owner, number);
this.creditScore = creditScore;
}
…
public class CurrentScore extends Score{
private DebetScore debetScore;
public CurrentScore(Money balance, Account owner, Integer
number, DebetScore debetScore) {
22
super(balance, owner, number);
this.debetScore = debetScore;
}
4. Реализуйте методы Score в каждом классе с учетом следующих
дополнений:
1 Снятие с любого счета более чем 30 000 за сеанс запрещено
2 Наличие кредитного счета с балансом менее минус 20 000 запрещает
работу с дебетовым счетом
3 При пополнении текущего счета более чем на 1 000 000 за операцию- на
дебетовый счет автоматически поступает +2 000 | 9e7871ef23abed3f5f42012ef2d46314 | {
"intermediate": 0.2994106709957123,
"beginner": 0.4394207000732422,
"expert": 0.26116862893104553
} |
14,683 | I used your signal_generator code: import time
from binance.client import Client
from binance.enums import *
from binance.exceptions import BinanceAPIException
from binance.helpers import round_step_size
import pandas as pd
import json
import numpy as np
import pytz
import datetime as dt
import ccxt
from decimal import Decimal
import requests
import hmac
import hashlib
import ntplib
import os
import ta
import ta.volatility
API_KEY = ''
API_SECRET = ''
client = Client(API_KEY, API_SECRET)
def sync_time():
server_time = requests.get('https://api.binance.com/api/v3/time').json()['serverTime']
local_time = int(time.time() * 1000)
time_difference = server_time - local_time
# Set the system clock to the new time
os.system(f'sudo date -s @{int(server_time/1000)}')
print(f'New time: {dt.datetime.now()}')
# Sync your local time with the server time
sync_time()
# Set the endpoint and parameters for the request
url = "https://fapi.binance.com/fapi/v1/klines"
symbol = 'COMP/USDT'
interval = '1m'
lookback = 44640
timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift
recv_window = 60000 # increased recv_window value
params = {
"symbol": symbol.replace("/", ""),
"interval": interval,
"startTime": int((time.time() - lookback * 60) * 1000),
"endTime": int(time.time() * 1000),
"timestamp": timestamp,
"recvWindow": recv_window
}
# Sign the message using the Client’s secret key
message = "&".join([f"{k}={v}" for k, v in params.items()])
signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest()
params[signature] = signature
# Send the request using the requests library
response = requests.get(url, params=params, headers={'X-MBX-APIKEY': API_KEY})
# Check for errors in the response
response.raise_for_status()
STOP_LOSS_PERCENTAGE = -50
TAKE_PROFIT_PERCENTAGE = 100
MAX_TRADE_QUANTITY_PERCENTAGE = 100
POSITION_SIDE_SHORT = 'SELL'
POSITION_SIDE_LONG = 'BUY'
quantity = 1
symbol = 'COMP/USDT'
order_type = 'market'
leverage = 100
max_trade_quantity_percentage = 1
binance_futures = ccxt.binance({
'apiKey': API_KEY,
'secret': API_SECRET,
'enableRateLimit': True, # enable rate limitation
'options': {
'defaultType': 'future',
'adjustForTimeDifference': True
},'future': {
'sideEffectType': 'MARGIN_BUY', # MARGIN_BUY, AUTO_REPAY, etc…
}
})
time.sleep(1)
print(symbol)
def get_klines(symbol, interval, lookback):
url = "https://fapi.binance.com/fapi/v1/klines"
end_time = int(time.time() * 1000) # end time is now
start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago
symbol = symbol.replace("/", "") # remove slash from symbol
query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
}
response = requests.get(url + query_params, headers=headers)
response.raise_for_status()
data = response.json()
if not data: # if data is empty, return None
print('No data found for the given timeframe and symbol')
return None
ohlc = []
for d in data:
timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime('%Y-%m-%d %H:%M:%S')
ohlc.append({
'Open time': timestamp,
'Open': float(d[1]),
'High': float(d[2]),
'Low': float(d[3]),
'Close': float(d[4]),
'Volume': float(d[5])
})
df = pd.DataFrame(ohlc)
df.set_index('Open time', inplace=True)
return df
df = get_klines(symbol, '1m', 44640)
def signal_generator(df):
# Calculate EMA and MA lines
df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
df['MA10'] = df['Close'].rolling(window=10).mean()
df['MA20'] = df['Close'].rolling(window=20).mean()
df['MA50'] = df['Close'].rolling(window=50).mean()
df['MA100'] = df['Close'].rolling(window=100).mean()
# Extract necessary prices from df
open_price = df.Open.iloc[-1]
close_price = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]
# Calculate the last candlestick
last_candle = df.iloc[-1]
current_price = df.Close.iloc[-1]
# Initialize analysis variables
ema_analysis = []
candle_analysis = []
# EMA strategy - buy signal
if df['EMA5'].iloc[-1] > df['EMA10'].iloc[-1] > df['EMA20'].iloc[-1] > df['EMA50'].iloc[-1]:
ema_analysis.append('buy')
# EMA strategy - sell signal
elif df['EMA5'].iloc[-1] < df['EMA10'].iloc[-1] < df['EMA20'].iloc[-1] < df['EMA50'].iloc[-1]:
ema_analysis.append('sell')
# Check for bullish candlestick pattern - buy signal
open_price = df['Open'].iloc[-1]
close_price = df['Close'].iloc[-1]
previous_open = df['Open'].iloc[-2]
previous_close = df['Close'].iloc[-2]
if (
open_price < close_price and
previous_open > previous_close and
close_price > previous_open and
open_price <= previous_close
):
candle_analysis.append('buy')
# Check for bearish candlestick pattern - sell signal
elif (
open_price > close_price and
previous_open < previous_close and
close_price < previous_open and
open_price >= previous_close
):
candle_analysis.append('sell')
# Determine final signal
if 'buy' in ema_analysis and 'buy' in candle_analysis and df['Close'].iloc[-1] > df['EMA50'].iloc[-1]:
final_signal = 'buy'
elif 'sell' in ema_analysis and 'sell' in candle_analysis and df['Close'].iloc[-1] < df['EMA50'].iloc[-1]:
final_signal = 'sell'
else:
final_signal = ''
return final_signal
df = get_klines(symbol, '1m', 44640)
while True:
df = get_klines(symbol, '1m', 44640) # await the coroutine function here
if df is not None:
signal = signal_generator(df)
if signal is not None:
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}:{signal}")
time.sleep(1)
But it gave me wrong signal , plase can you give me more good code which will give me right signals , and please can you add in my EMA analysis EMA 100 and EMA 200 lines please | 7cd628ce46513f43843d1dec4d66ce0f | {
"intermediate": 0.35336095094680786,
"beginner": 0.31476959586143494,
"expert": 0.3318694829940796
} |
14,684 | I used your signal_generator code: import time
from binance.client import Client
from binance.enums import *
from binance.exceptions import BinanceAPIException
from binance.helpers import round_step_size
import pandas as pd
import json
import numpy as np
import pytz
import datetime as dt
import ccxt
from decimal import Decimal
import requests
import hmac
import hashlib
import ntplib
import os
import ta
import ta.volatility
API_KEY = ‘’
API_SECRET = ‘’
client = Client(API_KEY, API_SECRET)
def sync_time():
server_time = requests.get(‘https://api.binance.com/api/v3/time’).json()['serverTime’]
local_time = int(time.time() * 1000)
time_difference = server_time - local_time
# Set the system clock to the new time
os.system(f’sudo date -s @{int(server_time/1000)}‘)
print(f’New time: {dt.datetime.now()}’)
# Sync your local time with the server time
sync_time()
# Set the endpoint and parameters for the request
url = “https://fapi.binance.com/fapi/v1/klines”
symbol = ‘COMP/USDT’
interval = ‘1m’
lookback = 44640
timestamp = int(time.time() * 1000) - 500 # subtract 500ms from local time to account for clock-drift
recv_window = 60000 # increased recv_window value
params = {
“symbol”: symbol.replace(“/”, “”),
“interval”: interval,
“startTime”: int((time.time() - lookback * 60) * 1000),
“endTime”: int(time.time() * 1000),
“timestamp”: timestamp,
“recvWindow”: recv_window
}
# Sign the message using the Client’s secret key
message = “&”.join([f"{k}={v}" for k, v in params.items()])
signature = hmac.new(API_SECRET.encode(), message.encode(), hashlib.sha256).hexdigest()
params[signature] = signature
# Send the request using the requests library
response = requests.get(url, params=params, headers={‘X-MBX-APIKEY’: API_KEY})
# Check for errors in the response
response.raise_for_status()
STOP_LOSS_PERCENTAGE = -50
TAKE_PROFIT_PERCENTAGE = 100
MAX_TRADE_QUANTITY_PERCENTAGE = 100
POSITION_SIDE_SHORT = ‘SELL’
POSITION_SIDE_LONG = ‘BUY’
quantity = 1
symbol = ‘COMP/USDT’
order_type = ‘market’
leverage = 100
max_trade_quantity_percentage = 1
binance_futures = ccxt.binance({
‘apiKey’: API_KEY,
‘secret’: API_SECRET,
‘enableRateLimit’: True,
‘options’: {
‘defaultType’: ‘future’,
‘adjustForTimeDifference’: True
},‘future’: {
‘sideEffectType’: ‘MARGIN_BUY’,
}
})
time.sleep(1)
print(symbol)
def get_klines(symbol, interval, lookback):
url = “https://fapi.binance.com/fapi/v1/klines”
end_time = int(time.time() * 1000)
start_time = end_time - (lookback * 60 * 1000)
symbol = symbol.replace(“/”, “”)
query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}“
headers = {
‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36’
}
response = requests.get(url + query_params, headers=headers)
response.raise_for_status()
data = response.json()
if not data:
print(‘No data found for the given timeframe and symbol’)
return None
ohlc = []
for d in data:
timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime(‘%Y-%m-%d %H:%M:%S’)
ohlc.append({
‘Open time’: timestamp,
‘Open’: float(d[1]),
‘High’: float(d[2]),
‘Low’: float(d[3]),
‘Close’: float(d[4]),
‘Volume’: float(d[5])
})
df = pd.DataFrame(ohlc)
df.set_index(‘Open time’, inplace=True)
return df
df = get_klines(symbol, ‘1m’, 44640)
def signal_generator(df):
df[‘EMA5’] = df[‘Close’].ewm(span=5, adjust=False).mean()
df[‘EMA10’] = df[‘Close’].ewm(span=10, adjust=False).mean()
df[‘EMA20’] = df[‘Close’].ewm(span=20, adjust=False).mean()
df[‘EMA50’] = df[‘Close’].ewm(span=50, adjust=False).mean()
df[‘EMA100’] = df[‘Close’].ewm(span=100, adjust=False).mean()
df[‘EMA200’] = df[‘Close’].ewm(span=200, adjust=False).mean()
df[‘MA10’] = df[‘Close’].rolling(window=10).mean()
df[‘MA20’] = df[‘Close’].rolling(window=20).mean()
df[‘MA50’] = df[‘Close’].rolling(window=50).mean()
df[‘MA100’] = df[‘Close’].rolling(window=100).mean()
open_price = df.Open.iloc[-1]
close_price = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]
last_candle = df.iloc[-1]
current_price = df.Close.iloc[-1]
ema_analysis = []
candle_analysis = []
if df[‘EMA5’].iloc[-1] > df[‘EMA10’].iloc[-1] > df[‘EMA20’].iloc[-1] > df[‘EMA50’].iloc[-1] > df[‘EMA100’].iloc[-1] > df[‘EMA200’].iloc[-1]:
ema_analysis.append(‘buy’)
elif df[‘EMA5’].iloc[-1] < df[‘EMA10’].iloc[-1] < df[‘EMA20’].iloc[-1] < df[‘EMA50’].iloc[-1] < df[‘EMA100’].iloc[-1] < df[‘EMA200’].iloc[-1]:
ema_analysis.append(‘sell’)
if (
open_price < close_price and
previous_open > previous_close and
close_price > previous_open and
open_price <= previous_close
):
candle_analysis.append(‘buy’)
elif (
open_price > close_price and
previous_open < previous_close and
close_price < previous_open and
open_price >= previous_close
):
candle_analysis.append(‘sell’)
if ‘buy’ in ema_analysis and ‘buy’ in candle_analysis and df[‘Close’].iloc[-1] > df[‘EMA200’].iloc[-1]:
final_signal = ‘buy’
elif ‘sell’ in ema_analysis and ‘sell’ in candle_analysis and df[‘Close’].iloc[-1] < df[‘EMA200’].iloc[-1]:
final_signal = ‘sell’
else:
final_signal = ‘’
return final_signal
df = get_klines(symbol, ‘1m’, 44640)
while True:
df = get_klines(symbol, ‘1m’, 44640)
if df is not None:
signal = signal_generator(df)
if signal is not None:
print(f"The signal time is: {dt.datetime.now().strftime(‘%Y-%m-%d %H:%M:%S’)}:{signal}”)
time.sleep(1)
but it gave me signal which gave me loss -10% , listean me please . I have stop loss -10% and I need code which will give me signals which will doesn't touch the stop loss | 2deaf8c9149cc4c93a68baec1dbf58bc | {
"intermediate": 0.46632692217826843,
"beginner": 0.3858594000339508,
"expert": 0.14781366288661957
} |
14,685 | give me js event listener inline, like onload and stuff but this event listener fire imediately when website is load | 032a6324c1cc1894d9ac2de08ac0133d | {
"intermediate": 0.6124363541603088,
"beginner": 0.16998757421970367,
"expert": 0.21757610142230988
} |
14,686 | Wirte a python programmer to add two number | 4c3aa102316427b05d1c144c491665ea | {
"intermediate": 0.29122525453567505,
"beginner": 0.3197009861469269,
"expert": 0.38907375931739807
} |
14,687 | SELECT * FROM producto p, fabricante f
WHERE p.codigo_fabricante=f.codigo AND f.nombre='Lenovo'; i only show the data of the producto table | b2f3fa7c315872d8bd4718041ef23274 | {
"intermediate": 0.3401513695716858,
"beginner": 0.293361097574234,
"expert": 0.3664875030517578
} |
14,688 | how do I duplicate a list | 1638f08fb1a294c1d911413cc059e746 | {
"intermediate": 0.3303496539592743,
"beginner": 0.31798213720321655,
"expert": 0.35166820883750916
} |
14,689 | import pygame
import random
import requests
import base64
from io import BytesIO
# Define the screen dimensions
SCREEN_WIDTH = 1900
SCREEN_HEIGHT = 1000
# Define the image dimensions
IMAGE_WIDTH = 800
IMAGE_HEIGHT = 800
# Define the colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
# Define the artists and their monthly Spotify listeners
artists = {
"Young Thug": {"listeners": 28887553},
"Yungeen Ace": {"listeners": 1294188}
}
# Initialize the game
pygame.init()
# Create the game window
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Guess the Artist")
# Define the fonts
font = pygame.font.Font(None, 36)
listeners_font = pygame.font.Font(None, 24)
question_font = pygame.font.Font(None, 40)
# Load the images
artist_images = {}
# Function to fetch the artist image using the Spotify API and resize it
def fetch_artist_image(artist, client_id, client_secret):
# Check if the image is already fetched
if artist in artist_images:
return artist_images[artist]
# Base64 encode the client ID and secret
client_credentials = base64.b64encode(f"{client_id}:{client_secret}".encode()).decode()
# Request an access token
token_url = "https://accounts.spotify.com/api/token"
headers = {
"Authorization": f"Basic {client_credentials}"
}
data = {
"grant_type": "client_credentials"
}
response = requests.post(token_url, headers=headers, data=data)
access_token = response.json()["access_token"]
# Search for the artist on Spotify
search_url = f"https://api.spotify.com/v1/search?q={artist}&type=artist"
headers = {
"Authorization": f"Bearer {access_token}"
}
response = requests.get(search_url, headers=headers)
data = response.json()
# Get the first artist result
artist_info = data["artists"]["items"][0]
# Get the image URL of the artist
image_url = artist_info["images"][0]["url"]
# Download the image and resize it
image_data = requests.get(image_url).content
image = pygame.image.load(BytesIO(image_data)).convert()
resized_image = pygame.transform.scale(image, (IMAGE_WIDTH, IMAGE_HEIGHT))
# Store the resized image
artist_images[artist] = resized_image
return resized_image
# Function to check the user's guess
def check_guess(artist1, artist2, guess):
if guess == "1" and artists[artist1]["listeners"] > artists[artist2]["listeners"]:
return True
elif guess == "2" and artists[artist2]["listeners"] > artists[artist1]["listeners"]:
return True
else:
return False
# Pause duration in milliseconds
pause_duration = 2000
# Game loop
running = True
score = 0
display_listeners = False # Flag to indicate if the listeners' count should be displayed
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Clear the screen
screen.fill(BLACK)
# Select two random artists
first_artist, second_artist = random.sample(list(artists.keys()), 2)
# Fetch the artist images
client_id = '048322b8ea61411a826de68d0cb1c6d2'
client_secret = '29f94d572c6240cf99fc3f13ce050503'
first_artist_image = fetch_artist_image(first_artist, client_id, client_secret)
second_artist_image = fetch_artist_image(second_artist, client_id, client_secret)
# Render the text surfaces for the artist names
first_artist_text = font.render(f"1 - {first_artist.title()}", True, WHITE)
second_artist_text = font.render(f"2 - {second_artist.title()}", True, WHITE)
# Render the question text
question_text = question_font.render("Which artist has more monthly listeners?", True, WHITE)
# Determine the positions of the text surfaces
first_artist_pos = (400, 50) # x,y
second_artist_pos = (SCREEN_WIDTH // 2 + 400, 50)
question_pos = ((SCREEN_WIDTH - question_text.get_width()) // 2, 10) # y
# Display the artist images
screen.blit(first_artist_image, (SCREEN_WIDTH // 4 - IMAGE_WIDTH // 2, 150))
screen.blit(second_artist_image, (3 * SCREEN_WIDTH // 4 - IMAGE_WIDTH // 2, 150))
# Display the text surfaces
screen.blit(first_artist_text, first_artist_pos)
screen.blit(second_artist_text, second_artist_pos)
screen.blit(question_text, question_pos)
# Render the score text surface
score_text = font.render(f"Score: {score}", True, WHITE)
score_pos = (20, 20) # Position of the score text
screen.blit(score_text, score_pos)
if display_listeners:
# Render the text surfaces for the listeners' count
first_listeners_text = listeners_font.render(f"{artists[first_artist]['listeners']:,} listeners", True, WHITE)
second_listeners_text = listeners_font.render(f"{artists[second_artist]['listeners']:,} listeners", True, WHITE)
# Determine the positions of the listeners' count
first_listeners_pos = (400, 100)
second_listeners_pos = (SCREEN_WIDTH // 2 + 400, 100)
# Display the listeners' count
screen.blit(first_listeners_text, first_listeners_pos)
screen.blit(second_listeners_text, second_listeners_pos)
pygame.display.flip()
# Prompt the player for their guess
guess = None
while guess is None:
for event in pygame.event.get():
if event.type == pygame.KEYUP:
if event.key == pygame.K_KP1:
guess = "1"
elif event.key == pygame.K_KP2:
guess = "2"
elif event.key == pygame.K_q:
running = False
guess = "quit"
if guess == "quit":
running = False
break
# Update the flag to display listeners after making a guess
display_listeners = True
if check_guess(first_artist, second_artist, guess):
score += 1
pygame.time.wait(pause_duration) # Pause execution for 2 seconds
else:
# Display the incorrect guess message
play_again_text = font.render("You guessed incorrectly, do you want to play again? (y/n)", True, WHITE)
play_again_pos = (SCREEN_WIDTH // 2 - play_again_text.get_width() // 2, SCREEN_HEIGHT // 2)
screen.blit(play_again_text, play_again_pos)
pygame.display.flip()
waiting_for_input = True
while waiting_for_input:
for event in pygame.event.get():
if event.type == pygame.KEYUP:
if event.key == pygame.K_y:
waiting_for_input = False
score = 0
elif event.key == pygame.K_n:
waiting_for_input = False
running = False
break # Exit the inner loop
# Reset the flag to not display the listeners' count
display_listeners = False
# Quit the game
pygame.quit()
fix it so the listeners numbers are visible after making a guess but dissapear when starting a new round | be2b8d0179e1fe9d373643894c91ac77 | {
"intermediate": 0.33458051085472107,
"beginner": 0.4485767185688019,
"expert": 0.21684281527996063
} |
14,690 | If Target.CountLarge > 1 Then Exit Sub
If Target.Column = 7 Then 'Check if clicked cell is in column 7 - G
If Not IsDate(Target.Value) Then
MsgBox "Service Due Date needs to be present" . . . In this code, the Date related to the Target is offset to the right on the same row by 1 cell. How can I write this | 87e98e8e3566a79a6f266249fb5b6a49 | {
"intermediate": 0.48700040578842163,
"beginner": 0.36107850074768066,
"expert": 0.15192103385925293
} |
14,691 | I used your signal_generator code: def signal_generator(df):
# Calculate EMA and MA lines
df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
df['MA10'] = df['Close'].rolling(window=10).mean()
df['MA20'] = df['Close'].rolling(window=20).mean()
df['MA50'] = df['Close'].rolling(window=50).mean()
df['MA100'] = df['Close'].rolling(window=100).mean()
# Extract necessary prices from df
open_price = df.Open.iloc[-1]
close_price = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]
# Calculate the last candlestick
last_candle = df.iloc[-1]
current_price = df.Close.iloc[-1]
# Initialize analysis variables
ema_analysis = []
candle_analysis = []
if df['EMA5'].iloc[-1] > df['EMA10'].iloc[-1] > df['EMA20'].iloc[-1] > df['EMA50'].iloc[-1] > df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1]:
ema_analysis.append('buy')
elif df['EMA5'].iloc[-1] < df['EMA10'].iloc[-1] < df['EMA20'].iloc[-1] < df['EMA50'].iloc[-1] < df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1]:
ema_analysis.append('sell')
if (
open_price < close_price
and previous_open > previous_close
and close_price > previous_open
and open_price <= previous_close
):
candle_analysis.append('buy')
elif (
open_price > close_price
and previous_open < previous_close
and close_price < previous_open
and open_price >= previous_close
):
candle_analysis.append('sell')
stop_loss_price = current_price * (1 + STOP_LOSS_PERCENTAGE / 100)
if (
'buy' in ema_analysis
and 'buy' in candle_analysis
and current_price > df['EMA200'].iloc[-1]
and current_price > stop_loss_price
):
final_signal = 'buy'
elif (
'sell' in ema_analysis
and 'sell' in candle_analysis
and current_price < df['EMA200'].iloc[-1]
and current_price < stop_loss_price
):
final_signal = 'sell'
else:
final_signal = ''
return final_signal
But it gave me wrong signal which gave loss -10%, you told me that it will give me right signals which will doesn't touch my stop loss | 9ab1403444c28185c6be46addad51b17 | {
"intermediate": 0.26138240098953247,
"beginner": 0.43344005942344666,
"expert": 0.30517756938934326
} |
14,692 | Hi! | 35004591adf7a331b66a7e043eef13ab | {
"intermediate": 0.3230988085269928,
"beginner": 0.2665199935436249,
"expert": 0.4103812277317047
} |
14,693 | this is a reactjs component, the navigation is not working it doesn't change the path: "I was shortening the code for you, this is the complete code and the navigation to the other path is not working: "import React, { useState, useEffect} from 'react';
import { Row, Col, Typography, Divider, Space, Button, Form, message, Input, Select } from 'antd';
import './zigzag.css';
import './index.css';
import fimg from './Cryptotasky4-01.svg';
import {
PhoneOutlined,
ArrowRightOutlined,
UserOutlined,
MailOutlined,
WalletOutlined,
LockOutlined,
MobileOutlined,
} from '@ant-design/icons';
import { Link, useNavigate } from 'react-router-dom';
import axios from 'axios';
const { Option } = Select;
const { Title, Paragraph } = Typography;
const AddTask = () => {
const navigate = useNavigate();
const handleSubmit = async (values) => {
const { names, description, price, maxUsers, rateL, usersPerDay, gender } = values;
const Task = {
Name: names,
Description: description,
Price: price,
MaxUsers: maxUsers,
UsersPerDay: usersPerDay,
Type: gender,
RateLink: rateL
};
try {
const response = await axios.post('http://localhost:5041/api/admin', Task);
setDota(response.data);
if (dota.type === "img") {
navigate(`/UploadTask/${dota.id}`);
}
message.success('تم إضافة المهمة');
exitLoading(1);
} catch (error) {
console.error('There was an error!', error);
message.error('حدث خطأ يرجى المحاولة وقت اخر');
exitLoading(1);
}
};
const [dota, setDota] = useState([]);
const [loadings, setLoadings] = useState([]);
const enterLoading = (index) => {
setLoadings((prevLoadings) => {
const newLoadings = [...prevLoadings];
newLoadings[index] = true;
return newLoadings;
});
};
const exitLoading = (index) => {
setLoadings((prevLoadings) => {
const newLoadings = [...prevLoadings];
newLoadings[index] = false;
return newLoadings;
});
};
const onFinishs = (values) => {
handleSubmit(values);
};
const formRef = React.useRef(null);
const onGenderChange = (value) => {
switch (value) {
case 'rate':
break;
case 'text':
break;
case 'img':
break;
default:
break;
}
};
return (
<>
</>
);
}
export default AddTask;"" figure out the issue and fix it. | 586f8054570e6da9eb0e26c100ac36dd | {
"intermediate": 0.36359086632728577,
"beginner": 0.43093326687812805,
"expert": 0.20547588169574738
} |
14,694 | convert from dynamic type to defined type in dart | 0ff942a77ec33abca1f757105026c06a | {
"intermediate": 0.36818134784698486,
"beginner": 0.22386212646961212,
"expert": 0.4079565703868866
} |
14,695 | I'm running the Gnome desktop environment on Debian Bullseye Linux. The login process is very slow and I want to know why | 58a38dc6644514b226d485335296eea2 | {
"intermediate": 0.3768639862537384,
"beginner": 0.3073517978191376,
"expert": 0.3157842755317688
} |
14,696 | write a simple code for a calculator | 73ec7a8ca09da7f4cf026fe44ad60a6a | {
"intermediate": 0.3055802583694458,
"beginner": 0.4647730588912964,
"expert": 0.22964666783809662
} |
14,697 | web scrape https://www.imdb.com/chart/top/?ref_=nv_mv_250 with python and beautifulsoup | f0aaa97938fdc477cfd6939bb3d9d5bc | {
"intermediate": 0.22139202058315277,
"beginner": 0.3347335159778595,
"expert": 0.44387441873550415
} |
14,698 | write a python program that will plot the electromanetic field in 3G and graph | f9d47602199339d14087a1b7a0d66387 | {
"intermediate": 0.33984997868537903,
"beginner": 0.15486210584640503,
"expert": 0.5052878856658936
} |
14,699 | exec sudo xmrig --user=${POOL_USER} --url=${POOL_URL} ${PASS_OPTS} ${THREAD_OPTS} --coin=monero \
--cpu-priority=${CPU_PRIORITY} \
--donate-level=$DONATE_LEVEL \
${OTHERS_OPTS}
I need to output the logs of this command to /logs/main.log and also the docker logs | 2b4be44d352d83e5605f546b9bf5a8aa | {
"intermediate": 0.45723846554756165,
"beginner": 0.25224167108535767,
"expert": 0.2905198633670807
} |
14,700 | I've an asp.net core with reactjs project, this is the server-side code for an upload process: " [HttpPost("/admin/uploadtask")]
public async Task<IActionResult> UploadTask([FromForm] imgRequest request)
{
int id = request.Id;
IFormFile file = request.File;
// Check if a file was uploaded
if (file == null || file.Length <= 0)
{
return BadRequest();
}
// Generate a unique filename for the uploaded file
var fileName = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName);
// Define the folder path to save the uploaded images
var uploadsFolder = Path.Combine(Directory.GetCurrentDirectory(), "ClientApp", "public", "taskimgs");
// Create the uploads folder if it doesn’t exist
if (!Directory.Exists(uploadsFolder))
{
Directory.CreateDirectory(uploadsFolder);
}
// Save the uploaded file to the server
var filePath = Path.Combine(uploadsFolder, fileName);
using (var stream = new FileStream(filePath, FileMode.Create))
{
await file.CopyToAsync(stream);
}
var set = await _context.Tasks.Where(x => x.Id == id).FirstOrDefaultAsync();
// Store the file path in your data model or database
var imagePath = "ClientApp/public/taskimgs/" + fileName;
if (set.StaticImgs == null)
{
set.StaticImgs = string.Join(",", imagePath);
}
else
{
set.StaticImgs = set.StaticImgs + string.Join(",", imagePath);
}
await _context.SaveChangesAsync();
// Logic to update the database or save the file path in your data model
// …
return Ok();
}" i wanna be able to save multiple file paths inside set.staticImgs but it ends up only saving one path | 97aebe13629fad0a788624d21ee554e2 | {
"intermediate": 0.4086690843105316,
"beginner": 0.26389428973197937,
"expert": 0.32743656635284424
} |
14,701 | i am running into this error with my code:
ERROR: Mismatch in the CFITSIO_SONAME value in the fitsio.h include file
that was used to build the CFITSIO library, and the value in the include file
that was used when compiling the application program:
Version used to build the CFITSIO library = 8
Version included by the application program = 10 | 7afa022a9bcb2746737cdde87b1b53c8 | {
"intermediate": 0.6027587056159973,
"beginner": 0.1478353589773178,
"expert": 0.24940598011016846
} |
14,702 | Hi can you parse picture | 373f74350cf276b2eebc880c139a8d04 | {
"intermediate": 0.30017051100730896,
"beginner": 0.47084423899650574,
"expert": 0.22898529469966888
} |
14,703 | hi please export the html table to excel using xlxs.js <table id="ECR">
<tr class="table title">
<th colspan="12">Engineering Change Request <br /> (ECR) 工程变更申请
</th>
</tr>
<tr>
<th>ECR NO. <br />ECR 编号
</th>
<td colspan="2" th:text="*{ecrNo}">44433</td>
<th>Request Date<br /> 申请日期
</th>
<td colspan="2" th:text="${#dates.format(ecrRequest.requestDate, 'yyyy-MM-dd')}"></td>
<th>Request Dept. <br />申请部门
</th>
<td colspan="2" th:text="*{requestDept}"></td>
<th>Applicant<br />申请人
</th>
<td colspan="2" th:text="*{applicant}"></td>
</tr>
<tr th:each="p : ${ecrProjects}">
<th>Account <br />客户
</th>
<td colspan="2" th:text="${p.keyAccount}"></td>
<th>Project Name <br />项目名称
</th>
<td colspan="2" th:text="${p.projectName}"></td>
<th>Product Name <br />产品名称
</th>
<td colspan="2" th:text="${p.productName}"></td>
<th>Item Code<br />机型
</th>
<td colspan="2" th:text="${p.itemCode}"></td>
</tr>
<tr class="table">
<th colspan="6">Description of Change 变更描述</th>
<th colspan="6">Change Type 变更类型</th>
</tr>
<tr>
<td colspan="6" th:text="*{changeDescription}" rowspan="5"></td>
<td colspan="3" th:text="*{changeTypeTxt}" class="only-left-border"></td>
<td colspan="3" th:text="*{othersChangeType}" class="no-border"></td>
</tr>
<tr>
<td colspan="3" th:text="*{changeTypeTxt}" class="only-left-border"></td>
<td colspan="3" th:text="*{othersChangeType}" class="no-border"></td>
</tr>
<tr>
<td colspan="3" th:text="*{changeTypeTxt}" class="only-left-border"></td>
<td colspan="3" th:text="*{othersChangeType}" class="no-border"></td>
</tr>
<tr>
<td colspan="3" th:text="*{changeTypeTxt}" class="only-left-border"></td>
<td colspan="3" th:text="*{othersChangeType}" class="no-border"></td>
</tr>
<tr>
<td colspan="3" th:text="*{changeTypeTxt}" class="only-left-bottom-border"></td>
<td colspan="3" th:text="*{othersChangeType}" class="only-bottom-border"></td>
</tr>
<tr>
<th colspan="3">Reason of Change <br />变更原因
</th>
<td colspan="9" th:text="*{changeReason}"></td>
</tr>
<tr>
<th colspan="3">Customer Requirement <br />客户要求
</th>
<td colspan="5" th:text="*{customerRequirement}"></td>
<td colspan="2" th:text="*{ecrRequired}"><input type="checkbox"/>No ECR Required <br/>无ECR要求</td>
<td colspan="2" th:text="*{ecrRequired}"><input type="checkbox"/>ECR required <br/>客户ECR要求</td>
</tr>
</table> | 047a0eb4689a4c60c597688ad3d88ebf | {
"intermediate": 0.15427877008914948,
"beginner": 0.6578730344772339,
"expert": 0.18784818053245544
} |
14,704 | html table td 上下居中 | b15c12f25b489defdfc3ef0c7e85c193 | {
"intermediate": 0.3048612177371979,
"beginner": 0.3680623471736908,
"expert": 0.3270765244960785
} |
14,705 | can you code | a1a3e085e0d620d347e9671ac355f495 | {
"intermediate": 0.25432342290878296,
"beginner": 0.3138555884361267,
"expert": 0.43182098865509033
} |
14,706 | I've an asp.net core with reactjs project, this is the data from controller: "var data = new getTask();
data.tosk = set;
data.stattxt = nextItem;
return Ok(data);" write a code to get that data in my react component using axios | 23273260ae70bb6668da5e432b7abef9 | {
"intermediate": 0.5367564558982849,
"beginner": 0.26188039779663086,
"expert": 0.20136308670043945
} |
14,707 | mysql connector net 64bit | 58c72ef1a1fa9a8bb1c442469c5a957f | {
"intermediate": 0.3817654550075531,
"beginner": 0.3271879255771637,
"expert": 0.2910466194152832
} |
14,708 | Map<String, Object> tslMap = tsls.stream().filter((tslPropertie) -> Objects.nonNull(tslPropertie.getCode()))
.collect(HashMap::new, (m, v) -> m.put(v.getCode(), v.getUpValue()), HashMap::putAll);
if (CollectionUtils.isNotEmpty(qo.getTslPropsList())) {
for (String prop : qo.getTslPropsList()) {
data.add(Objects.isNull(tslMap.get(prop)) ? "" : tslMap.get(prop).toString());
}
}优化代码 | d031c64f3e40e816c36e9e533e8dafc2 | {
"intermediate": 0.35208070278167725,
"beginner": 0.32608234882354736,
"expert": 0.3218369781970978
} |
14,709 | hi there | 0e62da5649a041942b5af71d505be3b2 | {
"intermediate": 0.32885003089904785,
"beginner": 0.24785484373569489,
"expert": 0.42329514026641846
} |
14,710 | export checkbox in html table to excel and display checkbox using xlxs.jx | 11b9bd78ae4c14bffb30acf3f0e3cb70 | {
"intermediate": 0.4167868196964264,
"beginner": 0.24655236303806305,
"expert": 0.33666080236434937
} |
14,711 | def perform_ner_label(comment):
doc = nlp(comment)
entities = [ent.label for ent in doc.ents]
return entities
I want it to return The possible labels that the en_core_web_sm model can assign to entities, ie:
1. PERSON: Refers to names of people, including both given names and surnames.
2. NORP: Stands for Nationalities or Religious or Political groups.
3. FAC: Represents buildings, airports, highways, bridges, etc.
4. ORG: Denotes organizations, including companies, agencies, institutions, etc.
5. GPE: Represents countries, cities, states, or provinces.
6. LOC: Refers to non-GPE locations, such as mountains, bodies of water, or regions.
7. PRODUCT: Represents tangible products, including items and objects.
8. EVENT: Denotes named events, such as sports events, wars, or festivals.
9. WORK_OF_ART: Represents | edd9521300918b16b9c68e8856fc37a2 | {
"intermediate": 0.3050558865070343,
"beginner": 0.3188577890396118,
"expert": 0.3760862946510315
} |
14,712 | how to add checkbox in EXCELJS ,please dont write code in ES5 | a0e676b5d86aa1f35d591a3ba01ed149 | {
"intermediate": 0.6740010380744934,
"beginner": 0.17141760885715485,
"expert": 0.15458130836486816
} |
14,713 | wpf xceed 的propertygrid枚举显示中文 | 61f4ff2d0545763ef2780821ac87aebf | {
"intermediate": 0.3048321604728699,
"beginner": 0.3543037474155426,
"expert": 0.3408640921115875
} |
14,714 | 本地跑hangfire报错System.Data.SqlClient.SqlException:“A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)” | 77083798963c47443ee0c169f8a6f919 | {
"intermediate": 0.39626288414001465,
"beginner": 0.29983556270599365,
"expert": 0.3039015829563141
} |
14,715 | wpf xceed 的propertygrid枚举显示中文完整例子 | 8aba8c5d7e633e0a23da7bb915bec51d | {
"intermediate": 0.3228011131286621,
"beginner": 0.3584921360015869,
"expert": 0.31870678067207336
} |
14,716 | how to add image in xlxs.js | b450a43edb2de68bc5aaa2471ec08097 | {
"intermediate": 0.44103357195854187,
"beginner": 0.23997636139392853,
"expert": 0.318990021944046
} |
14,717 | flutter get url to unit8list fluttr | 7cea1e04f951d46af22d9b991ca6e15e | {
"intermediate": 0.4452053904533386,
"beginner": 0.2713964581489563,
"expert": 0.2833981215953827
} |
14,718 | av_seek_frame怎么跳转到0 | b74fae7fc33f21fbde1505db472a48f6 | {
"intermediate": 0.3175753951072693,
"beginner": 0.25880226492881775,
"expert": 0.42362233996391296
} |
14,719 | import EditorJS from "@editorjs/editorjs";
import Header from "@editorjs/header";
import AttachesTool from "@editorjs/attaches";
export default defineNuxtPlugin(async ({ $config }) => {
const defaultOptions = {
id: "",
data: {},
onChange: () => {},
placeholder: "",
};
const editor = (options = defaultOptions) => {
return new EditorJS({
initialBlock: "paragraph",
placeholder: options.placeholder,
holder: options.id,
tools: {
header: {
class: Header,
inlineToolbar: true,
},
AttachesTool: {
class: AttachesTool,
},
},
data: options.data || {},
onChange(data) {
options.onChange(data);
},
});
};
const EidtorObj = {
editor,
};
return {
provide: {
editorOBJ: () => EidtorObj,
},
};
});
how can i use in my nuxt 3 app please | c38319734e776f4e0c5966f10d8b4d2a | {
"intermediate": 0.5428124070167542,
"beginner": 0.24541884660720825,
"expert": 0.2117687165737152
} |
14,720 | is this correct for assigning the variable as an array? "const itemData = taskData.find((data) => data.itemId === item.id)[];" | 8fb46b7ac3d36398861b129dfd0e14dc | {
"intermediate": 0.4774434268474579,
"beginner": 0.32819339632987976,
"expert": 0.19436319172382355
} |
14,721 | im having complications with a project | b18da2e0770da77ffa8576d007de917b | {
"intermediate": 0.4038264751434326,
"beginner": 0.267558217048645,
"expert": 0.3286152482032776
} |
14,722 | make python pogram to convert english audio to hindi audio | 5ab86fb89e7aaace87da3b753f95d1a6 | {
"intermediate": 0.36061322689056396,
"beginner": 0.20435796678066254,
"expert": 0.4350288510322571
} |
14,723 | make one python code convert english audio to hindi audio | 2046c77faf33c8e9f4f4fa5fc16cc05e | {
"intermediate": 0.3337347209453583,
"beginner": 0.22571615874767303,
"expert": 0.4405490756034851
} |
14,724 | init_waitqueue_head | 8f7c9eadae87c5f0fbd477403d344b90 | {
"intermediate": 0.29248425364494324,
"beginner": 0.3238227367401123,
"expert": 0.38369300961494446
} |
14,725 | cannot unpack non-iterable coroutine object | 97136056262922fb68fb9b28e37131a9 | {
"intermediate": 0.4024198651313782,
"beginner": 0.3614089787006378,
"expert": 0.236171156167984
} |
14,726 | Wirte hello 100 times, reply as api call make | 331067701ab713cd54d2c85cc44b7478 | {
"intermediate": 0.4048025906085968,
"beginner": 0.3982401490211487,
"expert": 0.1969572901725769
} |
14,727 | Your are a professonal code enginer and good at python, wreite snake mini game use console framework. each component per text file | a3425dbbec4b4b2002e8c3a9d2714f7f | {
"intermediate": 0.5145037770271301,
"beginner": 0.3515084385871887,
"expert": 0.13398776948451996
} |
14,728 | create custom pdf viewer by pdf.js flutter package | f03871c48067f6567cfdb20e75653d90 | {
"intermediate": 0.5754985809326172,
"beginner": 0.15910963714122772,
"expert": 0.26539182662963867
} |
14,729 | view pdf link by flutter | c8bb2e265fd6c59fc3fb7868e914dd7a | {
"intermediate": 0.3667823374271393,
"beginner": 0.26563623547554016,
"expert": 0.3675815165042877
} |
14,730 | view document flutter web | f64cc6b9a2ece471ae943fc83b9cdf0f | {
"intermediate": 0.4000380039215088,
"beginner": 0.22355958819389343,
"expert": 0.37640243768692017
} |
14,731 | a group numbers {1,2,5,10,20,50}, Choose up to 5 numbers to form a combination, use c# | b7ba412f2bcbacfae7d61fd5bfe7d8fb | {
"intermediate": 0.42424583435058594,
"beginner": 0.2942914664745331,
"expert": 0.281462699174881
} |
14,732 | python | 02441bc99e51bb5f8593ef275e9b572e | {
"intermediate": 0.32483333349227905,
"beginner": 0.3036218583583832,
"expert": 0.37154486775398254
} |
14,733 | got this error: "System.InvalidOperationException: Queries performing 'LastOrDefault' operation must have a deterministic sort order. Rewrite the query to apply an 'OrderBy' operation on the sequence before calling 'LastOrDefault'." | 7a8d585210cf9ad80c7e75dc1ce78415 | {
"intermediate": 0.4393787384033203,
"beginner": 0.18824215233325958,
"expert": 0.3723790943622589
} |
14,734 | in terms of implement a wait queue machanism in freertos, which one is better to use, Queue or Eventgroup | 11a2126dc2766669d9336e3b7c45e821 | {
"intermediate": 0.2993660867214203,
"beginner": 0.19122208654880524,
"expert": 0.5094118118286133
} |
14,735 | public async static Task<K> Post<K>(IHttpClientFactory clientFactory, string url, object objPara)
{
try
{
var client = clientFactory.CreateClient();
StringContent content = new StringContent(objPara.ToJson());
content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
//var source = HttpContextUtil.Current.Request.Headers["Source"].ToString();
//var authCode = HttpContextUtil.Current.Request.Headers["AuthToken"].ToString();
//content.Headers.Add("Source", source);
//content.Headers.Add("AuthToken", authCode);
var respMsg = await client.PostAsync(url, content);//url中不能有//
string msgBody = await respMsg.Content.ReadAsStringAsync();
LogUtil.Info( "返回结果"+msgBody);
return msgBody.ToObject<K>();
}
catch (Exception ex)
{
LogUtil.Error($"HttpClientPost错误{url} =={ex.Message}");
throw new Exception($"HttpClientPost错误{url}");
}
} 这段代码中如何设置请求超时时间限制 | 53cf089afc64fab980ea7bbcf669a6ca | {
"intermediate": 0.43656232953071594,
"beginner": 0.3460133969783783,
"expert": 0.21742433309555054
} |
14,736 | in freertos, implement init_waitqueue_head(), init_waitqueue_entry(), add_wait_queue(), wake_up(), wake_up_all() for me | 0cb54b90f1e619f7600b73c5d1a27859 | {
"intermediate": 0.4840206205844879,
"beginner": 0.1549629420042038,
"expert": 0.3610164225101471
} |
14,737 | A set of numbers {1,2,5,10,20,50}, extract one number from the group at a time, up to 5 times, repeatable, using c# | a260b1e01e051d6dca1113e20f943e37 | {
"intermediate": 0.3902026414871216,
"beginner": 0.26694488525390625,
"expert": 0.34285247325897217
} |
14,738 | A set of numbers {1,2,5,10,20,50}, with a maximum of 5 repeatable numbers selected for each combination, using c# | 276735c3321dea3de41f887e129114a8 | {
"intermediate": 0.30362051725387573,
"beginner": 0.3239589333534241,
"expert": 0.3724205195903778
} |
14,739 | implement the freertos version of init_waitqueue_head() using Queue | 62c33ff70985c5b413cda77c96cc4b35 | {
"intermediate": 0.43035510182380676,
"beginner": 0.18565277755260468,
"expert": 0.38399213552474976
} |
14,740 | Reorder English alphabets into similarity and simplicity. | 8167a1a50fac132ebef5f39dfabaf91f | {
"intermediate": 0.4441942274570465,
"beginner": 0.27921944856643677,
"expert": 0.2765863239765167
} |
14,741 | is there any tool that makes custom automatic scheduled searches at google or other search engines ? | aa709f6f2321898ebef2be0dfa92a24f | {
"intermediate": 0.25271356105804443,
"beginner": 0.19922268390655518,
"expert": 0.5480637550354004
} |
14,742 | create pdfviewer with pdf.js by javascript and add in flutter | 93cf8d600a2cae76a64ba15ad036d03d | {
"intermediate": 0.5890128016471863,
"beginner": 0.15743876993656158,
"expert": 0.2535484731197357
} |
14,743 | wait_queue_head_t, task_struct, wait_queue_entry, give me detailed infromation | ead70ebf035b242f59bb62669e1b750a | {
"intermediate": 0.39695295691490173,
"beginner": 0.19348099827766418,
"expert": 0.4095660448074341
} |
14,744 | in freertos, implement freertos version of init_waitqueue_head(), init_waitqueue_entry(), add_wait_queue(), wake_up(), wake_up_all() for me, using onlt eventgroup and Task | 13ff2379dbc2b4d21a8f5d5168140f76 | {
"intermediate": 0.5186711549758911,
"beginner": 0.12145920097827911,
"expert": 0.3598696291446686
} |
14,745 | I used your signal generator code: def signal_generator(df):
# Calculate EMA and MA lines
df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
df['MA10'] = df['Close'].rolling(window=10).mean()
df['MA20'] = df['Close'].rolling(window=20).mean()
df['MA50'] = df['Close'].rolling(window=50).mean()
df['MA100'] = df['Close'].rolling(window=100).mean()
# Extract necessary prices from df
open_price = df.Open.iloc[-1]
close_price = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]
# Calculate the last candlestick
last_candle = df.iloc[-1]
current_price = df.Close.iloc[-1]
# Initialize analysis variables
ema_analysis = []
candle_analysis = []
if (
df['EMA5'].iloc[-1] > df['EMA10'].iloc[-1] > df['EMA20'].iloc[-1] > df['EMA50'].iloc[-1] >
df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1]
):
ema_analysis.append('buy')
elif (
df['EMA5'].iloc[-1] < df['EMA10'].iloc[-1] < df['EMA20'].iloc[-1] < df['EMA50'].iloc[-1] <
df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1]
):
ema_analysis.append('sell')
if (
open_price < close_price and
previous_open > previous_close and
close_price > previous_open and
open_price <= previous_close
):
candle_analysis.append('buy')
elif (
open_price > close_price and
previous_open < previous_close and
close_price < previous_open and
open_price >= previous_close
):
candle_analysis.append('sell')
stop_loss_price = current_price * (1 - STOP_LOSS_PERCENTAGE / 100)
if (
'buy' in ema_analysis and
'buy' in candle_analysis and
current_price > df['EMA200'].iloc[-1] and
current_price > stop_loss_price
):
final_signal = 'buy'
elif (
'sell' in ema_analysis and
'sell' in candle_analysis and
current_price < df['EMA200'].iloc[-1] and
current_price < stop_loss_price
):
final_signal = 'sell'
else:
final_signal = ''
return final_signal
But it deosn't give me any signals | 5f9aee68c39ab7f23c6aaa4dbae4e1e8 | {
"intermediate": 0.30274510383605957,
"beginner": 0.4068290591239929,
"expert": 0.2904258072376251
} |
14,746 | I've an asp.net core project, how do i add a nullcheck to this code: "var current = _context.StaticMsgs.Where(x => x.Txt == checkagain.StaticTxt).FirstOrDefault();"? | 668dfedcb2d988ed55befa7069e4a828 | {
"intermediate": 0.6319811344146729,
"beginner": 0.19240786135196686,
"expert": 0.17561104893684387
} |
14,747 | pandas how to copy datataframe with list of specific columns? | eb219fa158c0f36a71b0040db9400133 | {
"intermediate": 0.7668460607528687,
"beginner": 0.081712506711483,
"expert": 0.15144148468971252
} |
14,748 | #include “FreeRTOS.h”
#include “task.h”
#include “event_groups.h”
typedef struct wait_queue_entry {
TaskHandle_t task;
struct wait_queue_entry* next;
} WaitQueueEntry_t;
typedef struct wait_queue_head {
WaitQueueEntry_t* head;
WaitQueueEntry_t* tail;
EventGroupHandle_t eventGroup;
} WaitQueueHead_t;
void init_waitqueue_head(WaitQueueHead_t* waitqueue)
{
waitqueue->head = NULL;
waitqueue->tail = NULL;
waitqueue->eventGroup = xEventGroupCreate();
}
void init_waitqueue_entry(WaitQueueEntry_t* waitqueue_entry, TaskHandle_t task)
{
waitqueue_entry->task = task;
waitqueue_entry->next = NULL;
}
void add_wait_queue(WaitQueueHead_t* waitqueue, WaitQueueEntry_t* waitqueue_entry)
{
waitqueue_entry->next = NULL;
if (waitqueue->head == NULL) {
waitqueue->head = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
} else {
waitqueue->tail->next = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
}
}
void wake_up(WaitQueueHead_t* waitqueue)
{
if (waitqueue->head != NULL) {
WaitQueueEntry_t* first_entry = waitqueue->head;
waitqueue->head = first_entry->next;
if (waitqueue->head == NULL) {
waitqueue->tail = NULL;
}
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
}
}
void wake_up_all(WaitQueueHead_t* waitqueue)
{
WaitQueueEntry_t* current_entry = waitqueue->head;
waitqueue->head = NULL;
waitqueue->tail = NULL;
while (current_entry != NULL) {
WaitQueueEntry_t* next_entry = current_entry->next;
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
current_entry = next_entry;
}
} | fab9e5f96fff7b884ed23b787d72d723 | {
"intermediate": 0.3457939922809601,
"beginner": 0.4012889862060547,
"expert": 0.25291702151298523
} |
14,749 | #include “FreeRTOS.h”
#include “task.h”
#include “event_groups.h”
typedef struct wait_queue_entry {
TaskHandle_t task;
struct wait_queue_entry* next;
} WaitQueueEntry_t;
typedef struct wait_queue_head {
WaitQueueEntry_t* head;
WaitQueueEntry_t* tail;
EventGroupHandle_t eventGroup;
SemaphoreHandle_t mutex;
} WaitQueueHead_t;
void init_waitqueue_head(WaitQueueHead_t* waitqueue)
{
waitqueue->head = NULL;
waitqueue->tail = NULL;
waitqueue->eventGroup = xEventGroupCreate();
waitqueue->mutex = xSemaphoreCreateMutex();
}
WaitQueueEntry_t* create_waitqueue_entry(TaskHandle_t task)
{
WaitQueueEntry_t* entry = pvPortMalloc(sizeof(WaitQueueEntry_t));
if (entry != NULL) {
entry->task = task;
entry->next = NULL;
}
return entry;
}
void destroy_waitqueue_entry(WaitQueueEntry_t* entry)
{
vPortFree(entry);
}
void add_wait_queue(WaitQueueHead_t* waitqueue, WaitQueueEntry_t* waitqueue_entry)
{
xSemaphoreTake(waitqueue->mutex, portMAX_DELAY);
waitqueue_entry->next = NULL;
if (waitqueue->head == NULL) {
waitqueue->head = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
} else {
waitqueue->tail->next = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
}
xSemaphoreGive(waitqueue->mutex);
}
void wake_up(WaitQueueHead_t* waitqueue)
{
xSemaphoreTake(waitqueue->mutex, portMAX_DELAY);
if (waitqueue->head != NULL) {
WaitQueueEntry_t* first_entry = waitqueue->head;
waitqueue->head = first_entry->next;
if (waitqueue->head == NULL) {
waitqueue->tail = NULL;
}
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
}
xSemaphoreGive(waitqueue->mutex);
}
void wake_up_all(WaitQueueHead_t* waitqueue)
{
xSemaphoreTake(waitqueue->mutex, portMAX_DELAY);
WaitQueueEntry_t* current_entry = waitqueue->head;
waitqueue->head = NULL;
waitqueue->tail = NULL;
while (current_entry != NULL) {
WaitQueueEntry_t* next_entry = current_entry->next;
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
destroy_waitqueue_entry(current_entry);
current_entry = next_entry;
}
xSemaphoreGive(waitqueue->mutex);
} | 0c1cd3d386e1e283c03e9678bf366720 | {
"intermediate": 0.28865325450897217,
"beginner": 0.4863218367099762,
"expert": 0.22502490878105164
} |
14,750 | typedef struct wait_queue_entry {
TaskHandle_t task;
struct wait_queue_entry* next;
} WaitQueueEntry_t;
typedef struct wait_queue_head {
WaitQueueEntry_t* head;
WaitQueueEntry_t* tail;
EventGroupHandle_t eventGroup;
} WaitQueueHead_t;
void init_waitqueue_head(WaitQueueHead_t* waitqueue)
{
waitqueue->head = NULL;
waitqueue->tail = NULL;
waitqueue->eventGroup = xEventGroupCreate();
}
void init_waitqueue_entry(WaitQueueEntry_t* waitqueue_entry, TaskHandle_t task)
{
waitqueue_entry->task = task;
waitqueue_entry->next = NULL;
}
void add_wait_queue(WaitQueueHead_t* waitqueue, WaitQueueEntry_t* waitqueue_entry)
{
waitqueue_entry->next = NULL;
if (waitqueue->head == NULL) {
waitqueue->head = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
} else {
waitqueue->tail->next = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
}
}
void wake_up(WaitQueueHead_t* waitqueue)
{
if (waitqueue->head != NULL) {
WaitQueueEntry_t* first_entry = waitqueue->head;
waitqueue->head = first_entry->next;
if (waitqueue->head == NULL) {
waitqueue->tail = NULL;
}
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
}
}
void wake_up_all(WaitQueueHead_t* waitqueue)
{
WaitQueueEntry_t* current_entry = waitqueue->head;
waitqueue->head = NULL;
waitqueue->tail = NULL;
while (current_entry != NULL) {
WaitQueueEntry_t* next_entry = current_entry->next;
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
current_entry = next_entry;
}
} | a7ff7344f38779f0245214347305b007 | {
"intermediate": 0.4202634394168854,
"beginner": 0.2627022862434387,
"expert": 0.31703421473503113
} |
14,751 | [eslint] prettier.resolveConfig.sync is not a function | a406072942466a2bb2b7bbd5bf09e3a0 | {
"intermediate": 0.36505651473999023,
"beginner": 0.3935883045196533,
"expert": 0.24135518074035645
} |
14,752 | how split string in postgresql? | e6382cfa71bf2587242bbf60b4e0de87 | {
"intermediate": 0.4481712281703949,
"beginner": 0.2553688585758209,
"expert": 0.2964599132537842
} |
14,753 | create pdf viewer with pdfjs sample | 6b482cf96c43f9ee9967f7e3c270464f | {
"intermediate": 0.42071616649627686,
"beginner": 0.22588326036930084,
"expert": 0.3534005284309387
} |
14,754 | create soap request html code with below soap request string, html code should have auth login and password, create input box for report id
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Body>
<!-- Retrieve a Report -->
<ns1:retrieveReport soapenv:encodingStyle="http://xml.apache.org/xml-soap/literalxml"
xmlns:ns1="java:com.kiodex.actors.webservices.rpc">
<requestElement client="KRW_WEB_SOAP_TEST" clientVersion="Prod">
<RetrieveReport reportId="3743447630"/>
</requestElement>
</ns1:retrieveReport>
</soapenv:Body>
</soapenv:Envelope> | a116d834b3e905b236c06cea34727943 | {
"intermediate": 0.5043153762817383,
"beginner": 0.26729971170425415,
"expert": 0.228384867310524
} |
14,755 | typedef struct wait_queue_entry {
TaskHandle_t task;
struct wait_queue_entry* next;
} WaitQueueEntry_t;
typedef struct wait_queue_head {
WaitQueueEntry_t* head;
WaitQueueEntry_t* tail;
EventGroupHandle_t eventGroup;
} WaitQueueHead_t;
void init_waitqueue_head(WaitQueueHead_t* waitqueue)
{
waitqueue->head = NULL;
waitqueue->tail = NULL;
waitqueue->eventGroup = xEventGroupCreate();
}
void init_waitqueue_entry(WaitQueueEntry_t* waitqueue_entry, TaskHandle_t task)
{
waitqueue_entry->task = task;
waitqueue_entry->next = NULL;
}
void add_wait_queue(WaitQueueHead_t* waitqueue, WaitQueueEntry_t* waitqueue_entry)
{
waitqueue_entry->next = NULL;
if (waitqueue->head == NULL) {
waitqueue->head = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
} else {
waitqueue->tail->next = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
}
}
void wake_up(WaitQueueHead_t* waitqueue)
{
if (waitqueue->head != NULL) {
WaitQueueEntry_t* first_entry = waitqueue->head;
waitqueue->head = first_entry->next;
if (waitqueue->head == NULL) {
waitqueue->tail = NULL;
}
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
}
}
void wake_up_all(WaitQueueHead_t* waitqueue)
{
WaitQueueEntry_t* current_entry = waitqueue->head;
waitqueue->head = NULL;
waitqueue->tail = NULL;
while (current_entry != NULL) {
WaitQueueEntry_t* next_entry = current_entry->next;
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
current_entry = next_entry;
}
} | 76c8038b0ef67c439a8524ecbfc620d2 | {
"intermediate": 0.4202634394168854,
"beginner": 0.2627022862434387,
"expert": 0.31703421473503113
} |
14,756 | <html>
<head>
<title>SOAP Request</title>
<script>
function submitForm() {
var form = document.getElementById(“soapForm”);
var xhr = new XMLHttpRequest();
var endpoint = “http://webservice.example.com/”; // Specify the SOAP service endpoint here
var username = document.getElementById(“username”).value; // Get the username from the input field
var password = document.getElementById(“password”).value; // Get the password from the input field
form.action = endpoint; // Update the SOAP service endpoint
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var response = xhr.responseText;
alert(response);
} else {
alert(“Error: " + xhr.status);
}
}
};
xhr.open(form.method, form.action, true);
xhr.setRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”);
xhr.send(“xml=” + encodeURIComponent(form.xml.value) +
“&username=” + encodeURIComponent(username) +
“&password=” + encodeURIComponent(password) +
“&reportId=” + encodeURIComponent(form.reportId.value));
return false;
}
</script>
</head>
<body>
<form id=“soapForm” onsubmit=“return submitForm()” method=“POST”>
<input type=“hidden” name=“xml” value=”<?xml version=“1.0” encoding=“UTF-8”?>
<soapenv:Envelope xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns:xsd=“http://www.w3.org/2001/XMLSchema”>
<soapenv:Body>
<!-- Retrieve a Report -->
<ns1:retrieveReport soapenv:encodingStyle=“http://xml.apache.org/xml-soap/literalxml”
xmlns:ns1=“java:com.kiodex.actors.webservices.rpc”>
<requestElement client=“KRW_WEB_SOAP_TEST” clientVersion=“Prod”>
<RetrieveReport reportId=“”/>
</requestElement>
</ns1:retrieveReport>
</soapenv:Body>
</soapenv:Envelope>" />
<input type=“hidden” id=“username” name=“username” value=“your_username” /> <!-- Replace ‘your_username’ with your actual login name -->
<input type=“hidden” id=“password” name=“password” value=“your_password” /> <!-- Replace ‘your_password’ with your actual password -->
<label for=“reportId”>Report ID:</label>
<input type=“text” id=“reportId” name=“reportId” required /><br>
<input type=“submit” value=“Submit” />
</form>
</body>
</html>
the code is not working, the error are creating 4 input box with below ”<?xml, “your_username”,“your_password” and “Submit”. the expected html display should be keep input box for report id and submit button, please fix it | 74b54eec52a84fac779347d5ccc03491 | {
"intermediate": 0.29592469334602356,
"beginner": 0.5559641122817993,
"expert": 0.1481112241744995
} |
14,757 | export excel use exceljs in brower | 5a8f988c149edc9a485d1ec23995ed10 | {
"intermediate": 0.49264854192733765,
"beginner": 0.27944526076316833,
"expert": 0.2279062122106552
} |
14,758 | the cluster IP [IPv4]:10.96.0.1 for service kubernetes/default is not within the service | 7232031704e458d0de5f4fa9a4f6e715 | {
"intermediate": 0.3251815438270569,
"beginner": 0.28817909955978394,
"expert": 0.38663938641548157
} |
14,759 | add cell backgroup color use exceljs | 95194bcc9229926cfb98c070e287d960 | {
"intermediate": 0.4680268168449402,
"beginner": 0.2382354587316513,
"expert": 0.2937377393245697
} |
14,760 | void onSelectAllChange(bool? value) {
setState(() {
selectAllCheckboxValue = value;
// Set the checkbox value for each quotation in the list
for (var quotation in branchmanagerQuotationsList) {
quotation.isChecked = value!;
int? quotationId = quotation.id;
if (quotationId != null) {
if (value!) {
if (!quotationsChecked.contains(quotationId)) {
quotationsChecked.add(quotationId);
}
} else {
quotationsChecked.remove(quotationId);
}
}
debugPrint('quotationsChecked inside onSelectALl: $quotationsChecked');
}
debugPrint('quotationsChecked inside onSelectALl: $quotationsChecked');
});
} this is my function htat handle select ll fucntinoality and here is my child widget with the get checkbox import 'package:custom_pop_up_menu/custom_pop_up_menu.dart';
import 'package:emis_mobile/constants/enums.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:responsive_sizer/responsive_sizer.dart';
class BranchmanagerQuotationWidget extends StatelessWidget {
BranchmanagerQuotationWidget({
super.key,
required this.itemName,
required this.scrollController,
required this.child,
required this.itemInfoPopupChild,
required this.quoteStatus,
this.quoteSyncStatus,
this.isFirstIndex = false,
required this.checkboxValue,
this.selectAllCheckboxValue,
this.unFoundQuote,
required this.onCheckboxChange,
required this.selectAll,
this.onSelectAllChange,
this.onAcceptPressed,
this.onRejectPressed,
this.isChecked = false,
this.quotationSubclassIndex,
this.subclassCode,
});
final String itemName;
final ScrollController scrollController;
final Widget child;
final Widget itemInfoPopupChild;
final CustomPopupMenuController _controller = CustomPopupMenuController();
final QuotationStatus? quoteStatus;
final String? quoteSyncStatus;
bool isChecked; // Add isChecked property
final bool isFirstIndex;
final bool? checkboxValue;
final bool? selectAllCheckboxValue;
final bool selectAll;
final Function(bool?)? onSelectAllChange;
final Function(bool?)? onCheckboxChange;
final String? unFoundQuote;
final Function()? onRejectPressed;
final Function()? onAcceptPressed;
final int? quotationSubclassIndex; // Define quotationSubclassIndex variable
final String? subclassCode; // Define subclassCode variable
BoxShadow getBoxShadow() {
switch (quoteStatus) {
// case QuotationStatus.SUPERVISOR_APPROVED:
// return const BoxShadow(
// color: Colors.green, blurRadius: 3, offset: Offset(1, -4));
// case QuotationStatus.STATISTICIAN_APPROVED:
// return const BoxShadow(
// color: Colors.green, blurRadius: 3, offset: Offset(1, -4));
// case QuotationStatus.REJECTED:
// return const BoxShadow(
// color: Colors.red, blurRadius: 3, offset: Offset(1, -4));
// case QuotationStatus.PENDING:
// return BoxShadow(
// color: Colors.grey.shade300.withOpacity(0.4),
// blurRadius: 10,
// offset: const Offset(2, 5));
// default:
// return BoxShadow(
// color: Colors.grey.shade300.withOpacity(0.4),
// blurRadius: 10,
// offset: const Offset(2, 5));
case QuotationStatus.BRANCH_APPROVED:
return const BoxShadow(
color: Colors.green, blurRadius: 3, offset: Offset(1, -4));
case QuotationStatus.REJECTED:
return const BoxShadow(
color: Colors.red, blurRadius: 3, offset: Offset(1, -4));
case QuotationStatus.STATISTICIAN_APPROVED:
return BoxShadow(
color: Colors.grey.shade300.withOpacity(0.4),
blurRadius: 10,
offset: const Offset(2, 5));
default:
return BoxShadow(
color: Colors.grey.shade300.withOpacity(0.4),
blurRadius: 10,
offset: const Offset(2, 5));
}
}
Widget getStatusWidget() {
switch (quoteStatus) {
// case QuotationStatus.SUPERVISOR_APPROVED:
// return Container(
// decoration: const BoxDecoration(),
// child: Row(
// children: [
// Text('Approved',
// style:
// TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600)),
// SizedBox(width: 1.w),
// SvgPicture.asset('assets/tick.svg', height: 3.h, width: 5.w),
// ],
// ),
// );
// case QuotationStatus.STATISTICIAN_APPROVED:
// return Container(
// decoration: const BoxDecoration(),
// child: Row(
// children: [
// Text('Approved',
// style:
// TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600)),
// SizedBox(width: 1.w),
// SvgPicture.asset('assets/tick.svg', height: 3.h, width: 5.w),
// ],
// ),
// );
case QuotationStatus.BRANCH_APPROVED:
return Container(
decoration: const BoxDecoration(),
child: Row(
children: [
Text('Approved',
style:
TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600)),
SizedBox(width: 1.w),
SvgPicture.asset('assets/tick.svg', height: 3.h, width: 5.w),
],
),
);
case QuotationStatus.REJECTED:
return Container(
decoration: const BoxDecoration(),
child: Row(
children: [
Text('Rejected',
style:
TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600)),
SizedBox(width: 1.w),
SvgPicture.asset('assets/cross.svg', height: 3.h, width: 5.w),
],
),
);
// case QuotationStatus.PENDING:
// return Container(
// decoration: const BoxDecoration(),
// child: const Row(
// children: [],
// ),
// );
case QuotationStatus.STATISTICIAN_APPROVED:
return Container(
decoration: const BoxDecoration(),
child: Row(
children: const [],
),
);
default:
return const SizedBox.shrink();
}
}
// Widget getCheckbox() {
// {
// if (quoteStatus == QuotationStatus.STATISTICIAN_APPROVED ||
// quoteStatus == QuotationStatus.BRANCH_APPROVED ||
// quoteStatus == QuotationStatus.REJECTED) {
// return const SizedBox.shrink();
// } else {
// return Checkbox(
// value: checkboxValue,
// onChanged: onCheckboxChange,
// );
// // return Row(
// // children: [
// // Visibility(
// // visible: selectAll, // Show the "Select All" checkbox
// // child: Checkbox(
// // value: selectAll ? selectAllCheckboxValue : false,
// // onChanged: onSelectAllChange,
// // ),
// // ),
// // Visibility(
// // visible:
// // !selectAll, // Show the individual checkbox if "Select All" is unchecked
// // child: Checkbox(
// // value: !selectAll ? checkboxValue : false,
// // onChanged: onCheckboxChange,
// // ),
// // ),
// // ],
// // );
// // if (selectAll) {
// // // Show the "Select All" checkbox
// // return Checkbox(
// // value: checkboxValue,
// // onChanged: onSelectAllChange,
// // );
// // } else {
// // // Show the individual checkbox if "Select All" is unchecked
// // return Checkbox(
// // value: checkboxValue,
// // onChanged: onCheckboxChange,
// // );
// // }
// }
// }
// }
Widget getCheckbox() {
if (
// quoteStatus == QuotationStatus.STATISTICIAN_APPROVED ||
quoteStatus == QuotationStatus.BRANCH_APPROVED ||
quoteStatus == QuotationStatus.REJECTED) {
return const SizedBox.shrink();
} else {
if (selectAll) {
// Show the "Select All" checkbox
return Checkbox(
value: selectAllCheckboxValue ?? false,
onChanged: onSelectAllChange,
);
} else {
// Show the individual checkbox if "Select All" is unchecked
return Checkbox(
value: checkboxValue ?? false,
onChanged: onCheckboxChange,
);
}
}
}
Widget getApproveRejectBtns() {
if (quoteStatus == QuotationStatus.BRANCH_APPROVED ||
quoteStatus == QuotationStatus.REJECTED) {
return const SizedBox.shrink();
} else {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: onRejectPressed,
child: SvgPicture.asset(
'assets/cross.svg',
height: 3.h,
width: 5.w,
),
),
SizedBox(width: 3.w),
InkWell(
onTap: onAcceptPressed,
child: SvgPicture.asset(
'assets/tick.svg',
height: 3.h,
width: 5.w,
),
),
],
);
}
}
@override
Widget build(BuildContext context) {
debugPrint('BranchmanagerQuotationWidget Screen');
return Stack(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 2.w),
margin: EdgeInsets.only(top: isFirstIndex ? 1.h : 0),
decoration: BoxDecoration(
// color: Colors.white,
// boxShadow: [getBoxShadow()],
borderRadius: BorderRadius.circular(10.0),
),
child: SizedBox(
height: 18.h,
// height: 21.h,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//
// getCheckbox(),
SizedBox(
width: 95.w,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
//
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//* checkbox for multiple selection
getCheckbox(),
Text(itemName,
style: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.w600,
color: Colors.black)),
SizedBox(width: 1.w),
CustomPopupMenu(
menuBuilder: () => ClipRRect(
borderRadius: BorderRadius.circular(5),
child: itemInfoPopupChild),
pressType: PressType.singleClick,
verticalMargin: -10,
controller: _controller,
child: const Icon(Icons.info),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// quoteSyncStatus != null
// ? const SizedBox.shrink()
// :
Row(
children: [
quoteStatus !=
QuotationStatus
.SUPERVISOR_APPROVED ||
quoteStatus ==
QuotationStatus.REJECTED ||
quoteStatus ==
QuotationStatus
.STATISTICIAN_APPROVED ||
quoteStatus ==
QuotationStatus.BRANCH_APPROVED
// quoteSyncStatus != null
? const SizedBox.shrink()
: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
InkWell(
onTap: onRejectPressed,
child: SvgPicture.asset(
'assets/cross.svg',
height: 3.h,
width: 5.w)),
SizedBox(width: 3.w),
InkWell(
onTap: onAcceptPressed,
child: SvgPicture.asset(
'assets/tick.svg',
height: 3.h,
width: 5.w)),
],
),
getStatusWidget(),
getApproveRejectBtns(),
],
),
],
)
//
],
),
),
],
),
const Divider(color: Colors.black),
SizedBox(height: 1.h),
//
child
//
],
),
),
),
],
);
}
}
now in my branchComponenet when i get the checkbox Checkbox(
value: selectAllCheckboxValue ?? false,
// onChanged: (value) {
// setState(() {
// for (var quotation
// in branchmanagerQuotationsList) {
// quotation.isChecked = value!;
// }
// isAllSelected = value!;
// });
// },
onChanged: (value) {
setState(() {
selectAllCheckboxValue = value;
for (var quotation
in branchmanagerQuotationsList) {
quotation.isChecked = value!;
int? quotationId = quotation.id;
if (quotationId != null) {
if (value!) {
if (!quotationsChecked
.contains(quotationId)) {
quotationsChecked
.add(quotationId);
}
} else {
quotationsChecked
.remove(quotationId);
}
}
}
});
debugPrint(
'Selected quotations: $quotationsChecked');
debugPrint(
'Select All checkbox new value: $value');
},
),
selecting the top level check box also selects the subclasses in the list of subclasses but the valuse in quotationsChecked is of the initial subclass selected, so how do i fix the ui from displaying other subclasses as selected | d2d71ff715a60900505f81cd4cded3f7 | {
"intermediate": 0.3442310392856598,
"beginner": 0.45595070719718933,
"expert": 0.19981831312179565
} |
14,761 | how to merge dataframes by index (without columns) | a1f15e15e2add892b26fbc87fbba0c81 | {
"intermediate": 0.4487006962299347,
"beginner": 0.1978597640991211,
"expert": 0.3534395396709442
} |
14,762 | base on this implementation, implement wait_event() and wait_event_timeout() as well | cb6e991d44c1ab890e91a60456b8de8f | {
"intermediate": 0.5326664447784424,
"beginner": 0.21397627890110016,
"expert": 0.25335726141929626
} |
14,763 | not fgbcolor, i want bgcolor | a6f90562acf5dc7c3a788d53d4658a23 | {
"intermediate": 0.43394479155540466,
"beginner": 0.32738202810287476,
"expert": 0.2386731654405594
} |
14,764 | I used your signal_generator code: def signal_generator(df):
# Calculate EMA and MA lines
df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
df['MA10'] = df['Close'].rolling(window=10).mean()
df['MA20'] = df['Close'].rolling(window=20).mean()
df['MA50'] = df['Close'].rolling(window=50).mean()
df['MA100'] = df['Close'].rolling(window=100).mean()
# Extract necessary prices from df
open_price = df.Open.iloc[-1]
close_price = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]
# Calculate the last candlestick
last_candle = df.iloc[-1]
current_price = df.Close.iloc[-1]
# Initialize analysis variables
ema_analysis = []
candle_analysis = []
if (
df['EMA5'].iloc[-1] > df['EMA10'].iloc[-1] > df['EMA20'].iloc[-1] > df['EMA50'].iloc[-1] >
df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1]
):
ema_analysis.append('buy')
elif (
df['EMA5'].iloc[-1] < df['EMA10'].iloc[-1] < df['EMA20'].iloc[-1] < df['EMA50'].iloc[-1] <
df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1]
):
ema_analysis.append('sell')
if (
open_price < close_price and
previous_open > previous_close and
close_price > previous_open and
open_price <= previous_close
):
candle_analysis.append('buy')
elif (
open_price > close_price and
previous_open < previous_close and
close_price < previous_open and
open_price >= previous_close
):
candle_analysis.append('sell')
stop_loss_price = current_price * (1 - STOP_LOSS_PERCENTAGE / 100)
if (
'buy' in ema_analysis and
'buy' in candle_analysis and
current_price > df['EMA200'].iloc[-1] and
current_price > stop_loss_price
):
final_signal = 'buy'
elif (
'sell' in ema_analysis and
'sell' in candle_analysis and
current_price < df['EMA200'].iloc[-1] and
current_price < stop_loss_price
):
final_signal = 'sell'
else:
final_signal = ''
return final_signal
But it doesn't give me any signal , please can you remove stop loss code | f56beab5d6e15882e84882946055ca3c | {
"intermediate": 0.2997172772884369,
"beginner": 0.38458043336868286,
"expert": 0.31570228934288025
} |
14,765 | #include “FreeRTOS.h”
#include “task.h”
#include “event_groups.h”
typedef struct wait_queue_entry {
TaskHandle_t task;
struct wait_queue_entry* next;
} WaitQueueEntry_t;
typedef struct wait_queue_head {
WaitQueueEntry_t* head;
WaitQueueEntry_t* tail;
EventGroupHandle_t eventGroup;
} WaitQueueHead_t;
void init_waitqueue_head(WaitQueueHead_t* waitqueue)
{
waitqueue->head = NULL;
waitqueue->tail = NULL;
waitqueue->eventGroup = xEventGroupCreate();
}
void init_waitqueue_entry(WaitQueueEntry_t* waitqueue_entry, TaskHandle_t task)
{
waitqueue_entry->task = task;
waitqueue_entry->next = NULL;
}
void add_wait_queue(WaitQueueHead_t* waitqueue, WaitQueueEntry_t* waitqueue_entry)
{
waitqueue_entry->next = NULL;
if (waitqueue->head == NULL) {
waitqueue->head = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
} else {
waitqueue->tail->next = waitqueue_entry;
waitqueue->tail = waitqueue_entry;
}
}
void wake_up(WaitQueueHead_t* waitqueue)
{
if (waitqueue->head != NULL) {
WaitQueueEntry_t* first_entry = waitqueue->head;
waitqueue->head = first_entry->next;
if (waitqueue->head == NULL) {
waitqueue->tail = NULL;
}
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
}
}
void wake_up_all(WaitQueueHead_t* waitqueue)
{
WaitQueueEntry_t* current_entry = waitqueue->head;
waitqueue->head = NULL;
waitqueue->tail = NULL;
while (current_entry != NULL) {
WaitQueueEntry_t* next_entry = current_entry->next;
if (waitqueue->head != NULL) {
xEventGroupSetBits(waitqueue->eventGroup, (1 << 0));
}
current_entry = next_entry;
}
} | 812606f8cda451bb2e19335f3d311c4e | {
"intermediate": 0.37754836678504944,
"beginner": 0.4013381898403168,
"expert": 0.22111345827579498
} |
14,766 | what does parse mean in python | f7a21ef4b23205488c162a71730ea2bf | {
"intermediate": 0.415045827627182,
"beginner": 0.3498401641845703,
"expert": 0.23511400818824768
} |
14,767 | void wait_event(WaitQueueHead_t* waitqueue, int condition)
{
while (1) {
// Block the task until the event is signaled
xEventGroupWaitBits(waitqueue->eventGroup, (1 << 0), pdFALSE, pdFALSE, portMAX_DELAY);
// Check the condition after waking up
if (condition == 0) {
break;
}
}
}
int wait_event_timeout(WaitQueueHead_t* waitqueue, int condition, TickType_t timeout)
{
TickType_t startTime = xTaskGetTickCount();
while (1) {
// Calculate the remaining time for timeout
TickType_t elapsedTime = xTaskGetTickCount() - startTime;
TickType_t remainingTime = timeout - elapsedTime;
if (remainingTime <= 0) {
// Timeout occurred
return -1;
}
// Wait with the remaining time for the event to be signaled
EventBits_t bits = xEventGroupWaitBits(waitqueue->eventGroup, (1 << 0), pdFALSE, pdFALSE, remainingTime);
if (bits & (1 << 0)) {
// Event was signaled within the remaining time
} else {
// Timeout occurred
return -1;
}
// Check the condition after waking up
if (condition == 0) {
break;
}
}
return 0;
} | c4e363e8452f21dd05d721e445ecb315 | {
"intermediate": 0.42784973978996277,
"beginner": 0.3141542375087738,
"expert": 0.2579960227012634
} |
14,768 | void wait_event(WaitQueueHead_t* waitqueue, int condition)
{
while (condition != 0) {
// Check the condition before blocking the task
if (condition == 0) {
break;
}
// Block the task until the event is signaled
EventBits_t bits = xEventGroupWaitBits(waitqueue->eventGroup, (1 << 0), pdFALSE, pdFALSE, portMAX_DELAY);
// Update the condition based on whether the event was signaled
condition = (bits & (1 << 0)) ? condition : 1;
}
}
int wait_event_timeout(WaitQueueHead_t* waitqueue, int condition, TickType_t timeout)
{
TickType_t startTime = xTaskGetTickCount();
while (condition != 0) {
// Check the condition before blocking the task
if (condition == 0) {
break;
}
// Calculate the remaining time for timeout
TickType_t elapsedTime = xTaskGetTickCount() - startTime;
TickType_t remainingTime = timeout - elapsedTime;
if (remainingTime <= 0) {
// Timeout occurred
return -1;
}
// Wait with the remaining time for the event to be signaled
EventBits_t bits = xEventGroupWaitBits(waitqueue->eventGroup, (1 << 0), pdFALSE, pdFALSE, remainingTime);
if (bits & (1 << 0)) {
// Event was signaled within the remaining time
condition = 0;
} else {
// Timeout occurred
return -1;
}
}
return 0;
} | 6988c7bfd4dad06bc0881a474624c673 | {
"intermediate": 0.4343721568584442,
"beginner": 0.28384095430374146,
"expert": 0.2817869186401367
} |
14,769 | pdf.js not working | fb10de784846bda22821a9b996e95bfa | {
"intermediate": 0.2288663238286972,
"beginner": 0.48808228969573975,
"expert": 0.283051460981369
} |
14,770 | void wait_event(WaitQueueHead_t* waitqueue, int condition)
{
while (condition != 0) {
// Check the condition before blocking the task
if (condition == 0) {
break;
}
// Block the task until the event is signaled
EventBits_t bits = xEventGroupWaitBits(waitqueue->eventGroup, (1 << 0), pdFALSE, pdFALSE, portMAX_DELAY);
// Update the condition based on whether the event was signaled
condition = (bits & (1 << 0)) ? condition : 1;
}
}
int wait_event_timeout(WaitQueueHead_t* waitqueue, int condition, TickType_t timeout)
{
TickType_t startTime = xTaskGetTickCount();
while (condition != 0) {
// Check the condition before blocking the task
if (condition == 0) {
break;
}
// Calculate the remaining time for timeout
TickType_t elapsedTime = xTaskGetTickCount() - startTime;
TickType_t remainingTime = timeout - elapsedTime;
if (remainingTime <= 0) {
// Timeout occurred
return -1;
}
// Wait with the remaining time for the event to be signaled
EventBits_t bits = xEventGroupWaitBits(waitqueue->eventGroup, (1 << 0), pdFALSE, pdFALSE, remainingTime);
if (bits & (1 << 0)) {
// Event was signaled within the remaining time
condition = 0;
} else {
// Timeout occurred
return -1;
}
}
return 0;
} | 720d96078c50cbf463a85c46a6a0058f | {
"intermediate": 0.4343721568584442,
"beginner": 0.28384095430374146,
"expert": 0.2817869186401367
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.