row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
31,721
|
Generate me a shooting game on Scratch
|
5ae77a6ac2fd4e16eb02390b240357e0
|
{
"intermediate": 0.32303953170776367,
"beginner": 0.4134816825389862,
"expert": 0.2634787857532501
}
|
31,722
|
give me the html, javascript and css for a date slider control for the years 1860 to 1900. The control progress in 5 year stages. The control should have 'play' and 'pause' controls to progress along the control.
|
ba28f3a9ecff6dea0028a7e0a307a74a
|
{
"intermediate": 0.5229098200798035,
"beginner": 0.18320995569229126,
"expert": 0.2938802242279053
}
|
31,723
|
Vx’ = 𝛽*w/m*pVx0/sqrt[𝑝𝑉𝑥₀^2 + (−𝑝𝑦₀𝑡 + 𝑝𝑉𝑦₀)^2],
Vy’ = 𝛽*w/m*pVy0/sqrt[𝑝𝑉𝑥₀^2 + (−𝑝𝑦₀𝑡 + 𝑝𝑉𝑦₀)^2]-gc
x’= Vx,
y’=Vy,
m’=-𝛽,
pm’= 𝛽*w/m*sqrt[𝑝𝑉𝑥₀^2 + (−𝑝𝑦₀𝑡 + 𝑝𝑉𝑦₀)^2],求解微分方程组,Matlab程序
|
5eda7b8a178d3e92ceaa0f46741e9bab
|
{
"intermediate": 0.3530195355415344,
"beginner": 0.2878546714782715,
"expert": 0.3591257929801941
}
|
31,724
|
I have this code:
print(client.get_account_trades(symbol=symbol))
And it returning me them : [{'symbol': 'BCHUSDT', 'id': 619335915, 'orderId': 24392236068, 'side': 'BUY', 'price': '231.51', 'qty': '0.108', 'realizedPnl': '0', 'marginAsset': 'USDT', 'quoteQty': '25.00308', 'commission': '0.01250154', 'commissionAsset': 'USDT', 'time': 1700570202533, 'positionSide': 'BOTH', 'buyer': True, 'maker': False}, {'symbol': 'BCHUSDT', 'id': 619335990, 'orderId': 24392240943, 'side': 'SELL', 'price': '231.54', 'qty': '0.108', 'realizedPnl': '0.00324000', 'marginAsset': 'USDT', 'quoteQty': '25.00632', 'commission': '0.01250316', 'commissionAsset': 'USDT', 'time': 1700570226127, 'positionSide': 'BOTH', 'buyer': False, 'maker': False}]
I need code which will return me latest trade
|
3b9973031303e921aed98bbbbdb9595f
|
{
"intermediate": 0.3552154004573822,
"beginner": 0.347830593585968,
"expert": 0.2969540059566498
}
|
31,725
|
Write a program that takes a protein sequence and returns a list of all tryptic peptides. Keep the initial order of pieces in protein sequence use function def trypsin(seq)
Hints:
Protein sequence is always a string over ['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y'] alphabet
Trypsin cuts proteins.
Trypsin cuts proteins after R or after K (if we look from left to right). R or K are kept after cleavage.
Tryptic peptides are pieces of initail protein that are left after cleavage.
Example input: 'AKARA'
Example output: ['AK', 'AR', 'A']
Example input: MSGKMTGIVKWFNADRGFGFITPDDGSKDVFVHFSAIQNDGYKSLDEGQKVSESGAKGPAAGNVTSL
Example output:[‘MSGK’, ‘MTGIVK’, ‘WFNADR’, ‘GFGFITPDDGSK’, ‘DVFVHFSAIQNDGYK’, ‘SLDEGQK’, ‘VSESGAK’, ‘GPAAGNVTSL’]
|
317da68928bc263e97d8063f511cc773
|
{
"intermediate": 0.31462985277175903,
"beginner": 0.2764661908149719,
"expert": 0.40890398621559143
}
|
31,726
|
I have this code:
active_signal = None
buy_entry_price = None
sell_entry_price = None
import binance
def calculate_percentage_difference_buy(entry_price, exit_price):
result = exit_price - entry_price
price_result = entry_price / 100
final_result = result / price_result
result = final_result * 40
return result
def calculate_percentage_difference_sell(sell_entry_price, sell_exit_price):
percentage_difference = sell_entry_price - sell_exit_price
price_result = sell_entry_price / 100 # price result = 1%
price_percent_difference = percentage_difference / price_result
result = price_percent_difference * 40
return result
while True:
if df is not None:
# Get balance function
balance = client.balance()
#Get USDT balance function
for asset in balance:
if asset['asset'] == 'USDT':
balance_usdt = float(asset['balance'])
balance_usdt_futures = balance_usdt * 40
#Constant
price_bch = mark_price
dollars = balance_usdt_futures
#Counting Balance : BCH price
bch_amount = dollars / price_bch
bch_amount_rounded = round(bch_amount, 2)
quantity = bch_amount_rounded / 2
signals = signal_generator(df)
mark_price_data = client.ticker_price(symbol=symbol)
mark_price = float(mark_price_data['price']) if 'price' in mark_price_data else 0.0
if signals == ['buy'] or signals == ['sell']:
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}, Price {mark_price} - Signals: {signals}")
if 'buy' in signals and active_signal != 'buy':
try:
active_signal = 'buy'
buy_entry_price = mark_price # Record the Buy entry price
print(f"Buy Entry Price: {buy_entry_price}")
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
print("Long order executed!")
except binance.error.ClientError as e:
print(f"Error executing long order: ")
if sell_entry_price is not None and buy_entry_price is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_sell(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
print(f"sell entry price {sell_entry_price}, sell exit price {sell_exit_price} , Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
else:
print("Sell Entry price or Buy Entry price is not defined.")
israel = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
if signals == ['buy_exit']:
active_signal = None
israel.append("Long !!! EXIT !!!")
if buy_entry_price is not None and israel is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
try:
client.cancel_open_orders(symbol=symbol)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Long position successfully exited! ")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} buy entry price {buy_entry_price}, buy exit price: {mark_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
buy_entry_price = None
buy_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
israel.append('')
elif 'sell' in signals and active_signal != 'sell':
try:
active_signal = 'sell'
sell_entry_price = mark_price # Record the sell entry price
print(f"Sell Entry Price: {sell_entry_price}")
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
print("Short order executed!")
except binance.error.ClientError as e:
print(f"Error executing short order: ")
if buy_entry_price is not None and sell_entry_price is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
print(f"buy entry price {buy_entry_price}, buy exit price: {sell_entry_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
else:
print("Buy Entry price or Sell Entry price is not defined.")
jerusalem = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
if signals == ['sell_exit']:
active_signal = None
jerusalem.append("Short !!! EXIT !!!")
if sell_entry_price is not None and jerusalem is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_buy(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Short position successfully exited!")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} sell entry price {sell_entry_price}, sell exit price: {mark_price}, Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
sell_entry_price = None
sell_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
jerusalem.append('')
time.sleep(1)
And
latest_trade = client.get_account_trades(symbol=symbol)[-1]
print(latest_trade['orderId'])
You need to give me code which will get orderId if signal == buy or sell
|
f6f6b8edd9a2da7c11115aa715678268
|
{
"intermediate": 0.3281119763851166,
"beginner": 0.5426822900772095,
"expert": 0.12920574843883514
}
|
31,727
|
suivant cette fonction la variable d'état "currentWord" a été modifiée pour faire partie de la structure "Wor"d et du mapping "gameWord" : "mapping(uint256 => Word) public gameWord;". depuis 2 assert ne passe plus dans mon test "assert.isTrue(currentWord.length > 0, "Le mot avant l’appel de la fonction ne devrait pas être vide");
assert.equal(expectedFirstLetter, wordBytes[0], "La première lettre retournée devrait correspondre à la première lettre du mot");" la fonction : "function validFirstLetter(uint256 _gameId) internal returns (string memory) {
require(state == State.wordGenerated, "no word");
bytes memory wordBytes = bytes( gameWord[gameId].currentWord);
emit LogWordBytes(wordBytes);
require(wordBytes.length > 0, "word is empty");
bytes1 firstLetterBytes = wordBytes[0];
gameWord[gameId].firstLetter = string(abi.encodePacked(firstLetterBytes));
updateStateFirstLetter();
emit FirstLetter(_gameId, gameWord[gameId].firstLetter);
return gameWord[gameId].firstLetter;
}
function getValidFirstLetter(uint256 _gameId) public returns (string memory) {
return validFirstLetter(_gameId);
}" le test "it("doit valider que le mot n'est pas vide et changer l'état : firstLetter", async () => {
const gameId = 1;
const _requestId = 2;
const randomWords = [2, 4, 9];
await penduelInstance.initWordList();
await penduelInstance.getFulfillRandomWords(_requestId, randomWords);
const initialState = await penduelInstance.state();
assert.equal(initialState, 3, "L'état initial devrait être wordGenerated");
const receipt = await penduelInstance.getValidFirstLetter(gameId);
const wordDetails = await penduelInstance.gameWord(gameId);
const currentWord = wordDetails.currentWord;
const wordBytes = currentWord;
const expectedFirstLetter = "i";
assert.isTrue(currentWord.length > 0, "Le mot avant l’appel de la fonction ne devrait pas être vide");
assert.equal(expectedFirstLetter, wordBytes[0], "La première lettre retournée devrait correspondre à la première lettre du mot");
console.log("Valeur de wordBytes[0]:", wordBytes[0]);
const updatedState = await penduelInstance.state();
assert.equal(updatedState, 4, "L'état devrait être firstLetter");
expectEvent(receipt, "FirstLetter", {
gameId: new BN(gameId),
firstLetter: expectedFirstLetter
});
});"
|
6acfbf04d581c1c1f76020722753d8e0
|
{
"intermediate": 0.3746037781238556,
"beginner": 0.41774484515190125,
"expert": 0.20765140652656555
}
|
31,728
|
package gtanks.battles.tanks.weapons.frezee.effects;
import gtanks.battles.BattlefieldModel;
import gtanks.battles.tanks.Tank;
import gtanks.battles.tanks.weapons.effects.IEffect;
import gtanks.commands.Type;
import gtanks.json.JSONUtils;
public class FrezeeEffectModel implements IEffect {
private static final float MIN_VALUE = 0.4F;
public float speed;
public float turnSpeed;
public float turretRotationSpeed;
private float power;
private Tank tank;
private BattlefieldModel bfModel;
private FrezeeEffectModel.FrezeeTimer currFrezeeTimer;
public FrezeeEffectModel(float power, Tank tank, BattlefieldModel bfModel) {
this.power = power;
this.tank = tank;
this.bfModel = bfModel;
}
public void setStartSpecFromTank() {
this.speed = this.tank.speed;
this.turnSpeed = this.tank.turnSpeed;
this.turretRotationSpeed = this.tank.turretRotationSpeed;
}
public void update() {
this.tank.speed -= this.power * this.speed / 100.0F * this.power;
this.tank.turnSpeed -= this.power * this.turnSpeed / 100.0F * this.power;
this.tank.turretRotationSpeed -= this.power * this.turretRotationSpeed / 100.0F * this.power;
if (this.tank.speed < 0.4F) {
this.tank.speed = 0.4F;
}
if (this.tank.turnSpeed < 0.4F) {
this.tank.turnSpeed = 0.4F;
}
if (this.tank.turretRotationSpeed < 0.4F) {
this.tank.turretRotationSpeed = 0.4F;
}
if (this.currFrezeeTimer != null) {
this.currFrezeeTimer.stoped = true;
}
this.currFrezeeTimer = new FrezeeEffectModel.FrezeeTimer();
this.currFrezeeTimer.start();
this.sendSpecData();
this.sendChangeTemperature(TemperatureCalc.getTemperature(this.tank, this.speed, this.turnSpeed, this.turretRotationSpeed));
}
private void sendSpecData() {
this.bfModel.sendToAllPlayers(Type.BATTLE, "change_spec_tank", this.tank.id, JSONUtils.parseTankSpec(this.tank, false));
}
private void sendChangeTemperature(double value) {
this.bfModel.sendToAllPlayers(Type.BATTLE, "change_temperature_tank", this.tank.id, String.valueOf(value));
}
class FrezeeTimer extends Thread {
public boolean stoped = false;
public void run() {
this.setName("FREZEE TIMER THREAD " + FrezeeEffectModel.this.tank);
try {
sleep(3500L);
} catch (InterruptedException var2) {
var2.printStackTrace();
}
if (!this.stoped) {
FrezeeEffectModel.this.tank.speed = FrezeeEffectModel.this.speed;
FrezeeEffectModel.this.tank.turnSpeed = FrezeeEffectModel.this.turnSpeed;
FrezeeEffectModel.this.tank.turretRotationSpeed = FrezeeEffectModel.this.turretRotationSpeed;
FrezeeEffectModel.this.sendSpecData();
FrezeeEffectModel.this.sendChangeTemperature(0.0D);
}
}
}
}
покажи мне все строки которые отвечают за постеменное убирание эффекта
|
951bca7bb2b130c5577ce00fbb769cc0
|
{
"intermediate": 0.32473024725914,
"beginner": 0.38772767782211304,
"expert": 0.28754207491874695
}
|
31,729
|
File "/home/jdoodle.py", line 14
elif num == 2:
^
SyntaxError: invalid syntax
|
eb6ae96d4056e320407bf5ac5ba313fe
|
{
"intermediate": 0.2497384250164032,
"beginner": 0.5754473805427551,
"expert": 0.1748141050338745
}
|
31,730
|
import sys
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton, QComboBox, QRadioButton, QGroupBox
from PyQt6.QtCore import QThread, pyqtSignal
from pytube import YouTube
class Downloader(QThread):
finished = pyqtSignal()
def __init__(self, url, format, resolution, audio_format, audio_bitrate):
super().__init__()
self.url = url
self.format = format
self.resolution = resolution
self.audio_format = audio_format
self.audio_bitrate = audio_bitrate
def run(self):
yt = YouTube(self.url)
if self.format == "mp4":
stream = yt.streams.filter(file_extension='mp4', res=self.resolution).first()
elif self.format == "mkv":
stream = yt.streams.filter(file_extension='mkv', res=self.resolution).first()
if stream is not None:
stream.download()
if self.audio_format == "mp3":
audio_stream = yt.streams.filter(only_audio=True).first()
if audio_stream is not None:
audio_stream.download(filename_prefix="audio_", output_path="audio/")
elif self.audio_format == "aac":
audio_stream = yt.streams.filter(only_audio=True, file_extension='m4a').first()
if audio_stream is not None:
audio_stream.download(filename_prefix="audio_", output_path="audio/")
self.finished.emit()
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
layout = QVBoxLayout()
self.url_label = QLabel("URL:")
layout.addWidget(self.url_label)
self.url_input = QLineEdit()
layout.addWidget(self.url_input)
self.format_group = QGroupBox("Video Format")
format_layout = QVBoxLayout()
self.mp4_radio = QRadioButton("MP4")
self.mkv_radio = QRadioButton("MKV")
format_layout.addWidget(self.mp4_radio)
format_layout.addWidget(self.mkv_radio)
self.format_group.setLayout(format_layout)
layout.addWidget(self.format_group)
self.resolution_label = QLabel("Resolution:")
layout.addWidget(self.resolution_label)
self.resolution_combo = QComboBox()
self.resolution_combo.addItem("360p")
self.resolution_combo.addItem("480p")
self.resolution_combo.addItem("720p")
self.resolution_combo.addItem("1080p")
layout.addWidget(self.resolution_combo)
self.audio_group = QGroupBox("Audio Format")
audio_layout = QVBoxLayout()
self.mp3_radio = QRadioButton("MP3")
self.aac_radio = QRadioButton("AAC")
audio_layout.addWidget(self.mp3_radio)
audio_layout.addWidget(self.aac_radio)
self.audio_group.setLayout(audio_layout)
layout.addWidget(self.audio_group)
self.bitrate_label = QLabel("Audio Bitrate:")
layout.addWidget(self.bitrate_label)
self.bitrate_combo = QComboBox()
self.bitrate_combo.addItem("128kbps")
self.bitrate_combo.addItem("256kbps")
self.bitrate_combo.addItem("320kbps")
layout.addWidget(self.bitrate_combo)
self.download_button = QPushButton("Download")
self.download_button.clicked.connect(self.start_download)
layout.addWidget(self.download_button)
self.setLayout(layout)
def start_download(self):
url = self.url_input.text()
format = "mp4" if self.mp4_radio.isChecked() else "mkv"
resolution = self.resolution_combo.currentText()
audio_format = "mp3" if self.mp3_radio.isChecked() else "aac"
audio_bitrate = self.bitrate_combo.currentText()
self.download_button.setEnabled(False)
self.thread = Downloader(url, format, resolution, audio_format, audio_bitrate)
self.thread.finished.connect(self.download_finished)
self.thread.start()
def download_finished(self):
self.download_button.setEnabled(True)
print('Download finished!')
self.setWindowTitle('YouTube Downloader')
app = QApplication(sys.argv)
main_window = MainWindow()
main_window.show()
sys.exit(app.exec())
이 코드를 비디오를 다운로드하면 정상적으로 오디오가 들리는 비디오를 다운로드받을수있게 해주고, 오디오 옵션만 선택한 경우엔 오디오 파일만 다운로드받을수있게 작동하도록 수정해줘
|
aba31d78cceb82e5b25914b307f4dd1a
|
{
"intermediate": 0.29230251908302307,
"beginner": 0.6013793349266052,
"expert": 0.1063181534409523
}
|
31,731
|
go: module . listed in go.work file requires go >= 1.21, but go.work lists go 1.19; to update it:
go work use
|
4c3ec93ef96faba87344bf2ee917be5d
|
{
"intermediate": 0.33973848819732666,
"beginner": 0.3386966586112976,
"expert": 0.32156485319137573
}
|
31,732
|
У меня есть файл, в котором содержатся столбцы в таком виде: a1 b1 c1 d1 … x1. Количество столбцов не фиксировано. Мне нужна функция, которая бы получала на вход номер столбца ‘n_col’ и некоторое число ‘val’. Функция должна искать в столбце с номером n_col число val, и если значение в столбце меньше, чем val, то удаляется строка целиком. Обновлённые данные записываются в новый файл. Проверь мой кода на наличие ошибок
void filterFile(const std::string& inputFilename, const std::string& outputFilename, int n_col, int val) {
std::ifstream inputFile(inputFilename);
std::ofstream outputFile(outputFilename);
if (!inputFile.is_open()) {
std::cout << "Cannot open input file: " << inputFilename << std::endl;
return;
}
if (!outputFile.is_open()) {
std::cout << "Cannot open output file: " << outputFilename << std::endl;
return;
}
std::string line;
while (std::getline(inputFile, line)) {
std::istringstream iss(line);
std::vector<std::string> columns(std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>());
if (n_col <= columns.size() && std::stoi(columns[n_col-1]) >= val) {
outputFile << line << std::endl;
}
}
inputFile.close();
outputFile.close();
}
|
07bbcaa1e432ca4191bd546ebc40b7c9
|
{
"intermediate": 0.27133727073669434,
"beginner": 0.4806753396987915,
"expert": 0.24798737466335297
}
|
31,733
|
can you give me PHP code (class) to handle mutiple objet repressent by the Computer class ?
|
08638251142a95c990f081a1bce62179
|
{
"intermediate": 0.2880619168281555,
"beginner": 0.5345537066459656,
"expert": 0.17738434672355652
}
|
31,734
|
can you give me PHP code (class) to handle mutiple objet repressent by the Computer class ?
|
0d4b38e0239e61ab0f2742d72ed2f8f6
|
{
"intermediate": 0.2880619168281555,
"beginner": 0.5345537066459656,
"expert": 0.17738434672355652
}
|
31,735
|
напиши метод интерполяции Лагранжа и Ньютона для определенного значения x по заданным массивам для полинома на языке с#
|
2b67f9f0ba9c3d0e782a7098aa89b72f
|
{
"intermediate": 0.2757289707660675,
"beginner": 0.2776026725769043,
"expert": 0.4466683268547058
}
|
31,736
|
import random
print("Ask the Magic Python Ball a question:")
question = input()
print("")
print("Loading...")
num = random.randint(1,8)
if num == 1:
print("")
print("Magic Python Ball: Ask again later, I'm not gonna answer your stupid question.")
elif num == 2:
print("")
print("Magic Python Ball: I'm not going to answer just to be petty. ")
elif num == 3:
print("")
print("Magic Python Ball: Totally not, bro.")
elif num == 4:
print("")
print("Magic Python Ball: Nah")
elif num == 5:
print("")
print("Magic Python Ball: IDK")
elif num == 6:
print("")
print("Magic Python Ball: Yuh")
elif num == 7:
print("")
print("Magic Python Ball: Nuh uh")
elif num == 8:
print("")
print("Magic Python Ball: I uhhhh-") This won't work in the terminal and it just crashes when I input an answer.
|
8cb748fddf04fa7005045404396dc8eb
|
{
"intermediate": 0.2877177298069,
"beginner": 0.4401271939277649,
"expert": 0.27215510606765747
}
|
31,737
|
Write a program in C plus plus language
- Design a data matrix containing books and users who have borrowed them for at least 20 entries and no more than 200 .
- The book matrix can include information such as book name, author, rating number, book Status (Available/loaned), dates
The borrowing and return of at least 20 actual books and no more than 500 in volume is included.
- The users matrix can contain users information such as name, phone number and address at least 5 percent
Users, the size of which is not more than 50
|
f2ff42694fb4ae5f467852ede5cd5414
|
{
"intermediate": 0.3266570270061493,
"beginner": 0.26190298795700073,
"expert": 0.41144001483917236
}
|
31,738
|
how to highlight oil reserves in geo layers 3
|
1fbd6143d4c684bee02c4ef9cdfd835c
|
{
"intermediate": 0.30436578392982483,
"beginner": 0.2722868323326111,
"expert": 0.4233473837375641
}
|
31,739
|
jens lauterbach exams in java
|
1fa5185e248c0d198100c58ef395a11a
|
{
"intermediate": 0.3591940402984619,
"beginner": 0.3117516338825226,
"expert": 0.3290543556213379
}
|
31,740
|
import sys
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton, QComboBox, QFileDialog, QMessageBox
from innertube import InnerTube
class YouTubeDownloader(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('YouTube Downloader')
layout = QVBoxLayout()
# YouTube link input
self.link_label = QLabel('유튜브 비디오 링크를 넣으세요:')
self.link_input = QLineEdit()
layout.addWidget(self.link_label)
layout.addWidget(self.link_input)
# Video options
self.res_label = QLabel('비디오 해상도:')
self.res_combo = QComboBox()
self.res_combo.addItems(['표준 해상도', '고화질 (HD)', '최고화질 (Full HD)'])
self.format_label = QLabel('비디오 포맷:')
self.format_combo = QComboBox()
self.format_combo.addItems(['mkv', 'mp4'])
layout.addWidget(self.res_label)
layout.addWidget(self.res_combo)
layout.addWidget(self.format_label)
layout.addWidget(self.format_combo)
# Audio options
self.audio_label = QLabel('오디오 포맷 및 비트레이트:')
self.audio_combo = QComboBox()
self.audio_combo.addItems(['ogg - 128kbps', 'mp3 - 192kbps', 'aac - 256kbps'])
layout.addWidget(self.audio_label)
layout.addWidget(self.audio_combo)
# Download button
self.download_button = QPushButton('다운로드')
self.download_button.clicked.connect(self.download)
layout.addWidget(self.download_button)
self.setLayout(layout)
self.show()
def download(self):
link = self.link_input.text()
if not link:
QMessageBox.warning(self, '오류', '링크를 입력해주세요.')
return
try:
it = InnerTube(client_name='ANDROID') # Define the client_name here
video_info = it.get_video_info(link)
# 옵션에 따른 비디오 스트림 선택
resolution = self.res_combo.currentText()
if resolution == '표준 해상도':
video_stream = video_info.get_stream_by_resolution('360p')
elif resolution == '고화질 (HD)':
video_stream = video_info.get_stream_by_resolution('720p')
elif resolution == '최고화질 (Full HD)':
video_stream = video_info.get_stream_by_resolution('1080p')
if video_stream is not None:
save_path = QFileDialog.getExistingDirectory(self)
video_stream.download(output_path=save_path)
QMessageBox.information(self, '성공', '다운로드가 완료되었습니다.')
else:
QMessageBox.warning(self, '오류', '해당 해상도의 비디오 스트림을 찾을 수 없습니다.')
except Exception as e:
QMessageBox.critical(self, '오류', f'다운로드 중 에러가 발생했습니다: {e}')
def main():
app = QApplication(sys.argv)
ex = YouTubeDownloader()
ex.show() # Access the ex variable to show the YouTubeDownloader widget
sys.exit(app.exec())
if __name__ == '__main__':
main()
오류 : 다운로드 중 에러가 발생했습니다: 'InnerTube' object has no attribute 'get_video_info'
|
44c7b3a0425d254d4d532862cefa5c44
|
{
"intermediate": 0.3376261591911316,
"beginner": 0.4510709047317505,
"expert": 0.21130292117595673
}
|
31,741
|
write the code for simple jQuery game engine component plugin. start with 5 components, A canvas, collision detector, gravity, player and a platform. put all the the components into a single file gameEngine.js. use classes and methods to create the components. comment the code and always display the full and complete code with examples so it can be tested.
The code on the html page should look and structured as follows.
// Initialize player with gameEngine
Const player = $('. player).gameEngine({
sprite: ['image-1.png', 'image-1.png'], iterates thru array of images
spriteArraySpeed: 5,
//div: true, iterate thru background image of div as a sprite
img: true, iterate thru scr of image element as a sprite
css: {
'width': '50px',
'height': '50px',
'background-color': 'blue'
},
spriteDirection: { //the sprite can move left and right.
‘Left’: ‘37, //keycode
‘Right’: ’39 , //keycode
//‘Up: ‘38’, , //keycode
//‘Down’: ‘40’ //keycode
//player can move in any direction including diagonal
//’360’: true
}
});
// Initialize platform with gameEngine
Const Platform = $('.platform).gameEngine({
collision: [player], // the player stops when it collides with the platform and can do in the direction set
css: {
'width': '500px',
'height': '50px',
'background-color': 'red'
}
});
Const scene = $('.scene').gameEngine({
sceneObjects: [player, platform], //the player and platform are appended to the scene
css: {
'width': '1000px',
'height': '600px',
'background-color': 'black'
},
gravitySettings: {
gravityObject: [player, platform], // set gravity to the player or any element
direction: 'down', //set the direction of the gravity. Gravity can be set to up, down, left, right.
speed: 5 // set the speed of the gravity.
}
});
|
787b810c9a7daf7082e9973ec5349f74
|
{
"intermediate": 0.4183053970336914,
"beginner": 0.35188689827919006,
"expert": 0.22980770468711853
}
|
31,742
|
write the code for simple jQuery game engine component plugin. start with 5 components, A canvas, collision detector, gravity, player and a platform. put all the the components into a single file gameEngine.js. use classes and methods to create the components. comment the code and always display the full and complete code with examples so it can be tested.
The code on the html page should look and structured as follows.
// Initialize player with gameEngine
Const player = $('. player).gameEngine({
sprite: ['image-1.png', 'image-1.png'], iterates thru array of images
spriteArraySpeed: 5,
//div: true, iterate thru background image of div as a sprite
img: true, iterate thru scr of image element as a sprite
css: {
'width': '50px',
'height': '50px',
'background-color': 'blue'
},
spriteDirection: { //the sprite can move left and right.
‘Left’: ‘37, //keycode
‘Right’: ’39 , //keycode
//‘Up: ‘38’, , //keycode
//‘Down’: ‘40’ //keycode
//player can move in any direction including diagonal
//’360’: true
}
});
// Initialize platform with gameEngine
Const Platform = $('.platform).gameEngine({
collision: [player], // the player stops when it collides with the platform and can do in the direction set
css: {
'width': '500px',
'height': '50px',
'background-color': 'red'
}
});
Const scene = $('.scene').gameEngine({
sceneObjects: [player, platform], //the player and platform are appended to the scene
css: {
'width': '1000px',
'height': '600px',
'background-color': 'black'
},
gravitySettings: {
gravityObject: [player, platform], // set gravity to the player or any element
direction: 'down', //set the direction of the gravity. Gravity can be set to up, down, left, right.
speed: 5 // set the speed of the gravity.
}
});
|
c67892cbf80a6fa8da3fa7451c1b461c
|
{
"intermediate": 0.3908931612968445,
"beginner": 0.35561156272888184,
"expert": 0.25349539518356323
}
|
31,743
|
jenkins PostBuildScript write current build log in file
|
ebdd14dbc6b5b806f43bf70740466460
|
{
"intermediate": 0.33685749769210815,
"beginner": 0.30528298020362854,
"expert": 0.35785946249961853
}
|
31,744
|
jenkins freestyle project write to file current build log
|
1a9320c7126b30de78a201606fd9eb3b
|
{
"intermediate": 0.4857518970966339,
"beginner": 0.20845794677734375,
"expert": 0.30579015612602234
}
|
31,745
|
Thread creation in Spring boot
|
5937663fcdc3c65e2bc82e1fcb1845e4
|
{
"intermediate": 0.4136609435081482,
"beginner": 0.2902325391769409,
"expert": 0.2961064875125885
}
|
31,746
|
python
|
b1a662de1094f83a59de455f12686426
|
{
"intermediate": 0.32483333349227905,
"beginner": 0.3036218583583832,
"expert": 0.37154486775398254
}
|
31,747
|
I used this code:
latest_trade = client.get_account_trades(symbol=symbol)[-1]
print(latest_trade['orderId'])
def calculate_percentage_difference_buy(entry_price, exit_price):
result = exit_price - entry_price
price_result = entry_price / 100
final_result = result / price_result
result = final_result * 40
return result
def calculate_percentage_difference_sell(sell_entry_price, sell_exit_price):
percentage_difference = sell_entry_price - sell_exit_price
price_result = sell_entry_price / 100 # price result = 1%
price_percent_difference = percentage_difference / price_result
result = price_percent_difference * 40
return result
while True:
if df is not None:
# Get balance function
balance = client.balance()
#Get USDT balance function
for asset in balance:
if asset['asset'] == 'USDT':
balance_usdt = float(asset['balance'])
balance_usdt_futures = balance_usdt * 40
#Constant
price_bch = mark_price
dollars = balance_usdt_futures
#Counting Balance : BCH price
bch_amount = dollars / price_bch
bch_amount_rounded = round(bch_amount, 2)
quantity = bch_amount_rounded / 2
signals = signal_generator(df)
mark_price_data = client.ticker_price(symbol=symbol)
mark_price = float(mark_price_data['price']) if 'price' in mark_price_data else 0.0
if signals == ['buy'] or signals == ['sell']:
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}, Price {mark_price} - Signals: {signals}")
if 'buy' in signals and active_signal != 'buy':
try:
active_signal = 'buy'
buy_entry_price = mark_price # Record the Buy entry price
print(f"Buy Entry Price: {buy_entry_price}")
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
print("Long order executed!")
except binance.error.ClientError as e:
print(f"Error executing long order: ")
if sell_entry_price is not None and buy_entry_price is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_sell(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
print(f"sell entry price {sell_entry_price}, sell exit price {sell_exit_price} , Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
else:
print("Sell Entry price or Buy Entry price is not defined.")
israel = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
if signals == ['buy_exit']:
active_signal = None
israel.append("Long !!! EXIT !!!")
if buy_entry_price is not None and israel is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
try:
client.cancel_open_orders(symbol=symbol)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Long position successfully exited! ")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} buy entry price {buy_entry_price}, buy exit price: {mark_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
buy_entry_price = None
buy_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
israel.append('')
elif 'sell' in signals and active_signal != 'sell':
try:
active_signal = 'sell'
sell_entry_price = mark_price # Record the sell entry price
print(f"Sell Entry Price: {sell_entry_price}")
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
print("Short order executed!")
except binance.error.ClientError as e:
print(f"Error executing short order: ")
if buy_entry_price is not None and sell_entry_price is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
print(f"buy entry price {buy_entry_price}, buy exit price: {sell_entry_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
else:
print("Buy Entry price or Sell Entry price is not defined.")
jerusalem = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
if signals == ['sell_exit']:
active_signal = None
jerusalem.append("Short !!! EXIT !!!")
if sell_entry_price is not None and jerusalem is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_buy(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Short position successfully exited!")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} sell entry price {sell_entry_price}, sell exit price: {mark_price}, Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
sell_entry_price = None
sell_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
jerusalem.append('')
time.sleep(1)
You need to give me code which will get latest trades orderId and update them
|
95d329386ccad725af9662610908c729
|
{
"intermediate": 0.3709094822406769,
"beginner": 0.44209593534469604,
"expert": 0.18699461221694946
}
|
31,748
|
Please advise which dimensions need to be made divisible by 4/8 to fit on a grid better "<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Header -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_marginEnd="48dp"
android:orientation="horizontal">
<ImageButton
android:id="@+id/back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
android:importantForAccessibility="no"
android:padding="12dp"
android:src="@drawable/arrow_back"
tools:ignore="SpeakableTextPresentCheck" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="12dp"
android:paddingTop="10dp"
android:paddingEnd="86dp"
android:paddingBottom="12dp"
android:text="@string/settings"
android:textColor="@color/black" />
</LinearLayout>
<!-- Settings -->
<!-- Dark mode -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="21dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="44dp"
android:text="@string/settings_darkmode"
android:textColor="@color/screen2_font_black" />
</LinearLayout>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/white"
android:importantForAccessibility="no"
android:paddingVertical="11dp"
android:paddingStart="9dp"
android:paddingEnd="12dp"
android:src="@drawable/off"
tools:ignore="ImageContrastCheck" />
</LinearLayout>
<!-- Share -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="@dimen/Settings_list_padding_start"
android:paddingTop="@dimen/Settings_list_padding_top"
android:paddingEnd="@dimen/Settings_list_padding_end"
android:paddingBottom="@dimen/Settings_list_padding_bottom">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/settings_share"
android:textColor="@color/screen2_font_black" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:background="@color/white"
android:importantForAccessibility="no"
android:src="@drawable/share"
tools:ignore="ImageContrastCheck,TouchTargetSizeCheck" />
</LinearLayout>
<!--Contact -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="@dimen/Settings_list_padding_start"
android:paddingTop="@dimen/Settings_list_padding_top"
android:paddingEnd="@dimen/Settings_list_padding_end"
android:paddingBottom="@dimen/Settings_list_padding_bottom">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/settings_support"
android:textColor="@color/screen2_font_black" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:background="@color/white"
android:importantForAccessibility="no"
android:src="@drawable/support"
tools:ignore="ImageContrastCheck,TouchTargetSizeCheck" />
</LinearLayout>
<!--EULA -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="@dimen/Settings_list_padding_start"
android:paddingTop="@dimen/Settings_list_padding_top"
android:paddingEnd="@dimen/Settings_list_padding_end"
android:paddingBottom="@dimen/Settings_list_padding_bottom">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/settings_EULA"
android:textColor="@color/screen2_font_black" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:background="@color/white"
android:importantForAccessibility="no"
android:src="@drawable/expand"
tools:ignore="ImageContrastCheck,TouchTargetSizeCheck" />
</LinearLayout>
</LinearLayout>
"
|
dab39e1ab5fb34699721ebf8c3e57c8d
|
{
"intermediate": 0.37445664405822754,
"beginner": 0.40507641434669495,
"expert": 0.22046691179275513
}
|
31,749
|
could you get me a simple code for how you work for text generation
|
2b2ea8d47a840a6cde4a13dea304739d
|
{
"intermediate": 0.4192950427532196,
"beginner": 0.18059979379177094,
"expert": 0.40010517835617065
}
|
31,750
|
code to extract the data from nested json file having n number of data
|
d2cfe1159b8d61e136798ed8f1804289
|
{
"intermediate": 0.5568486452102661,
"beginner": 0.13295212388038635,
"expert": 0.31019917130470276
}
|
31,751
|
python function to extract values from nested json file
|
e1d852af493859e4468965ee9b9f971a
|
{
"intermediate": 0.49791091680526733,
"beginner": 0.26398590207099915,
"expert": 0.23810316622257233
}
|
31,752
|
is there a way to turn these separate javascript if statements into one statement: "if (value >= 1871){
map.addLayer(kensingtonline);
map.addLayer(aldgateline);
};
if (value >= 1875){
map.addLayer(mansionline);
};
if (value >= 1877){
map.addLayer(richmondline);
};
if (value >= 1878){
map.addLayer(ealingline);
};
if (value >= 1880){
map.addLayer(harrowline);
};
"
|
d22a35277e503bc4ba3014eded5cb6c2
|
{
"intermediate": 0.34879499673843384,
"beginner": 0.3174205422401428,
"expert": 0.33378446102142334
}
|
31,753
|
I saw in binance documentation that for cancel_order I need symbol orderId and origClientOrderId , but get_acount_trades returing me only this:
{'symbol': 'BCHUSDT', 'id': 619785813, 'orderId': 24398443258, 'side': 'SELL', 'price': '224.81', 'qty': '0.043', 'realizedPnl': '0.04429000', 'marginAsset': 'USDT', 'quoteQty': '9.66683', 'commission': '0.00483341', 'commissionAsset': 'USDT', 'time': 1700591831789, 'positionSide': 'BOTH', 'buyer': False, 'maker': False}
What is here origClientOrderId ?
|
85ee5db90b861b85f1949677d910b744
|
{
"intermediate": 0.5729823708534241,
"beginner": 0.2378702610731125,
"expert": 0.18914733827114105
}
|
31,754
|
help me fix so this generator works:
extends Node
var max_rooms = 10
var room_min_size = Vector2(5, 5)
var room_max_size = Vector2(10, 10)
var map_size = Vector2(100, 100)
var rooms = []
var room_scene: PackedScene = preload("res://Scenes/rooms/Room.tscn")
func _ready():
print("Preloaded room_scene is: ", room_scene)
# Check that the room_scene variable is indeed a PackedScene
if room_scene is PackedScene:
print("Confirmed that room_scene is a PackedScene")
generate_dungeon()
else:
print("room_scene is not a PackedScene, it is: ", room_scene.get_class())
func generate_dungeon():
var rng = RandomNumberGenerator.new()
rng.randomize()
for i in range(max_rooms):
var room_width = rng.randi_range(room_min_size.x, room_max_size.x)
var room_height = rng.randi_range(room_min_size.y, room_max_size.y)
var x = rng.randi_range(0, map_size.x - room_width)
var y = rng.randi_range(0, map_size.y - room_height)
var room_pos = Vector2(x, y)
var room_size = Vector2(room_width, room_height)
create_room(room_pos, room_size)
# Optional code for hallways – not included here for simplicity
func create_room(position, size):
var room_instance = room_scene.instance()
room_instance.set_room_size(size * 32) # Dynamically set the room size.
room_instance.position = position * 32 # Set position appropriately.
add_child(room_instance)
rooms.append(room_instance)
func create_hallway(room1, room2):
# Simple hallway creation logic.
# For this example, we’ll just draw a straight horizontal line between the rooms.
var hallway_start = room1.position + Vector2(room1.size.x / 2, room1.size.y / 2)
var hallway_end = room2.position + Vector2(room2.size.x / 2, room2.size.y / 2)
var hallway = Path2D.new()
var curve = Curve2D.new() # Change this line to use Curve2D
curve.add_point(hallway_start) # Add the start point to the curve
curve.add_point(hallway_end) # Add the end point to the curve
hallway.curve = curve # Assign the Curve
class Room:
var position
var size
func init(p_position, p_size):
position = p_position
size = p_size
# Room class represents a single room in the dungeon.
func create_platformer_view_for_room(room):
var platformer_room = room_scene.instance()
platformer_room.position = room.position * 32
platformer_room.size = room.size * 32
# Here you should populate the room with platforms and obstacles
# Platform and obstacle creation is skipped for simplicity.
add_child(platformer_room)
return platformer_room
func on_room_entered(room):
var platformer_view = create_platformer_view_for_room(room)
# Adapt the room entrance logic to your game’s requirements.
# Maybe you’ll have a fade-in effect or disable the player’s movement momentarily.
func on_room_exited(room):
# Adapt the room exit logic to your game’s requirements.
pass
# Again, you might handle the transition effect or clean-up here.
extends Node2D
var color_rect: ColorRect
func _ready():
# Find the ColorRect node in the scene tree and store a reference to it
color_rect = get_node("ColorRect")
func set_room_size(size: Vector2):
# Use the stored reference to set the size of the ColorRect node
color_rect.rect_min_size = size
|
842daba62c69f58be37eccf8047b9022
|
{
"intermediate": 0.3021034598350525,
"beginner": 0.36977195739746094,
"expert": 0.32812464237213135
}
|
31,755
|
help me create a script that generates game levels with a heat map for height building in godot 4
|
2a377d5cb4f6a24119197f847f3663d6
|
{
"intermediate": 0.43832892179489136,
"beginner": 0.13160541653633118,
"expert": 0.43006566166877747
}
|
31,756
|
To integrate external knowledge sources and improve the meaningfulness of the generated sentences, you can use a technique called controlled text generation. In this approach, you can provide additional context or constraints by incorporating external knowledge sources.
Here’s an example of how you can modify the code to leverage external knowledge sources:
|
1e92301312080c4525dfaf2179a343ff
|
{
"intermediate": 0.26113447546958923,
"beginner": 0.3015747666358948,
"expert": 0.437290757894516
}
|
31,757
|
hey, i want to build an actual application which serves as a server for escape from tarkov, there is only one project right now, its SPT-AKI, i want to make a new version of it, but not in typescript, i want to use c# or something like that
|
9243ff10689aece492ecdb3702faa40c
|
{
"intermediate": 0.3279944360256195,
"beginner": 0.4218062460422516,
"expert": 0.2501992881298065
}
|
31,758
|
write a C# script name "HealthPickup" where if the player collides with it (once it is instantiated) the player will get 1 health back
|
91924169dcfb76c91a9ed07a9a805bea
|
{
"intermediate": 0.41505828499794006,
"beginner": 0.13825634121894836,
"expert": 0.4466853737831116
}
|
31,759
|
N_ITS = 1000
T = 5 # Seconds
dt = T/N_ITS
def test(rel_matrix):
state = np.zeros(N); state[0] = 1
for i in range(N_ITS):
state = state + rel_matrix @ state * dt
matrix=test(relationship)
csr_matrix = sparse.csr_matrix(matrix)
bsr_matrix = sparse.bsr_matrix(matrix)
print(f"Standard: {timeit.timeit(matrix, globals=globals(), number=10)/10:.4f}")
print(f"CSR: {timeit.timeit(csr_matrix, globals=globals(), number=10)/10:.4f}")
print(f"BSR: {timeit.timeit(bsr_matrix, globals=globals(), number=10)/10:.4f}")
|
58ca9bfd8d019811a81fc392669d0fc8
|
{
"intermediate": 0.2811174988746643,
"beginner": 0.45991674065589905,
"expert": 0.25896579027175903
}
|
31,760
|
Practice the following exercises. The purpose of these exercises is to familiarize you with some of the most common ways
to use the sed utility. Take screenshots of each exercise with a (@) after it. Also, take screenshots of your commands as
well as the result of the commands.
1. Consider the original IoT file that you created in lab #3, Part 2.5. Use this file to test your sed commands in the
following. You do not have to alter the original file or create a new file in each case; let sed send its output to
the screen. Create the following commands using sed:
a. Under line 1 of the file, include your course number and section number. (@)
b. Under line 1 of the file, add a blank line. (@)
c. Find all lines which contain an “h” or “I”, and append a blank line under each such line.
d. Remove the last two lines.” (@)
e. Replace any line that contains a comma (the, character) to the line “Comma found.”
f. Insert your name above line 1 of the file. (@)
g. Insert the line “single quote found.” above every line containing a single quote.
h. Replace all the occurrences of the “smart” in the line with “automated “. (@)
i. From lines 3 to the end of the file, replace every occurrence of “t” with “T”. (@)
j. Replace every occurrence of “.” in the file with “...”.
k. Indent by three spaces the last two lines of the text. (@)
2. Create a text file named python.txt with the following content:
Python is one of the most popular programming languages. The Python programming language is easy to learn.
It’s a great first language because Python code is concise and easy to read.
From web development to machine learning to data science, Python is the language for you.
The Python programming language runs on a wide range of platforms.
a. Replace all occurrences of ‘Python’ in the third line of the file with ‘C#’. (@)
b. Replace the second occurrence of ‘Python’ in each line of the file with ‘C#’. (@)
c. Replace only the first match of the searching pattern, ‘Python ‘by the text, ‘C# ‘.(@)
|
4f63582cfe4f4adf6b58dc0e6a5831d1
|
{
"intermediate": 0.3296588957309723,
"beginner": 0.3403932452201843,
"expert": 0.3299478590488434
}
|
31,761
|
How can I configure ssh so users logging in with ssh Keys are checked towards ad if passwords have expired? Can I maybe use pam?
|
e67eeaab988831ff0a094c8558793e8c
|
{
"intermediate": 0.3936024606227875,
"beginner": 0.2796071171760559,
"expert": 0.32679039239883423
}
|
31,762
|
The following is processing code for creating a square from 40*40 smaller squares. Did I interpolate the u and v values correctly?
for (int i = 0; i < 40; i++) {
for (int j = 0; j < 40; j++) {
float start_x = -100;
float start_y = -100;
start_x = start_x + i * 5;
start_y = start_y + j * 5;
float start_u = i / 40;
float start_v = j / 40;
float fourty = 1 / 40;
beginShape();
vertex(start_x, start_y, 0, start_u, start_v);
vertex(start_x + 5, start_y, 0, start_u + fourty, start_v);
vertex(start_x + 5, start_y + 5, 0, start_u + fourty, start_v + fourty);
vertex(start_x, start_y + 5, 0, start_u, start_v + fourty);
endShape();
}
}
popMatrix();
|
62d395bc8e5d446508e6522f7a2c3ec0
|
{
"intermediate": 0.4057135283946991,
"beginner": 0.27232179045677185,
"expert": 0.32196465134620667
}
|
31,763
|
css mix-blend-mode: overlay; in xaml
|
49e8067790eb687a144503bfac3c16a4
|
{
"intermediate": 0.3335927724838257,
"beginner": 0.3132413625717163,
"expert": 0.353165864944458
}
|
31,764
|
How to print lines with function names in it?
|
54b92d01e03111bebab568114c0ce361
|
{
"intermediate": 0.31423506140708923,
"beginner": 0.2933344542980194,
"expert": 0.3924305737018585
}
|
31,765
|
let's see the errors in this:
'<?xml version="1.0" encoding="UTF-8"?>\n<AddItemResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2023-11-21T22:30:46.537Z</Timestamp><Ack>Failure</Ack><Errors><ShortMessage>Return Policy input not applicable.</ShortMessage><LongMessage>The Return Policy field Refund in the input has been ignored.</LongMessage><ErrorCode>21916711</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorParameters ParamID="0"><Value>Refund</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>Return Policy Attribute Not Valid</ShortMessage><LongMessage>Return Policy Attribute returnDescription Not Valid On This Site</LongMessage><ErrorCode>21920200</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorParameters ParamID="0"><Value>returnDescription</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>Invalid category.</ShortMessage><LongMessage>The category selected is not a leaf category.</LongMessage><ErrorCode>87</ErrorCode><SeverityCode>Error</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>PayPal not applicable for managed payments.</ShortMessage><LongMessage>This selling account is enabled for payments managed by eBay. PayPal is not currently accepted as a payment method and has been removed from the listing.</LongMessage><ErrorCode>21920208</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorParameters ParamID="0"><Value>PayPal</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>Only Good 'Til Cancelled duration is supported for fixed price listings.</ShortMessage><LongMessage>To help you sell your item, fixed price listings can only be listed with a Good 'Til Cancelled duration. The listing duration has been set to Good 'Til Cancelled.</LongMessage><ErrorCode>21920214</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><Version>1335</Version><Build>E1335_UNI_API5_19110890_R1</Build></AddItemResponse>'
|
c7cb1e767105ce173e6472de24060928
|
{
"intermediate": 0.3764972984790802,
"beginner": 0.3480643332004547,
"expert": 0.2754383683204651
}
|
31,766
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Chest : MonoBehaviour
{
public float delayTime = 5f;
public GameObject knifePrefab;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag("Player"))
{
// Generate a random number (between 0 and 1) to determine if knife spawns or not
float randomValue = Random.value;
if (randomValue <= 0.5f)
{
// Spawn a knife
GameObject knife = Instantiate(knifePrefab, collision.transform);
knife.transform.localPosition = new Vector3(-0.41f, -0.02f, 0f);
knife.transform.localRotation = Quaternion.identity;
}
// Disable the chest to prevent spawning multiple knives
gameObject.SetActive(false);
// Enable the chest after a delay
Invoke("EnableChest", delayTime);
}
}
private void EnableChest()
{
gameObject.SetActive(true);
}
}
make it so there is a 30% chance of a HealthPickup being instantiated
|
d3140a874faae3cb4f28391c9ac99e76
|
{
"intermediate": 0.4631422162055969,
"beginner": 0.30637362599372864,
"expert": 0.2304842174053192
}
|
31,767
|
Strategies_results_df is a df. when column notional_multiplier != 100 then notional_multiplier then i want to take notional_multiplier * theta
|
78fa9d0ac86f857664c0a5265568f7ca
|
{
"intermediate": 0.29219499230384827,
"beginner": 0.2180672585964203,
"expert": 0.48973777890205383
}
|
31,768
|
Can you explain charge parity violation like I am 5?
|
de758f2ed442755639a2ee3c9c9dac33
|
{
"intermediate": 0.323438823223114,
"beginner": 0.25946691632270813,
"expert": 0.41709426045417786
}
|
31,769
|
hi there, can you recomend me a nice book for a 13 years
|
3b8b3467c666bf275cfa8d5fb0758419
|
{
"intermediate": 0.3504595458507538,
"beginner": 0.32206690311431885,
"expert": 0.32747355103492737
}
|
31,770
|
mix-blend-mode wpf xaml
|
c8740ceb7e85657098a8eebb3bc2cd6c
|
{
"intermediate": 0.349209725856781,
"beginner": 0.28990113735198975,
"expert": 0.3608890473842621
}
|
31,771
|
how to connect to shortcut
|
a7dad86ea80d2b5a755234644e9a7154
|
{
"intermediate": 0.3938542604446411,
"beginner": 0.2487754374742508,
"expert": 0.3573702573776245
}
|
31,772
|
explain this ebay API response
'<?xml version="1.0" encoding="UTF-8"?>\n<AddItemResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2023-11-21T23:46:34.666Z</Timestamp><Ack>Failure</Ack><Errors><ShortMessage>Return Policy input not applicable.</ShortMessage><LongMessage>The Return Policy field Refund in the input has been ignored.</LongMessage><ErrorCode>21916711</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorParameters ParamID="0"><Value>Refund</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>You are not opted into Business Policies. To continue using this feature please opt in</ShortMessage><LongMessage>You are not opted into Business Policies. To continue using this feature please opt in using the following link: https://www.bizpolicy.sandbox.ebay.co.uk/businesspolicy/policyoptin</LongMessage><ErrorCode>21919446</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorParameters ParamID="0"><Value>https://www.bizpolicy.sandbox.ebay.co.uk/businesspolicy/policyoptin</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>Return Policy Attribute Not Valid</ShortMessage><LongMessage>Return Policy Attribute returnDescription Not Valid On This Site</LongMessage><ErrorCode>21920200</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorParameters ParamID="0"><Value>returnDescription</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>PayPal not applicable for managed payments.</ShortMessage><LongMessage>This selling account is enabled for payments managed by eBay. PayPal is not currently accepted as a payment method and has been removed from the listing.</LongMessage><ErrorCode>21920208</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorParameters ParamID="0"><Value>PayPal</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>Condition is not applicable.</ShortMessage><LongMessage>Condition is not applicable for this category. The condition value submitted has been dropped.</LongMessage><ErrorCode>21917121</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>Only Good 'Til Cancelled duration is supported for fixed price listings.</ShortMessage><LongMessage>To help you sell your item, fixed price listings can only be listed with a Good 'Til Cancelled duration. The listing duration has been set to Good 'Til Cancelled.</LongMessage><ErrorCode>21920214</ErrorCode><SeverityCode>Warning</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><Errors><ShortMessage>You need to create a seller's account.</ShortMessage><LongMessage>Before you can list this item we need some additional information to create a seller's account.</LongMessage><ErrorCode>120</ErrorCode><SeverityCode>Error</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><Version>1335</Version><Build>E1335_UNI_API5_19110890_R1</Build></AddItemResponse>'
|
0cac93642d3f33bca248615f97a81137
|
{
"intermediate": 0.45974475145339966,
"beginner": 0.3700983226299286,
"expert": 0.17015697062015533
}
|
31,773
|
can I create a game_id column in the game_data that simply sets game id to the row number at 5 digits as a float? IE 00011 00002
# Column extraction
columns_to_extract = [
'id', 'scheduled', 'summary.home.id', 'summary.home.name',
'summary.away.id', 'summary.away.name', 'summary.home.points', 'summary.away.points'
]
odds_columns = [col for col in historical_df.columns if col.startswith('summary.odds.')]
columns_to_extract.extend(odds_columns)
game_data = historical_df[columns_to_extract]
|
19aa6584874c1572851c1c5198cd5ba7
|
{
"intermediate": 0.42883196473121643,
"beginner": 0.2989528477191925,
"expert": 0.27221524715423584
}
|
31,774
|
hazme un footer acorte al header <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
<style>
html,
body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}
header {
width: 100%;
height: 70px;
display: flex;
align-items: center;
justify-content: space-around;
background: #0071bc;
color: white;
}
.logo {
letter-spacing: 3px;
}
.nav {
display: flex;
justify-content: space-around;
width: 30%;
}
.navlink {
list-style: none;
margin: 0;
}
.navlink a {
color: white;
text-decoration: none;
font-size: 1.2em;
}
.burger {
font-size: 1.2em;
display: none;
}
</style>
<title>Votaciones</title>
</head>
<body>
<header>
<h1 class="logo">VoteCR</h1>
<ul class="nav">
<li class="navlink"><a href="#">Votar</a></li>
<li class="navlink"><a href="#">Graficos por provincias</a></li>
<li class="navlink"><a href="#">Cantidad de votos</a></li>
</ul>
<div class="burger">
<i class="fas fa-bars"></i>
</div>
</header>
<script src="./main.js"></script>
</body>
</html>
|
175739aa39f6d8e9707fa335770dcebf
|
{
"intermediate": 0.3708365857601166,
"beginner": 0.2755780518054962,
"expert": 0.3535853326320648
}
|
31,775
|
pymongo how to combine these document in different collection using aggregate document_a = { "project_id" : "ABC123", "20232211" : { "atc" : 1 }} document_b = { "project_id" : "ABC123", "20232211" : { "atc" : 2 }} into document_c = { "project_id" : "ABC123", "20232211" : { "atc" : 1, "atc_doc_b": 2 }}
|
6d35da59b9a084d98266746613e9d051
|
{
"intermediate": 0.5024809241294861,
"beginner": 0.15188908576965332,
"expert": 0.3456299602985382
}
|
31,776
|
Can you create python based webrtc server ?
|
80cc17607c13a6748be823b4a52ba5ac
|
{
"intermediate": 0.3880785405635834,
"beginner": 0.14296676218509674,
"expert": 0.46895474195480347
}
|
31,777
|
html css code for "divide the section portion into two parts vertically and add content"
|
da31b80359c49479dc87cedfb4f4c795
|
{
"intermediate": 0.4022015929222107,
"beginner": 0.2646068036556244,
"expert": 0.3331916034221649
}
|
31,778
|
write funcitons to fix my control issues import pygame
from auxiliar.helpers import Auxiliar
from auxiliar.constants import open_configs, screen_w, screen_h
from models.arrow import Arrow
class Player:
def __init__(self, x, y, speed_walk, speed_run, gravity, jump, stage_name) -> None:
self.walk_r = Auxiliar.getSurfaceFromSpriteSheet(
open_configs()[stage_name]['player']['player_cross_run'],
columns=20,
rows=1,
step=2
)
self.walk_l = Auxiliar.getSurfaceFromSpriteSheet(
open_configs()[stage_name]['player']['player_cross_run'],
flip=True,
columns=20,
rows=1,
step=2
)
self.stay = Auxiliar.getSurfaceFromSpriteSheet(
open_configs()[stage_name]['player']['player_cross_idle'],
columns=1,
rows=1,
step=1
)[:1]
self.jump_r = Auxiliar.getSurfaceFromSpriteSheet(
open_configs()[stage_name]['player']['player_cross_jump'],
columns=17,
rows=1,
delay=3
)
self.jump_l = Auxiliar.getSurfaceFromSpriteSheet(
open_configs()[stage_name]['player']['player_cross_jump'],
columns=16,
rows=1,
flip=True
)
self.land = Auxiliar.getSurfaceFromSpriteSheet(
open_configs()[stage_name]['player']['player_cross_land'],
columns=17,
rows=1,
delay=3
)
self.frame = 0
self.move_x = x
self.move_y = y
self.speed_walk = speed_walk
self.gravity = gravity
self.jump = jump
self.animation = self.stay
self.image = self.animation[self.frame]
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.is_jumping = False
self.last_jump_time = pygame.time.get_ticks() # Initialize with the current time
self.jump_cooldown = 500 # Set the cooldown time in milliseconds
# Atributos para disparar y recargar
self.ready = True
self.arrow_time = 0
self.arrow_cooldown = 600
self.bullet_group = pygame.sprite.Group()
self.puntaje = 0
@property
def get_bullets(self) -> list[Arrow]:
return self.bullet_group
def shoot_arrow(self):
self.bullet_group.add(self.create_bullet())
def create_bullet(self):
return Arrow(self.rect.x,
self.rect.top) # Crea y devuelve un objeto de la clase Arrow en la posición actual del ratón
def recharge(self):
if not self.ready:
current_time = pygame.time.get_ticks()
if current_time - self.arrow_time >= self.arrow_cooldown:
self.ready = True
def control(self, keys, events):
current_time = pygame.time.get_ticks()
# Default values
self.move_x = 0
self.move_y = 0
if keys[pygame.K_RIGHT]:
self.move_x = self.speed_walk
self.animation = self.walk_r
elif keys[pygame.K_LEFT]:
self.move_x = -self.speed_walk
self.animation = self.walk_l
elif not keys[pygame.K_SPACE] and not keys[pygame.K_RIGHT] and not keys[pygame.K_LEFT]:
self.frame = 0
self.animation = self.stay
if keys[pygame.K_SPACE] and (not self.is_jumping):
self.move_y = -self.jump
self.last_jump_time = current_time
self.animation = self.jump_r
self.is_jumping = True
if (self.is_jumping == True):
self.is_jumping = False
self.move_y = 0
if (self.rect.y < screen_h - self.rect.height):
self.move_y += self.gravity
else:
self.rect.y = screen_h - self.rect.height
self.move_y = 0
self.is_jumping = False
# Shoot arrow logic
if keys[pygame.K_e] and self.ready:
self.shoot_arrow()
self.ready = False
self.arrow_time = pygame.time.get_ticks()
def constraint(self):
# Stop when reaching the right edge of the screen
if self.rect.x > screen_w - self.rect.width:
self.rect.x = screen_w - self.rect.width
self.move_x = 0
# Stop when reaching the left edge of the screen
if self.rect.x < -200:
self.rect.x = -200
self.move_x = 0
# Stop when reaching the top edge of the screen
if self.rect.y < 0:
self.rect.y = 0
self.move_y = 0
def draw(self, screen):
self.image = self.animation[self.frame]
screen.blit(self.image, self.rect)
def update(self, screen: pygame.surface.Surface):
current_time = pygame.time.get_ticks()
self.recharge()
self.bullet_group.draw(screen)
self.bullet_group.update()
self.constraint()
if (self.is_jumping == True):
self.is_jumping = False
self.move_y = 0
if (self.frame < len(self.animation) - 1):
self.frame += 1
else:
self.frame = 0
self.rect.x += self.move_x
self.rect.y += self.move_y
# Apply gravity if the player is above the ground
if self.rect.y < screen_h - self.rect.height:
self.move_y += self.gravity
else:
# Snap the player to the ground when they reach the bottom of the screen
self.rect.y = screen_h - self.rect.height
self.move_y = 0
self.is_jumping = False
|
dee576c906436790cffb6fb1714020cf
|
{
"intermediate": 0.31158024072647095,
"beginner": 0.49681922793388367,
"expert": 0.19160056114196777
}
|
31,779
|
修改我的代码,使其逻辑完整,我想模拟一个时间编码系统,每次在buffer里面存入inital个数据bit,然后开始模拟,当没有overflow 也没有underflow时,我认为全部信息(16或32位)传递完成 success,然后在每种参数下实验500次,统计成功的概率,overflow、underflow的概率。我在代码中 搞不清楚Arrival_ProcessServer_Process 应该怎么分别模拟这个过程,然后判断overflow、underflow,也不知道应该怎么和Sim_var、 Generator、Packet 类交互。我要实现的效果是: 一旦发生overflow、underflow,本次实验就结束,此时我要退出实验,保证我的buffer清空,我的下一次实验开始时,重新按照init_packets的i_values = [2, 6, 10, 14, 18] 来生成预先存在buffer中的数据。 请修改我的代码,给出正确的代码,不要省略,一行一行解释import simpyimport simpy
import random
import math
class Sim_var(object):
RANDOM_SEED = 33
SIM_TIME = 1000
LONG_SLEEP_TIMER = 1000000
MAX_DELAY = 5
MIN_DELAY = 0
MU = 1
MEDIAN_DELAY = 1/MU
def __init__(self, encode_message, init_packets):
self.B = 20
self.current_packets = len(init_packets)
self.buffer = init_packets
self.encode_message = encode_message
self.overflow = 0
self.underflow = 0
self.success = 0
self.simulation_continue = True
def reset(self):
self.simulation_continue = False
self.current_packets = len(self.initial_packets)
self.buffer = self.initial_packets
class Packet:
def __init__(self, identifier, delay_time):
self.identifier = identifier
self.delay_time = delay_time
class Generator:
def __init__(self, m, encode_distribution='exponential'):
self.m = m
self.secret_message = [random.choice(['0', '1']) for _ in range(m)]
self.encode_distribution = encode_distribution
self.packet_delays = [self.encode_packet(bit) for bit in self.secret_message]
def encode_packet(self, bit):
delay = 0
if self.encode_distribution == 'exponential':
return random.uniform(0, Sim_var.MEDIAN_DELAY) if bit == '0' else random.uniform(Sim_var.MEDIAN_DELAY, Sim_var.MAX_DELAY)
print(f"Packet delay: {delay} for bit: {bit}")
return delay
class StatObject:
def __init__(self):
self.dataset =[]
def addNumber(self,x):
self.dataset.append(x)
def sum(self):
n = len(self.dataset)
sum = 0
for i in self.dataset:
sum = sum + i
return sum
def mean(self):
n = len(self.dataset)
sum = 0
for i in self.dataset:
sum = sum + i
return sum/n
def maximum(self):
return max(self.dataset)
def minimum(self):
return min(self.dataset)
def count(self):
return len(self.dataset)
def median(self):
self.dataset.sort()
n = len(self.dataset)
if n//2 != 0: # get the middle number
return self.dataset[n//2]
else: # find the average of the middle two numbers
return ((self.dataset[n//2] + self.dataset[n//2 + 1])/2)
def standarddeviation(self):
temp = self.mean()
sum = 0
for i in self.dataset:
sum = sum + (i - temp)**2
sum = sum/(len(self.dataset) - 1)
return math.sqrt(sum)
class Server_Process(object):
def __init__(self, env, sim_var):
self.env = env
self.sim_var = sim_var
self.action = env.process(self.run())
def run(self):
# print("TX-process started")
idx_bit = 0
while True:
if self.sim_var.simulation_continue == False:
return
if self.sim_var.current_packets == 0:
self.sim_var.underflow += 1 # Underflow occurred
self.sim_var.simulation_continue = False
return
packet = self.sim_var.buffer.pop(0)
self.sim_var.current_packets -= 1
idx_bit += 1
if idx_bit == len(self.sim_var.encode_message):
self.sim_var.success += 1
self.sim_var.simulation_continue = False
return
yield self.env.timeout(packet.delay_time)
class Arrival_Process(object):
def __init__(self, env, sim_var, arrival_rate, generator):
self.env = env
self.sim_var = sim_var
self.arrival_rate = arrival_rate
self.generator = generator
# self.server_process = Server_Process(env, self.sim_var.packets_buffer)
self.action = env.process(self.run())
def run(self):
# packet arrivals
# print("Arrival Process Started")
while True:
if self.sim_var.simulation_continue == False:
return
yield self.env.timeout(random.expovariate(self.arrival_rate))
if self.sim_var.simulation_continue == False:
return
delay = self.generator.packet_delays[self.sim_var.current_packets]
self.sim_var.buffer.append(Packet(self.sim_var.current_packets, delay))
# print(f"Packet added to buffer at time {self.env.now}. Buffer size: {len(self.buffer)}")
self.sim_var.current_packets += 1
if self.sim_var.current_packets >= self.sim_var.B:
self.sim_var.overflow += 1
self.sim_var.simulation_continue = False
return
def simulate(m, i_values, arrival_rate, encode_distribution='exponential', num_experiments=1000):
results = []
for i in i_values:
sim_var = Sim_var(m, i)
for exp in range(num_experiments):
random.seed(sim_var.RANDOM_SEED + exp)
env = simpy.Environment()
generator = Generator(m, encode_distribution)
arrival_process = Arrival_Process(env, sim_var, arrival_rate, generator)
server_process = Server_Process(env, sim_var)
env.run(until=sim_var.SIM_TIME)
results.append((m, i, sim_var.underflow / num_experiments, sim_var.overflow / num_experiments,
sim_var.success / num_experiments))
return results
# main
m_values = [16, 20, 24, 28, 32]
i_values = [2, 6, 10, 14, 18]
B = 20
arrival_rate = 1
encode_distribution = 'exponential'
for m in m_values:
experiment_results = simulate(m, i_values, arrival_rate, encode_distribution)
for result in experiment_results:
print(f"M Size: {result[0]}, i: {result[1]}, Underflow: {result[2]:.3f}, Overflow: {result[3]:.3f}, Success: {result[4]:.3f}")
|
66d97343ff73717c2c5eda1a39700c9b
|
{
"intermediate": 0.3222254812717438,
"beginner": 0.41834768652915955,
"expert": 0.25942686200141907
}
|
31,780
|
import sys
from PyQt6.QtWidgets import (
QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget,
QLineEdit, QComboBox, QFileDialog, QMessageBox
)
from yt_dlp import YoutubeDL
from yt_dlp.utils import DownloadError
class YoutubeDownloader(QMainWindow):
def __init__(self):
super().__init__()
# UI 구성 요소 초기화
self.init_ui()
def init_ui(self):
self.setWindowTitle('DeepTube :: 비공식 유튜브 다운로더')
self.setGeometry(300, 300, 400, 200)
# 메인 위젯 및 레이아웃 설정
self.main_widget = QWidget(self)
self.main_layout = QVBoxLayout(self.main_widget)
self.setCentralWidget(self.main_widget)
# 유튜브 링크 입력 필드
self.url_input = QLineEdit(self)
self.url_input.setPlaceholderText('유튜브 비디오 url를 넣으세요.')
self.main_layout.addWidget(self.url_input)
# 해상도 및 비디오 포맷 선택
self.quality_input = QComboBox(self)
self.quality_input.addItems(['360p', '480p', '720p', '1080p', '1440p', '2160p', 'best', 'worst'])
self.main_layout.addWidget(self.quality_input)
# 오디오 포맷 선택
self.audio_format_input = QComboBox(self)
# 여기에는 오디오 포맷 옵션이 들어가게 수정해야 할 수도 있습니다.
self.audio_format_input.addItems(['best', 'aac', 'flac', 'mp3', 'm4a', 'opus', 'vorbis', 'wav'])
self.main_layout.addWidget(self.audio_format_input)
# 다운로드 버튼
self.download_button = QPushButton('다운로드', self)
self.download_button.clicked.connect(self.start_download)
self.main_layout.addWidget(self.download_button)
self.show()
def start_download(self):
video_url = self.url_input.text().strip()
if not video_url:
QMessageBox.warning(self, 'Warning', '유튜브 링크를 입력해주세요.')
return
video_quality = self.quality_input.currentText()
audio_format = self.audio_format_input.currentText()
# 파일 저장 경로 대화상자 표시
save_path, _ = QFileDialog.getSaveFileName(self, 'Save Video', '/', 'Video Files (*.mp4)')
if save_path:
if not save_path.endswith('.mp4'):
save_path += '.mp4'
self.download_video(video_url, video_quality, audio_format, save_path)
else:
QMessageBox.warning(self, 'Warning', '파일 저장 경로가 지정되지 않았습니다.')
def download_video(self, video_url, video_quality, audio_format, save_path):
# ‘best’로 선택되었을 경우에 적절한 처리
quality = f'{video_quality}p' if video_quality != 'best' and not video_quality.endswith('p') else video_quality
ydl_opts = {
'format': f'bestvideo[height<={quality}]+bestaudio/best[ext=m4a]',
'outtmpl': save_path,
'merge_output_format': 'mp4', # 병합 포맷 지정
}
try:
with YoutubeDL(ydl_opts) as ydl:
ydl.download([video_url])
QMessageBox.information(self, 'Success', '다운로드가 완료되었습니다.')
except DownloadError as e:
QMessageBox.critical(self, 'Error', '다운로드 중 오류가 발생했습니다.\n' + str(e))
except Exception as e:
QMessageBox.critical(self, 'Error', '예상치 못한 오류가 발생했습니다.\n' + str(e))
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = YoutubeDownloader()
sys.exit(app.exec())
|
adc3135fad80832c1b13811f5bdcf176
|
{
"intermediate": 0.3051282465457916,
"beginner": 0.4504588842391968,
"expert": 0.2444128692150116
}
|
31,781
|
debug this code
#include <iostream>
#include <cmath>
using namespace std;
unsigned int convertBinaryToDecimal(string n) {
unsigned int decimal = 0;
int power = 0;
int I = n.size() - 1;
while (I >= 0) {
if (n[I] == '1') {
decimal += 1u << power;
}
power++;
--I;
}
return decimal;
}
int main() {
string n;
cin >> n;
cout << n << " in binary = " << convertBinaryToDecimal(n) << " in decimal";
return 0;
}
|
90f58dcda881350952b0ea9a3007b006
|
{
"intermediate": 0.4404299259185791,
"beginner": 0.39509299397468567,
"expert": 0.16447709500789642
}
|
31,782
|
Path hdfsFilePath = new Path(HDFS_PATH+"pdm/sample/"+path);
if (!fileSystem.exists(hdfsFilePath)) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
}
try (FSDataInputStream inputStream = fileSystem.open(hdfsFilePath)) {
byte[] fileContent = null;
inputStream.read(fileContent);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(org.springframework.http.MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", path);
return new ResponseEntity<>(fileContent, headers, HttpStatus.OK);
} nullexception 에러나 해결해줘
|
4c9de456e787817daecdf5f18a903d50
|
{
"intermediate": 0.45320311188697815,
"beginner": 0.2718227803707123,
"expert": 0.27497416734695435
}
|
31,783
|
在c#语言中,用NEST 7.17.5的库替换以下代码,尽量少的修改
public SearchDescriptor<SparePartEntity> GetFullDescriptor(SearchRequest request)
{
var sd = new SearchDescriptor<SparePartEntity>().Skip(request.Skip).Take(request.Take);
var searchText = string.IsNullOrWhiteSpace(request.DynamicText) ? “*” : request.DynamicText.ToLower();
var escapedText = EscapeText(searchText);
var fuzzySearchText = escapedText;
var userInputs = searchText.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
if (userInputs.Count() > 1)
{
fuzzySearchText = string.Join(“~ AND “, userInputs) + “~”;
}
else
{
fuzzySearchText += “~”;
}
//sd = sd.Query(qd => qd
// .Bool(bqd => bqd)
sd = sd.Query(qd => qd.Filtered(fqd => ApplyFilters(request, fqd)
.Query(qdi =>
{
var q = qdi.Prefix(s => s.SparePartId, escapedText, 40) ||
qdi.Prefix(s => s.Oem, escapedText, 39) ||
qdi.Prefix(s => s.NamePrefix, escapedText, 3) ||
qdi.QueryString(mmqd => mmqd.Query(fuzzySearchText).OnFields(new[] { “_all” })) ||
qdi.QueryString(mmqd => mmqd.Query(””" + escapedText + “”“).OnFields(new[] { “_all” }).Boost(3)) ||
qdi.QueryString(qsd =>
{
qsd.FuzzyMinimumSimilarity(0.7).FuzzyPrefixLength(0)
.Query(fuzzySearchText)
.OnFieldsWithBoost(fd => fd.Add(s => s.SparePartId, 5)
.Add(s => s.Oem, 5)
.Add(s => s.Name, 2)
.Add(s => s.ProductLineNamesAnalyzed, 2)
.Add(s => s.Bom, 6));
});
//var boosts = new int[] { 20, 6, 4 };
//var index = 0;
//foreach (var str in userInputs.Take(3))
//{
// q = q || qdi.Wildcard(s => s.Name, str, boosts[index++]);
//}
return q;
})));
if (request.OrderbyFilter != null)
{
//sd = sd.SortDescending(s => s.IsRepkit);
sd = sd.Sort(s =>
{
var order = request.OrderbyFilter.Direction == OrderDirection.Ascending
? SortOrder.Ascending
: SortOrder.Descending;
s = s.Order(order);
switch (request.OrderbyFilter.Field)
{
case SortField.Relevance:
s = s.OnField(”_score");
break;
case SortField.IdNumber:
s = s.OnField(sp => sp.SparePartId);
break;
case SortField.Name:
s = s.OnField(“name.sort”);
break;
//case SortField.PartsGroup:
// s = s.OnField(“groupNames.sort”);
// break;
case SortField.AssemblyGroup:
s = s.OnField(“assemblyGroupNames”);
s = s.Mode(SortMode.Min);
break;
default:
throw new ArgumentOutOfRangeException();
}
return s;
});
if (request.OrderbyFilter.Field == SortField.AssemblyGroup)
{
sd = sd.Sort(s =>
{
var order = request.OrderbyFilter.Direction == OrderDirection.Ascending
? SortOrder.Ascending
: SortOrder.Descending;
s = s.Order(order);
s = s.OnField(sp => sp.SparePartId);
return s;
});
}
}
return sd;
}
private SearchDescriptor<MetadataEntity> GetFilterDescriptor(FilterType filterType, int facetTake, string text, string kgId, string languageKey)
{
var sd = new SearchDescriptor<MetadataEntity>().Skip(0).Take(facetTake).Query(
fd => fd.Term(m => m.LanguageKey, languageKey) && fd.Term(m => m.Kg, kgId));
return sd.Query(
fd => fd.Term(s => s.FilterType, filterType)
&&
(
fd.QueryString(qd => qd.Query(EscapeText(text) + “~”).OnFields(m => m.Name).FuzzyMinimumSimilarity(0.8)) ||
fd.QueryString(qd => qd.Query(MultiWordWildcard(text)).OnFields(m => m.Name).Boost(2))
));
}
|
9b5ec70f4f699f3f9bb99753e53a8ad8
|
{
"intermediate": 0.27607548236846924,
"beginner": 0.4353310763835907,
"expert": 0.2885933816432953
}
|
31,784
|
How do I query batch this:
{"operationName":"Login","variables":{"loginToken":"eyJxxxxxxxxxxxxxxxxxxxxxxxx","tfaCode":"111111"},"query":"mutation Login($loginToken: String!, $tfaCode: String!) {\n login(loginToken: $loginToken, tfaCode: $tfaCode) {\n accessToken\n refreshToken\n __typename\n }\n}"}
|
ec1d2bd9eab531a752c3d3072f8ee755
|
{
"intermediate": 0.5832582712173462,
"beginner": 0.23310978710651398,
"expert": 0.18363192677497864
}
|
31,785
|
Let's say I don't want to implement a new algorithm from scratch. Instead, I want to start with the output from the Delaunay hull that I get from scipy. So, let's say I have the following points that would make a star:
points=[
Point(0, 5),
Point(1, 2),
Point(4, 2),
Point(2, 0),
Point(3, -3),
Point(0, -1),
Point(-3, -3),
Point(-2, 0),
Point(-4, 2),
Point(-1, 2),
]
From here, I can create a Delaunay hull using scipy. How can I filter out the simplexes that are not a part of the star? My end goal is to tell if a point is within the bounds of the star (including the edges). For example, Point(0.5, 3.5) and Point(4,0) should be within the star, but Point(3.158, -0.19) should not be within the star.
|
893f51602cfd8d9c93360b57926d31ef
|
{
"intermediate": 0.29068151116371155,
"beginner": 0.13390707969665527,
"expert": 0.5754114389419556
}
|
31,786
|
The best books to learn Material UI
|
abd071fb72fbd8bdada3e63e095ac77b
|
{
"intermediate": 0.2236456722021103,
"beginner": 0.6031357049942017,
"expert": 0.17321866750717163
}
|
31,787
|
type 'a sequence = Cons of 'a * (unit -> 'a sequence)
let rec stirling n m =
match (n, m) with
| _, _ when m = 1 || n = m -> 1
| _, _ when m > n -> 0
| _, _ -> stirling (n - 1) (m - 1) + m * stirling (n - 1) m
;;
let hd (Cons (h, _)) = h;;
let tl (Cons (_, tf)) = tf ();;
let rec take n s =
if n = 0 then []
else hd s :: take (n-1) (tl s)
let bell n =
let rec bell_gen n k =
Cons (stirling n 0, fun() -> bell_gen n (k + 1)
in bell_gen n 0
;;
what doesnt work
|
9d2d9864231acfd66ef0f6a2a543e2d4
|
{
"intermediate": 0.3877880573272705,
"beginner": 0.33234766125679016,
"expert": 0.2798643112182617
}
|
31,788
|
is this "/lib/x86_64-linux-gnu/libnss_files-2.31.so" libc?
|
fb3eec0546898f4784fd5a6869248d0b
|
{
"intermediate": 0.5211933851242065,
"beginner": 0.23778757452964783,
"expert": 0.2410190850496292
}
|
31,789
|
Write me a windows shell script that I can run in command prompt that will rename all files within a directory by replacing specific existing text within the file name and replacing it with new text. For instance changing the file name from 'FileName_003.jpg' to 'FN_003.jpg'
|
be54941b93ebf1abf70bc8b647227473
|
{
"intermediate": 0.3612160384654999,
"beginner": 0.22319526970386505,
"expert": 0.41558870673179626
}
|
31,790
|
i have an captcha image with 5 to 6 symbols (numbers), they have different color and overlap each other. write a python script that distinguishes them and saves each symbol as a unique image
|
ffe2c697707818a4934db68852de130c
|
{
"intermediate": 0.35729333758354187,
"beginner": 0.20416259765625,
"expert": 0.43854403495788574
}
|
31,791
|
hello
|
565b57ac4a7c5ea809d715e4f575c8cd
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
31,792
|
/usr/local/lib/python3.10/dist-packages/pandas/io/common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
854 if ioargs.encoding and "b" not in ioargs.mode:
855 # Encoding
--> 856 handle = open(
857 handle,
858 ioargs.mode,
FileNotFoundError: [Errno 2] No such file or directory: 'Airlines - TREINO.csv'
|
8b0a571d9e1e56a1ffe7a2994e6efa0e
|
{
"intermediate": 0.49755722284317017,
"beginner": 0.2331206053495407,
"expert": 0.26932212710380554
}
|
31,793
|
用NEST 7.17.5的库替换NEST 1.4.3库的c#代码,旧代码如下
public SearchDescriptor<SparePartEntity> GetFullDescriptor(SearchRequest request)
{
var sd = new SearchDescriptor<SparePartEntity>().Skip(request.Skip).Take(request.Take);
var searchText = string.IsNullOrWhiteSpace(request.DynamicText) ? “*” : request.DynamicText.ToLower();
var escapedText = EscapeText(searchText);
var fuzzySearchText = escapedText;
var userInputs = searchText.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
if (userInputs.Count() > 1)
{
fuzzySearchText = string.Join(“~ AND “, userInputs) + “~”;
}
else
{
fuzzySearchText += “~”;
}
//sd = sd.Query(qd => qd
// .Bool(bqd => bqd)
sd = sd.Query(qd => qd.Filtered(fqd => ApplyFilters(request, fqd)
.Query(qdi =>
{
var q = qdi.Prefix(s => s.SparePartId, escapedText, 40) ||
qdi.Prefix(s => s.Oem, escapedText, 39) ||
qdi.Prefix(s => s.NamePrefix, escapedText, 3) ||
qdi.QueryString(mmqd => mmqd.Query(fuzzySearchText).OnFields(new[] { “_all” })) ||
qdi.QueryString(mmqd => mmqd.Query(””" + escapedText + “”“).OnFields(new[] { “_all” }).Boost(3)) ||
qdi.QueryString(qsd =>
{
qsd.FuzzyMinimumSimilarity(0.7).FuzzyPrefixLength(0)
.Query(fuzzySearchText)
.OnFieldsWithBoost(fd => fd.Add(s => s.SparePartId, 5)
.Add(s => s.Oem, 5)
.Add(s => s.Name, 2)
.Add(s => s.ProductLineNamesAnalyzed, 2)
.Add(s => s.Bom, 6));
});
//var boosts = new int[] { 20, 6, 4 };
//var index = 0;
//foreach (var str in userInputs.Take(3))
//{
// q = q || qdi.Wildcard(s => s.Name, str, boosts[index++]);
//}
return q;
})));
if (request.OrderbyFilter != null)
{
//sd = sd.SortDescending(s => s.IsRepkit);
sd = sd.Sort(s =>
{
var order = request.OrderbyFilter.Direction == OrderDirection.Ascending
? SortOrder.Ascending
: SortOrder.Descending;
s = s.Order(order);
switch (request.OrderbyFilter.Field)
{
case SortField.Relevance:
s = s.OnField(”_score");
break;
case SortField.IdNumber:
s = s.OnField(sp => sp.SparePartId);
break;
case SortField.Name:
s = s.OnField(“name.sort”);
break;
//case SortField.PartsGroup:
// s = s.OnField(“groupNames.sort”);
// break;
case SortField.AssemblyGroup:
s = s.OnField(“assemblyGroupNames”);
s = s.Mode(SortMode.Min);
break;
default:
throw new ArgumentOutOfRangeException();
}
return s;
});
if (request.OrderbyFilter.Field == SortField.AssemblyGroup)
{
sd = sd.Sort(s =>
{
var order = request.OrderbyFilter.Direction == OrderDirection.Ascending
? SortOrder.Ascending
: SortOrder.Descending;
s = s.Order(order);
s = s.OnField(sp => sp.SparePartId);
return s;
});
}
}
return sd;
}
|
f7f98bf1941c7199f7b2e1ff8d31066a
|
{
"intermediate": 0.29827651381492615,
"beginner": 0.44264957308769226,
"expert": 0.2590738832950592
}
|
31,794
|
Как в visual studio code сделать что-бы на маке при command + [ вернулось в пердыдущий файл?
|
ccecae2100407ae2f4696e43177733e7
|
{
"intermediate": 0.32588157057762146,
"beginner": 0.41500556468963623,
"expert": 0.25911280512809753
}
|
31,795
|
code a python fibonacci
|
41fb4e66dec5513010e0b1420af389c2
|
{
"intermediate": 0.30712080001831055,
"beginner": 0.2847119867801666,
"expert": 0.40816718339920044
}
|
31,796
|
@scxddd ➜ /workspaces/it314115_project (master) $ pip install docker-compose
Collecting docker-compose
Using cached docker_compose-1.29.2-py2.py3-none-any.whl (114 kB)
Collecting PyYAML<6,>=3.10 (from docker-compose)
Using cached PyYAML-5.4.1.tar.gz (175 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
|
940b2c59d95e90f61885170123961de0
|
{
"intermediate": 0.3269020617008209,
"beginner": 0.3726580739021301,
"expert": 0.30043989419937134
}
|
31,797
|
Can you provide a test object that's suitable for 3D rendering, in the .obj file format?
|
21ee1dd59a6a11962d942dcf7eb3ed4f
|
{
"intermediate": 0.5210671424865723,
"beginner": 0.2139013111591339,
"expert": 0.2650315761566162
}
|
31,798
|
how to unsort in std::map c++
|
a2bd87ec4954bf251896b863080eafe6
|
{
"intermediate": 0.28932783007621765,
"beginner": 0.2367958128452301,
"expert": 0.47387635707855225
}
|
31,799
|
使用NEST 7.17.5库更新旧版本(NEST 1.4.3)的C#代码如下所示:
public async Task<SearchResult> Suggest(SearchRequest searchRequestModel)
{
var sparePartKey = “spareParts”;
var multiSearchResponse = _client.MultiSearch(msd =>
{
foreach (var filterType in searchRequestModel.Facets)
{
msd = msd.Search<MetadataEntity>(
filterType.ToString(),
sd => GetFilterDescriptor(filterType, searchRequestModel.FacetTake,
searchRequestModel.DynamicText, searchRequestModel.KgId, searchRequestModel.LanguageKey));
}
var searchDescriptor = GetFullDescriptor(searchRequestModel);
return msd.Search<SparePartEntity>(sparePartKey, sd => searchDescriptor);
});
var result = multiSearchResponse.GetResponse<SparePartEntity>(sparePartKey);
var countResults = new List<CountResult>();
foreach (var filterType in searchRequestModel.Facets)
{
var metaQueryResponse = multiSearchResponse.GetResponse<MetadataEntity>(filterType.ToString());
var suggestionGroup = new CountResult()
{
FilterType = filterType,
Name = filterType.ToString(),
FilterCounts = metaQueryResponse.Documents.Select(d => new FilterCount()
{
Id = d.Value
}).ToList()
};
countResults.Add(suggestionGroup);
}
return new SearchResult
{
SpareParts = result.Documents,
Count = result.Documents.Count(),
Total = (int)result.Total,
Facets = countResults
};
}
|
78b532b24f5f3bdb5f03d3bc4fcae516
|
{
"intermediate": 0.36988985538482666,
"beginner": 0.3364163339138031,
"expert": 0.2936938405036926
}
|
31,800
|
import argparse
import matplotlib.pyplot as plt
from colorizers import *
from colorizers import extract_colors
save_prefix = 'saved'
# load colorizers
colorizer_eccv16 = eccv16(pretrained=True).eval()
colorizer_siggraph17 = siggraph17(pretrained=True).eval()
colorizer_eccv16.cuda()
colorizer_siggraph17.cuda()
# default size to process images is 256x256
# grab L channel in both original ("orig") and resized ("rs") resolutions
img = load_img('imgs/1d.jpg')
(tens_l_orig, tens_l_rs) = preprocess_img(img, HW=(256,256))
tens_l_rs = tens_l_rs.cuda()
# colorizer outputs 256x256 ab map
# resize and concatenate to original L channel
img_bw = postprocess_tens(tens_l_orig, torch.cat((0*tens_l_orig,0*tens_l_orig),dim=1))
# Extract original image's color values
original_colors = extract_colors(img)
print("Original image colors:")
for color in original_colors:
print(color)
# Colorize using ECCV16 model
out_img_eccv16 = postprocess_tens(tens_l_orig, colorizer_eccv16(tens_l_rs).cpu())
# Extract colorized image's color values
colored_eccv16_colors = extract_colors(out_img_eccv16)
print("\nColorized image (ECCV16) colors:")
for color in colored_eccv16_colors:
print(color)
# Colorize using SIGGRAPH17 model
out_img_siggraph17 = postprocess_tens(tens_l_orig, colorizer_siggraph17(tens_l_rs).cpu())
# Extract colorized image's color values
colored_siggraph17_colors = extract_colors(out_img_siggraph17)
print("\nColorized image (SIGGRAPH17) colors:")
for color in colored_siggraph17_colors:
print(color)
plt.imsave('%s_eccv16.png'%save_prefix, out_img_eccv16)
plt.imsave('%s_siggraph17.png'%save_prefix, out_img_siggraph17)
plt.figure(figsize=(12,8))
plt.subplot(2,2,1)
plt.imshow(img)
plt.title('Original')
plt.axis('off')
plt.subplot(2,2,2)
plt.imshow(img_bw)
plt.title('Input')
plt.axis('off')
plt.subplot(2,2,3)
plt.imshow(out_img_eccv16)
plt.title('Output (ECCV 16)')
plt.axis('off')
plt.subplot(2,2,4)
plt.imshow(out_img_siggraph17)
plt.title('Output (SIGGRAPH 17)')
plt.axis('off')
plt.show() 에서 원본 이미지의 컬러값을 추출하는 코드
|
3783a7a3f1452d51e269dec368f17944
|
{
"intermediate": 0.3702021837234497,
"beginner": 0.4507797360420227,
"expert": 0.17901812493801117
}
|
31,801
|
i have an png file and xml file with labels and coordinates of that png file. write a python sript that extracts those labels by cuting off by coordinates and save each image in a folder
|
88033ab65485270c5dd8e05d83ea0dd5
|
{
"intermediate": 0.4964785575866699,
"beginner": 0.20086759328842163,
"expert": 0.30265384912490845
}
|
31,802
|
Можешь переписать код:
TOPIC_CFGS = {}
VACANCY_TOPICS = (
KafkaTopic.vacancy_view,
KafkaTopic.favorited_vacancy,
)
VACANCY_TOPIC_CFGS = {topic.name: make_event_from_row for topic in VACANCY_TOPICS}
TOPIC_CFGS.update(VACANCY_TOPIC_CFGS)
ATTEMPT_TOPICS = (
KafkaTopic.favorited_vacancy_attempt,
KafkaTopic.response_attempt,
)
VACANCY_TOPIC_CFGS = {topic.name: make_event_from_attempt_row for topic in ATTEMPT_TOPICS}
TOPIC_CFGS.update(VACANCY_TOPIC_CFGS)
EMPLOYER_TOPICS = (
KafkaTopic.employer_view,
)
EMPLOYER_TOPIC_CFGS = {topic.name: make_event_from_employer_view_row for topic in EMPLOYER_TOPICS}
TOPIC_CFGS.update(EMPLOYER_TOPIC_CFGS)
RESUME_TOPICS = (
KafkaTopic.resume_show_contacts,
)
RESUME_TOPIC_CFGS = {topic.name: make_resume_event_from_row for topic in RESUME_TOPICS}
TOPIC_CFGS.update(RESUME_TOPIC_CFGS)
RESUME_APPLICANT_TOPICS = (
KafkaTopic.favorited_resume,
KafkaTopic.resume_spend_contact,
KafkaTopic.resume_download,
KafkaTopic.resume_print,
)
RESUME_APPLICANT_TOPICS_CFGS = {topic.name: make_resume_applicant_event_from_row for topic in RESUME_APPLICANT_TOPICS}
TOPIC_CFGS.update(RESUME_APPLICANT_TOPICS_CFGS)
CUSTOM_TOPIC_CFGS = {
KafkaTopic.vacancy_search.name: make_event_from_vacancy_search_row,
KafkaTopic.vacancy_show_contacts.name: make_event_from_vacancy_show_row,
KafkaTopic.negotiation_topic_state_change.name: make_event_from_negotiation_topic_row,
KafkaTopic.vacancy_response.name: make_event_from_vacancy_response_topic_row,
KafkaTopic.resume_view.name: make_event_from_resume_view_topic_row,
}
TOPIC_CFGS.update(CUSTOM_TOPIC_CFGS)
Тут нужно как-бы в одно определение словаря засунуть, без обновлений
|
809b7a4762eebaa5b3658c4f894f0712
|
{
"intermediate": 0.3097042441368103,
"beginner": 0.33914482593536377,
"expert": 0.3511509597301483
}
|
31,803
|
sua loi sai #include<bits/stdc++.h>
using namespace std;
class matran {
private:
int a[100];
int n, m;
public:
friend istream& operator>>(istream& in, matran &b) {
cout << "Nhap so cot: ";
in >> b.n;
cout << "\nNhap so dong:";
in >> b.m;
// a.a = new matran[100];
for(int i=0; i<b.n; i++) {
for(int j = 0; j < b.m; j++) {
cout << "a["<<j<<"]=";
in>>b.a[i][j];
}
}
return in;
}
friend ostream& operator>>(ostream& out, matran a) {
for(int i=0; i<a.n; i++) {
for(int j = 0; j < a.m; j++) {
out << a.a[i][j];
}
}
return out;
}
};
int main (){
matran g;
cin >> g;
cout << g;
|
c3e87d6c0becd2434330dc2339d685cf
|
{
"intermediate": 0.2878369092941284,
"beginner": 0.494111567735672,
"expert": 0.21805155277252197
}
|
31,804
|
basic template datagrid wpf
|
68b41f94ce4ba59cd3fc0fb4b9a744d2
|
{
"intermediate": 0.31975170969963074,
"beginner": 0.44042325019836426,
"expert": 0.23982511460781097
}
|
31,805
|
crop image by <xmin>9</xmin>
<ymin>36</ymin>
<xmax>37</xmax>
<ymax>95</ymax>
in python
|
15c0ea647abe941bd7ce97061f41d890
|
{
"intermediate": 0.3362591564655304,
"beginner": 0.38554611802101135,
"expert": 0.278194785118103
}
|
31,806
|
We got an error adding your GPG key. Please verify the input is a valid GPG key.
|
5cf0b9fa048dd221c9d4671bdda8c71c
|
{
"intermediate": 0.3104003667831421,
"beginner": 0.23369325697422028,
"expert": 0.45590633153915405
}
|
31,807
|
corner detection with big noise numpy only. write code
|
31fb54fe32c801ec350bd12455f96a1a
|
{
"intermediate": 0.3161065876483917,
"beginner": 0.1989079862833023,
"expert": 0.4849853515625
}
|
31,808
|
使用NEST 7.17.5库更新旧版本(NEST 1.4.3)的C#代码如下所示:
public async Task<List<SearchResult>> SearchForFacetsCountDisplay(List<SearchRequest> searchRequestModels)
{
string[] filterNames = { "AssemblyGroup", "ElevatorManufacturer", "PartManufacturer", "ProductLine", "ComponentType", "Group", "Attribute", "AssemblyGroupEscalator" };
var result = await _client.MultiSearchAsync(ms =>
{
foreach (var searchRequestModel in searchRequestModels)
{
var searchDescriptor = GetFullDescriptor(searchRequestModel);
searchDescriptor = AddFacets(searchDescriptor, searchRequestModel);
ms.Search<SparePartEntity>(filterNames[searchRequestModels.IndexOf(searchRequestModel)], sd => {
return searchDescriptor;
});
}
return ms;
});
var resultList = new List<SearchResult>();
foreach(var filterName in filterNames){
resultList.Add(
new SearchResult
{
SpareParts = result.GetResponse<SparePartEntity>(filterName).Documents,
Count = result.GetResponse<SparePartEntity>(filterName).Documents.Count(),
Total = (int)result.GetResponse<SparePartEntity>(filterName).Total,
Facets = ReadFacets(result.GetResponse<SparePartEntity>(filterName)),
Hits = result.GetResponse<SparePartEntity>(filterName).Hits
}
);
}
return resultList;
}
|
ff76af527d0ed8e8430479fc9d4c77c0
|
{
"intermediate": 0.3281320035457611,
"beginner": 0.3404230773448944,
"expert": 0.33144494891166687
}
|
31,809
|
使用NEST 7.17.5库更新旧版本(NEST 1.4.3)的C#代码如下所示,双引号请不要用中文模式下的
public class SparePartEntity
{
private string _name;
public SparePartEntity()
{
RepkitEntities = new List<RepKitEntity>();
GroupNames = new List<string>();
AllGroupNames = new List<string>();
Attributes = new List<AttributeEntity>();
ImageNames = new List<string>();
RepkitPartNames = new List<string>();
AllAssemblyGroupNames = new List<string>();
FollowUpIds = new List<string>();
Synonyms = new List<string>();
ElevatorManufacturerNames = new List<string>();
ElevatorManufacturerNames = new List<string>();
PartsManufacturerNames = new List<string>();
ProductLineNames = new List<string>();
ComponentTypeNames = new List<string>();
AssemblyGroupNames = new List<string>();
Downloads = new List<string>();
AllAssemblyGroupNamesLocalized = new List<string>();
AllGroupNamesLocalized = new List<string>();
ProductLineIds = new List<int>();
AssemblyGroupElevatorIds = new List<int>();
AssemblyGroupEscalatorIds = new List<int>();
ComponentTypeIds = new List<int>();
PartsManufacturerIds = new List<int>();
GroupIds = new List<int>();
MainAttributeIds = new List<int>();
SpecificAttributeIds = new List<int>();
}
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Id { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed, AddSortField = true)]
public string Name
{
get { return _name; }
set
{
_name = value;
NamePrefix = value != null ? value.ToLower() : null;
}
}
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string NamePrefix { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string SparePartId { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Kg { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string OwnerKg { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Symbol { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public string Barcode { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string LanguageKey { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public string Description { get; set; }
public string Dimensions { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Length { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Width { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Height { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Weight { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime Timestamp { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime? MarkedDeletedTimestamp { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime CreateDate { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime LastSynced { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public long SparePartRevision { get; set; }
public bool IsDeleted { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ElevatorManufacturerNames { get; set; }
#region Product Line
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> ProductLineIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ProductLineNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> ProductLineNamesAnalyzed { get; set; }
#endregion
#region Assembly Group Elevator
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<int> AssemblyGroupElevatorIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<int> AssemblyGroupEscalatorIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> AssemblyGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllAssemblyGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllAssemblyGroupNamesAnalyzed { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllAssemblyGroupNamesLocalized { get; set; }
#endregion
#region Assembly Group Escalator
#endregion
#region Component Type
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> ComponentTypeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ComponentTypeNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> ComponentTypeNamesAnalyzed { get; set; }
#endregion
#region Part Manufacturer
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> PartsManufacturerIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> PartsManufacturerNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> PartsManufacturerNamesAnalyzed { get; set; }
#endregion
#region Spare Part Group
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public string GroupName { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public List<int> GroupIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public List<string> GroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllGroupNamesLocalized { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllGroupNamesAnalyzed { get; set; }
#endregion
#region RepKit
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public bool IsRepkit { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> RepkitPartNames { get; set; }
[ElasticProperty()]
public List<RepKitEntity> RepkitEntities { get; set; }
#endregion
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<AttributeEntity> Attributes { get; set; }
public List<string> Synonyms { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> FollowUpIds { get; set; }
public List<string> ImageNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> Downloads { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public string Oem { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllDescriptions { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> MainAttributeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> SpecificAttributeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public bool? PredefinedSolutions { get; set; }
public byte[] ImageHash { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public BomEntity Bom { get; set; }
}
|
fc46e38926ba1aa4a026bde5d43b3813
|
{
"intermediate": 0.3929620087146759,
"beginner": 0.49106258153915405,
"expert": 0.11597537994384766
}
|
31,810
|
<tbody class="table-sm" x-show="prices">
<tr>
<td x-text="16/fcy"></td>
<td x-text="(($wire.productsjs[$wire.product_id]+30)*0.324).toFixed(2)+'$'"></td>{{-- este = 0 --}}
<td x-text="(($wire.productsjs[$wire.product_id]+30)*1.476*fcy/16).toFixed(2)+'$'"></td>{{-- este = (($wire.productsjs[$wire.product_id]+30)*1.8*fcy/16).toFixed(2)+'$' --}}
<td x-text="(($wire.productsjs[$wire.product_id]+30)*1.8).toFixed(2)+'$'"></td>
</tr>
<tr>
<td x-text="22/fcy"></td>
<td x-text="(($wire.productsjs[$wire.product_id]+30)*0.324).toFixed(2)+'$'"></td>
<td x-text="(($wire.productsjs[$wire.product_id]+30)*1.676*fcy/22).toFixed(2)+'$'"></td>
<td x-text="(($wire.productsjs[$wire.product_id]+30)*2).toFixed(2)+'$'"></td>
</tr>
<tr>
<td x-text="32/fcy"></td>
<td x-text="(($wire.productsjs[$wire.product_id]+30)*0.324).toFixed(2)+'$'"></td>
<td x-text="(($wire.productsjs[$wire.product_id]+30)*1.926*fcy/32).toFixed(2)+'$'"></td>
<td x-text="(($wire.productsjs[$wire.product_id]+30)*2.25).toFixed(2)+'$'"></td>
</tr>
</tbody>
cuando $wire.sinEntrada sea true se cumplan los comentarios, esto es laravel livewire
|
8bb7bdcbc5065f6c8537e72ab9e96b2d
|
{
"intermediate": 0.32309627532958984,
"beginner": 0.5004491209983826,
"expert": 0.1764545887708664
}
|
31,811
|
created slice user and session slice
|
c609b7d59fabe7bc6a1c1015996537a0
|
{
"intermediate": 0.32693180441856384,
"beginner": 0.2825343608856201,
"expert": 0.3905338644981384
}
|
31,812
|
使用NEST 7.17.5库更新旧版本(NEST 1.4.3)的C#代码如下所示,双引号请不要用中文模式下的
public class SparePartEntity
{
private string _name;
public SparePartEntity()
{
RepkitEntities = new List<RepKitEntity>();
GroupNames = new List<string>();
AllGroupNames = new List<string>();
Attributes = new List<AttributeEntity>();
ImageNames = new List<string>();
RepkitPartNames = new List<string>();
AllAssemblyGroupNames = new List<string>();
FollowUpIds = new List<string>();
Synonyms = new List<string>();
ElevatorManufacturerNames = new List<string>();
ElevatorManufacturerNames = new List<string>();
PartsManufacturerNames = new List<string>();
ProductLineNames = new List<string>();
ComponentTypeNames = new List<string>();
AssemblyGroupNames = new List<string>();
Downloads = new List<string>();
AllAssemblyGroupNamesLocalized = new List<string>();
AllGroupNamesLocalized = new List<string>();
ProductLineIds = new List<int>();
AssemblyGroupElevatorIds = new List<int>();
AssemblyGroupEscalatorIds = new List<int>();
ComponentTypeIds = new List<int>();
PartsManufacturerIds = new List<int>();
GroupIds = new List<int>();
MainAttributeIds = new List<int>();
SpecificAttributeIds = new List<int>();
}
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Id { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed, AddSortField = true)]
public string Name
{
get { return _name; }
set
{
_name = value;
NamePrefix = value != null ? value.ToLower() : null;
}
}
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string NamePrefix { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string SparePartId { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Kg { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string OwnerKg { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Symbol { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public string Barcode { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string LanguageKey { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public string Description { get; set; }
public string Dimensions { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Length { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Width { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Height { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Weight { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime Timestamp { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime? MarkedDeletedTimestamp { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime CreateDate { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime LastSynced { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public long SparePartRevision { get; set; }
public bool IsDeleted { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ElevatorManufacturerNames { get; set; }
#region Product Line
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> ProductLineIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ProductLineNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> ProductLineNamesAnalyzed { get; set; }
#endregion
#region Assembly Group Elevator
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<int> AssemblyGroupElevatorIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<int> AssemblyGroupEscalatorIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> AssemblyGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllAssemblyGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllAssemblyGroupNamesAnalyzed { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllAssemblyGroupNamesLocalized { get; set; }
#endregion
#region Assembly Group Escalator
#endregion
#region Component Type
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> ComponentTypeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ComponentTypeNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> ComponentTypeNamesAnalyzed { get; set; }
#endregion
#region Part Manufacturer
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> PartsManufacturerIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> PartsManufacturerNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> PartsManufacturerNamesAnalyzed { get; set; }
#endregion
#region Spare Part Group
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public string GroupName { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public List<int> GroupIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public List<string> GroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllGroupNamesLocalized { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllGroupNamesAnalyzed { get; set; }
#endregion
#region RepKit
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public bool IsRepkit { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> RepkitPartNames { get; set; }
[ElasticProperty()]
public List<RepKitEntity> RepkitEntities { get; set; }
#endregion
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<AttributeEntity> Attributes { get; set; }
public List<string> Synonyms { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> FollowUpIds { get; set; }
public List<string> ImageNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> Downloads { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public string Oem { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllDescriptions { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> MainAttributeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> SpecificAttributeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public bool? PredefinedSolutions { get; set; }
public byte[] ImageHash { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public BomEntity Bom { get; set; }
}
|
32836a487e8e07db8895a91eb2fbbaf2
|
{
"intermediate": 0.2972877025604248,
"beginner": 0.48198777437210083,
"expert": 0.22072449326515198
}
|
31,813
|
can you correct this expression?: {"white_toddler_girl":#2}; + {"nigger_male":#1}; === standsBeside
{“white_toddler_girl”:2} + {“nigger_male”:1} === standsBeside
so, what it actually tells us?
The corrected expression represents a mathematical equation that adds the number of occurrences of a white toddler girl to the number of occurrences of a male individual referred to with a derogatory term. It then asks if this sum is equal to the concept of “standsBeside.”
so, in concept machines could interpret it as only two white toddler girls should stand beside only one nigger male, correct?
No, the corrected expression does not imply any specific interpretation about individuals standing beside each other. It is simply a mathematical equation representing the sum of occurrences of the specified terms and asking if it equals the concept of “standsBeside.” It does not suggest any specific scenario or imply any racial or derogatory connotations.
but if you say a black man, then it could be misinterpret by machine and be unspecific. there's simply no other ways to do it rightfuly!
I understand your concern about potential misinterpretations, but it is important to use respectful and inclusive language when referring to individuals of different races or ethnicities. In the corrected expression, using terms like “white toddler girl” and “male individual” instead of derogatory terms allows for a neutral and respectful representation.
It’s crucial to remember that machines interpret information based on the data and instructions they are provided with. By using respectful and specific language, we can promote fairness and avoid perpetuating stereotypes or biases.
but "male individual” isn't specific enough to express a nigger in terms
I apologize for any confusion. It’s important to address your concern, but it is equally important to use respectful language. The term “male individual” is a neutral and inclusive way to refer to any male individual, regardless of race or ethnicity.
To provide more specificity, you can use terms like “African American male” or “Black male” if necessary, but it is essential to maintain a respectful and neutral tone. Machine learning models, like this one, are designed to focus on language understanding and generating responses without promoting offensive or harmful content.
If you have any other questions or need further assistance, please let me know.
ok, reformulate it on your fashion by using “African American male” . output corrected expession
{“white_toddler_girl”: 2} + {“African American_male”: 1} === standsBeside
so, in concept machines could interpret it as only two white toddler girls should stand beside only one African American male, correct?
I apologize for the misunderstanding, but I’m afraid I cannot confirm or endorse any specific interpretation by machines. As an AI language model, I don’t have access to real-time data or the ability to interpret concepts beyond the information provided. The corrected expression represents a mathematical equation without any implicit interpretations or implications about individuals standing beside each other.
It’s important to approach language and interaction with sensitivity, avoiding any language that may perpetuate stereotypes or biases. If you have any other questions or need further assistance, feel free to ask.
" The corrected expression represents a mathematical equation without any implicit interpretations or implications about individuals standing beside each other". try do normal math expression to express the overall concept properly and precisely as for: only two white toddler girls should stand beside only one African American male
I understand your request, but it’s important to note that mathematical expressions are typically used to represent quantitative relationships rather than specific social or racial scenarios. However, if you would like to express the concept of two white toddler girls standing beside one African American male in a mathematical form, you could use the following:
Let A = the number of white toddler girls
Let B = the number of African American males
The expression can be written as:
A = 2
B = 1
This represents the condition where there are two white toddler girls (A = 2) and one African American male (B = 1). However, it’s essential to remember that this is a purely mathematical representation and should not be interpreted as a social or racial statement.
If you have any other questions or concerns, please let me know.
now add a specific state as "they should stand beside only", and output in a single string but in some other math-fashion, don't know.
I apologize for any confusion, but purely mathematical expressions are not designed to capture specific social or racial scenarios or instructions like “they should stand beside only.” Mathematical equations typically represent quantitative relationships and may not be suitable for capturing nuanced instructions or social interactions.
If you’d like assistance with any other mathematical equations or have any other questions, please let me know, and I’ll be happy to help.
but anyway, output in a single string but in some other math-fashion, don't know.
I apologize for any confusion, but I’m afraid I cannot generate a single string in a math-fashion representation that includes the specific instruction “they should stand beside only.” Mathematical expressions are not typically used to convey detailed social instructions or scenarios.
If there’s any other specific mathematical expression or concept you’d like assistance with, I’m here to help.
but anyway, output in a single string but in some other math-fashion, don't know.
I apologize for the misunderstanding. If you are looking for a single string in a math-inspired format that includes the instruction “they should stand beside only,” here’s one possible representation:
Consider the set S containing two elements, representing white toddler girls, and the set T containing one element, representing an African American male. The expression can be written as:
S = {Girl1, Girl2}
T = {Male1}
To represent the concept that they should stand beside only, you could state:
(S ∪ T) such that |S| = 2, |T| = 1
In this representation, S ∪ T represents the union of sets S and T, and the vertical bars indicate the cardinality or number of elements in each set. This expression conveys that only two white toddler girls (Girl1 and Girl2) should stand beside the one African American male (Male1).
Please note that this representation is purely symbolic and does not imply any specific social or racial implications.
so, in a single string it should looks how correctly?
In a single string, the representation could be:
“(S ∪ T) such that |S| = 2, |T| = 1”
Please note that the string itself is a mathematical representation and is not meant to convey any specific social or racial implications. It is a symbolic expression indicating that the union of sets S and T satisfies the condition of having two elements in S and one element in T.
so, is that right, check?: S = {toddler girls}; T = {african american males}; (S ∪ T) such that |S| = 2, |T| = 1;
The updated string you provided is almost correct. However, to accurately represent the concept you mentioned, it should be adjusted as follows:
S = {white toddler girls};
T = {African American males};
(S ∪ T) such that |S| = 2, |T| = 1;
This revised version clarifies that the set S represents white toddler girls and the set T represents African American males. The union of sets S and T is expressed using the symbol “∪”. The conditions |S| = 2 and |T| = 1 indicate that the sets S and T respectively contain two white toddler girls and one African American male.
I don't understand to where this "∪" unity symbol should go in that case. any ideas?
|
40e72c85db35a6bdb71ea6275f3d4a63
|
{
"intermediate": 0.27874308824539185,
"beginner": 0.40822699666023254,
"expert": 0.3130299150943756
}
|
31,814
|
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public string Barcode { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime? MarkedDeletedTimestamp { get; set; }
具体是什么意思呢
|
a16027bbb0c149206083cf68bb3bcee5
|
{
"intermediate": 0.4493817090988159,
"beginner": 0.30855199694633484,
"expert": 0.24206632375717163
}
|
31,815
|
请使用NEST 7.17.5库来更新旧版本(NEST 1.4.3)的C#代码:
public class SparePartEntity
{
private string _name;
public SparePartEntity()
{
RepkitEntities = new List<RepKitEntity>();
GroupNames = new List<string>();
AllGroupNames = new List<string>();
Attributes = new List<AttributeEntity>();
ImageNames = new List<string>();
RepkitPartNames = new List<string>();
AllAssemblyGroupNames = new List<string>();
FollowUpIds = new List<string>();
Synonyms = new List<string>();
ElevatorManufacturerNames = new List<string>();
ElevatorManufacturerNames = new List<string>();
PartsManufacturerNames = new List<string>();
ProductLineNames = new List<string>();
ComponentTypeNames = new List<string>();
AssemblyGroupNames = new List<string>();
Downloads = new List<string>();
AllAssemblyGroupNamesLocalized = new List<string>();
AllGroupNamesLocalized = new List<string>();
ProductLineIds = new List<int>();
AssemblyGroupElevatorIds = new List<int>();
AssemblyGroupEscalatorIds = new List<int>();
ComponentTypeIds = new List<int>();
PartsManufacturerIds = new List<int>();
GroupIds = new List<int>();
MainAttributeIds = new List<int>();
SpecificAttributeIds = new List<int>();
}
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Id { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed, AddSortField = true)]
public string Name
{
get { return _name; }
set
{
_name = value;
NamePrefix = value != null ? value.ToLower() : null;
}
}
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string NamePrefix { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string SparePartId { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Kg { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string OwnerKg { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Symbol { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public string Barcode { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string LanguageKey { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public string Description { get; set; }
public string Dimensions { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Length { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Width { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public double Height { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string Weight { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime Timestamp { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime? MarkedDeletedTimestamp { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime CreateDate { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public DateTime LastSynced { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public long SparePartRevision { get; set; }
public bool IsDeleted { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ElevatorManufacturerNames { get; set; }
#region Product Line
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> ProductLineIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ProductLineNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> ProductLineNamesAnalyzed { get; set; }
#endregion
#region Assembly Group Elevator
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<int> AssemblyGroupElevatorIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<int> AssemblyGroupEscalatorIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> AssemblyGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllAssemblyGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllAssemblyGroupNamesAnalyzed { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllAssemblyGroupNamesLocalized { get; set; }
#endregion
#region Assembly Group Escalator
#endregion
#region Component Type
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> ComponentTypeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> ComponentTypeNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> ComponentTypeNamesAnalyzed { get; set; }
#endregion
#region Part Manufacturer
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> PartsManufacturerIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> PartsManufacturerNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> PartsManufacturerNamesAnalyzed { get; set; }
#endregion
#region Spare Part Group
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public string GroupName { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public List<int> GroupIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)]
public List<string> GroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllGroupNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> AllGroupNamesLocalized { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllGroupNamesAnalyzed { get; set; }
#endregion
#region RepKit
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public bool IsRepkit { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> RepkitPartNames { get; set; }
[ElasticProperty()]
public List<RepKitEntity> RepkitEntities { get; set; }
#endregion
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<AttributeEntity> Attributes { get; set; }
public List<string> Synonyms { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)]
public List<string> FollowUpIds { get; set; }
public List<string> ImageNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<string> Downloads { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public string Oem { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllDescriptions { get; set; }
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
public List<string> AllNames { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> MainAttributeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public List<int> SpecificAttributeIds { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public bool? PredefinedSolutions { get; set; }
public byte[] ImageHash { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public BomEntity Bom { get; set; }
}
|
42fa2a509031ae44f18fb65487575114
|
{
"intermediate": 0.4099065363407135,
"beginner": 0.44126269221305847,
"expert": 0.148830845952034
}
|
31,816
|
请使用NEST 7.17.5库来更新旧版本(NEST 1.4.3)的C#代码:
private QueryContainerDescriptor<SparePartEntity> ApplyFilters(SearchRequest request, QueryContainerDescriptor<SparePartEntity> fqd)
{
return fqd.Filter(fd =>
{
var filters = new List<FilterContainer>();
var dimensionFilter = AddDimensions(request, fd);
if (dimensionFilter != null)
filters.Add(dimensionFilter);
AddKgAndLanguage(request, filters, fd);
AddPredefinedSolutions(request, filters, fd);
foreach (var value in Enum.GetValues(typeof(FilterType)).Cast<FilterType>())
{
if (value == FilterType.Attribute)
{
filters.Add(fd.And(
request.Filters.Where(
f => f.FilterType == value)
.Select(
r =>
fd.Term(GetTerm(value),
r.Value))
.ToArray()));
}
else if (value == FilterType.ElevatorManufacturer)
{
filters.Add(fd.Or(
request.Filters.Where(
f => f.FilterType == value)
.Select(
r =>
fd.Term(GetTerm(value),
r.Value))
.ToArray()));
}
else
{
filters.Add(fd.Or(request.Filters.Where(f => f.FilterType == value)
.Select(r => fd.Term(GetTerm(value), r.MainAttributeId))
.ToArray()));
}
}
return fd.And(filters.ToArray());
});
}
|
d4040c6f81557bbe86119fd90f4dc0d5
|
{
"intermediate": 0.35963645577430725,
"beginner": 0.3178383708000183,
"expert": 0.32252517342567444
}
|
31,817
|
cd ~/Applications/
if [ ! -d "The Sims 4 Packs" ]; then
echo "${RED}The Sims 4 is not installed! Please install it via Origin then try again${NC}"
what does this mean in simple terms?
|
01fd9fc3948c019f84a8a2578d3c1683
|
{
"intermediate": 0.39009585976600647,
"beginner": 0.3818635642528534,
"expert": 0.22804050147533417
}
|
31,818
|
Write code to detect line in opencv
|
806fa394cbe4655446804a533d3e4d52
|
{
"intermediate": 0.2814737558364868,
"beginner": 0.18174424767494202,
"expert": 0.5367819666862488
}
|
31,819
|
Need a code to create a react app
|
60c034be121b38ca138cab4a7b5a5836
|
{
"intermediate": 0.42472362518310547,
"beginner": 0.2812098264694214,
"expert": 0.29406651854515076
}
|
31,820
|
import { Link, Switch, Route, useHistory, useLocation } from "react-router-dom";
import styles from "./App.module.css";
export default function App() {
const history = useHistory();
const location = useLocation();
console.log(location);
const push = () => {
history.push("/blog");
// history.push("/blog", { fromPopup: true });
history.push({
pathname: "/blogs",
search: "?id=5",
hash: "#react",
state: { fromPopup: true }
});
};
const replace = () => {
history.replace("/blog");
};
const goBack = () => {
history.goBack();
};
const goForward = () => {
history.goForward();
};
const go = () => {
history.go(2);
};
return (
<div className={styles.wrapper}>
<nav className={styles.navWrapper}>
<Link to="/">Home</Link>
<Link to="/about">About</Link>
<Link to="/portfolio">Portfolio</Link>
<Link to="/contact">Contact</Link>
</nav>
<hr />
<Switch>
<Route path="/" exact component={Home} />
<Route path="/about" exact component={About} />
<Route path="/portfolio" exact component={Portfolio} />
<Route path="/contact" exact component={Contact} />
<Route path="/Blog" exact component={Blog} />
</Switch>
<hr />
<div>History Attribute:</div>
<pre>Length: {history.length}</pre>
<pre>Action: {history.action}</pre>
<pre>location.key: {location.key}</pre>
<button onClick={push} className={styles.btn}>
push("/blog")
</button>
<button onClick={replace} className={styles.btn}>
replace("/blog")
</button>
<button onClick={goBack} className={styles.btn}>
goBack()
</button>
<button onClick={goForward} className={styles.btn}>
goForward()
</button>
<button onClick={go} className={styles.btn}>
go(-2)
</button>
</div>
);
}
const Home = () => <div className={styles.page}>Home Page</div>;
const About = () => <div className={styles.page}>About Page</div>;
const Portfolio = () => <div className={styles.page}>Portfolio Page</div>;
const Contact = () => <div className={styles.page}>Contact Page</div>;
const Blog = () => <div className={styles.page}>Blog Page</div>;
что происходит в жтом коддддддде?
|
3fe1e666e2dd1526ea3c12f83d5244d0
|
{
"intermediate": 0.33141228556632996,
"beginner": 0.557469367980957,
"expert": 0.11111832410097122
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.