row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
31,420
|
python code using LSTM encoder and GRU decoder rnn to translate English text to Arabic text by splitting data from file into train. validate and test ,Tokenize the sentences and convert them into numerical representations ,Pad or truncate the sentences to a fixed length and use test data to evaluate and examples translation from test
|
94cc46bf1fd89305c26ecf05dda11319
|
{
"intermediate": 0.4190566837787628,
"beginner": 0.11253827810287476,
"expert": 0.4684050381183624
}
|
31,421
|
class Solver(object):
def __init__(self):
self.filter_size = 7
self.threshold = 0.1
self.dist = 90
self.max_corners = 120
def get_window_weight(self):
gausskernel=np.zeros((self.filter_size,self.filter_size),np.float32)
offset = self.filter_size // 2
for i in range (self.filter_size):
for j in range (self.filter_size):
norm=np.square(i-offset) + np.square(j-offset)
gausskernel[i, j] = np.exp(-norm / (2 * np.square(1)))
sum = np.sum (gausskernel)
kernel = gausskernel / sum
return kernel
def find_corners(self, image):
Ix = cv2.Scharr(image, cv2.CV_64F, 1, 0)
Iy = cv2.Scharr(image, cv2.CV_64F, 0, 1)
#Iy, Ix = np.gradient(image)
Ixx = np.square(Ix)
Iyy = np.square(Iy)
Ixy = Ix * Iy#
height = image.shape[0]
width = image.shape[1]
offset = self.filter_size // 2
weight = self.get_window_weight()
corners = []
for y in range(offset, height - offset):
for x in range(offset, width - offset):
fIxx = Ixx[y - offset:y + offset + 1, x - offset:x + offset + 1]
fIyy = Iyy[y - offset:y + offset + 1, x - offset:x + offset + 1]
fIxy = Ixy[y - offset:y + offset + 1, x - offset:x + offset + 1]#
Sxx = (fIxx * weight).sum()
Syy = (fIyy * weight).sum()
Sxy = (fIxy * weight).sum()#
A = np.array([[Sxx, Sxy],
[Sxy, Syy]])
R = min(np.linalg.eigh(A)[0])
if R > 0:
corners.append([x, y, R])
return np.array(corners)
def filtered_corners(self, corners):
corners = corners[corners[:, 2].argsort()]
corners = np.flip(corners, axis = 0)
thresh = corners[0,2] * self.threshold
corners = corners[corners[:,2] >= thresh]
distance_filtered_corners = [corners[0]]
for x in corners:
bigger = True
for y in distance_filtered_corners:
if np.linalg.norm(x[:2] - np.array(y[:2])) <= self.dist:
bigger = False
break
if bigger:
distance_filtered_corners.append(x)
if len(distance_filtered_corners) > self.max_corners:
return distance_filtered_corners[:self.max_corners]
return distance_filtered_corners
def image_pre_processing(self, img):
img = cv2.GaussianBlur(img, (5, 5), 0)
return img
def solve(self, image_gray: np.ndarray) -> list:
image = self.image_pre_processing(image_gray)
corners = self.find_corners(image)
filtered_corners_list = self.filtered_corners(corners)
keypoints = list(np.array(filtered_corners_list)[:, [0,1]].astype(int))
return keypoints
solver = Solver()
corners = solver.solve(image)
ПОЛУЧАЮ ОШИБКУ:
ValueError: operands could not be broadcast together with shapes (5,5,3) (5,5)
|
9623ac13ed00a6c619bb17604589f0e1
|
{
"intermediate": 0.3312561810016632,
"beginner": 0.390240341424942,
"expert": 0.27850350737571716
}
|
31,422
|
6645093 hex color in reaper theme script
|
30b7088cd09cb60d985f65a0c9a1df8f
|
{
"intermediate": 0.3535367250442505,
"beginner": 0.36839431524276733,
"expert": 0.2780689299106598
}
|
31,423
|
public class DatabaseManagerImpl extends Thread implements DatabaseManager {
private static final DatabaseManagerImpl instance = new DatabaseManagerImpl();
private Map<String, User> cache;
private boolean isAchievementCompleted;
private DatabaseManagerImpl() {
super(“DatabaseManagerImpl THREAD”);
this.cache = new TreeMap(String.CASE_INSENSITIVE_ORDER);
}
public void register(User user) {
this.configurateNewAccount(user);
Garage garage = new Garage();
garage.parseJSONData();
garage.setUserId(user.getNickname());
Karma emptyKarma = new Karma();
emptyKarma.setUserId(user.getNickname());
user.isAchievementCompleted(false); // Установите значение по умолчанию
Session session = null;
Transaction tx = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
session.save(user);
session.save(garage);
session.save(emptyKarma);
tx.commit();
} catch (Exception var7) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var7.printStackTrace();
RemoteDatabaseLogger.error(var7);
}
}
public void update(Karma karma) {
Session session = null;
Transaction tx = null;
User user = null;
if ((user = (User)this.cache.get(karma.getUserId())) != null) {
user.setKarma(karma);
}
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
session.update(karma);
tx.commit();
} catch (Exception var6) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var6.printStackTrace();
RemoteDatabaseLogger.error(var6);
}
}
public void update(Garage garage) {
Session session = null;
Transaction tx = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
// Измените запрос SQL, чтобы обновить поле “isAchievementCompleted” на 1 (true)
SQLQuery query = session.createSQLQuery(“UPDATE garage SET isAchievementCompleted = true WHERE garageId = :garageId”);
query.setParameter(“garageId”, garage.getGarageId());
query.executeUpdate();
session.update(garage);
tx.commit();
} catch (Exception var5) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
}
}
public void update(User user) {
Session session = null;
Transaction tx = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
session.update(user);
tx.commit();
} catch (Exception var5) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
}
}
public User getUserById(String nickname) {
Session session = null;
Transaction tx = null;
User user = null;
if ((user = this.getUserByIdFromCache(nickname)) != null) {
return user;
} else {
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
Query query = session.createQuery(“FROM User U WHERE U.nickname = :nickname”);
query.setString(“nickname”, nickname);
user = (User)query.uniqueResult();
tx.commit();
} catch (Exception var6) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var6.printStackTrace();
RemoteDatabaseLogger.error(var6);
}
return user;
}
}
public static DatabaseManager instance() {
return instance;
}
public void cache(User user) {
if (user == null) {
Logger.log(Type.ERROR, “DatabaseManagerImpl::cache user is null!”);
} else {
this.cache.put(user.getNickname(), user);
}
}
public void uncache(String id) {
this.cache.remove(id);
}
public User getUserByIdFromCache(String nickname) {
return (User)this.cache.get(nickname);
}
public boolean contains(String nickname) {
return this.getUserById(nickname) != null;
}
public void configurateNewAccount(User user) {
user.setCrystall(5);
user.setNextScore(100);
user.setType(TypeUser.DEFAULT);
user.setEmail((String)null);
}
public int getCacheSize() {
return this.cache.size();
}
public void initHallOfFame() {
Session session = null;
new ArrayList();
try {
session = HibernateService.getSessionFactory().getCurrentSession();
List<User> users = session.createCriteria(User.class).list();
HallOfFame.getInstance().initHallFromCollection(users);
} catch (Exception var4) {
RemoteDatabaseLogger.error(var4);
}
}
public Garage getGarageByUser(User user) {
Session session = null;
Transaction tx = null;
Garage garage = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
Query query = session.createQuery(“FROM Garage G WHERE G.userId = :nickname”);
query.setString(“nickname”, user.getNickname());
garage = (Garage)query.uniqueResult();
tx.commit();
} catch (Exception var6) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var6.printStackTrace();
RemoteDatabaseLogger.error(var6);
}
return garage;
}
public Karma getKarmaByUser(User user) {
Session session = null;
Transaction tx = null;
Karma karma = null;
if (user.getKarma() != null) {
return user.getKarma();
} else {
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
Query query = session.createQuery(“FROM Karma K WHERE K.userId = :nickname”);
query.setString(“nickname”, user.getNickname());
karma = (Karma)query.uniqueResult();
tx.commit();
} catch (Exception var6) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var6.printStackTrace();
RemoteDatabaseLogger.error(var6);
}
return karma;
}
}
public BlackIP getBlackIPbyAddress(String address) {
Session session = null;
BlackIP ip = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
session.beginTransaction();
Query query = session.createQuery(“FROM BlackIP B WHERE B.ip = :ip”);
query.setString(“ip”, address);
ip = (BlackIP)query.uniqueResult();
session.getTransaction().commit();
} catch (Exception var5) {
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
}
return ip;
}
public void register(BlackIP blackIP) {
Session session = null;
Transaction tx = null;
if (this.getBlackIPbyAddress(blackIP.getIp()) == null) {
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
session.saveOrUpdate(blackIP);
tx.commit();
} catch (Exception var5) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
}
}
}
public void unregister(BlackIP blackIP) {
Session session = null;
Transaction tx = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
SQLQuery query = session.createSQLQuery(“delete from tanks.black_ips where ip = :ip”);
query.setString(“ip”, blackIP.getIp());
query.executeUpdate();
tx.commit();
} catch (Exception var5) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
}
}
public void register(LogObject log) {
Session session = null;
Transaction tx = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
session.save(log);
tx.commit();
} catch (Exception var5) {
var5.printStackTrace();
}
}
public List<LogObject> collectLogs() {
Session session = null;
List logs = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
Transaction tx = session.beginTransaction();
logs = session.createCriteria(LogObject.class).list();
tx.commit();
return logs;
} catch (Exception var5) {
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
return null;
}
}
public Payment getPaymentById(long paymentId) {
Session session = null;
Payment payment = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
session.beginTransaction();
Query query = session.createQuery(“FROM Payment p WHERE p.idPayment = :pid”);
query.setLong(“pid”, paymentId);
payment = (Payment)query.uniqueResult();
session.getTransaction().commit();
} catch (Exception var6) {
var6.printStackTrace();
RemoteDatabaseLogger.error(var6);
}
return payment;
}
public void update(Payment payment) {
Session session = null;
Transaction tx = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
tx = session.beginTransaction();
session.update(payment);
tx.commit();
} catch (Exception var5) {
if (tx.wasRolledBack()) {
tx.rollback();
}
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
}
}
public List<Garage> collectGarages() {
Session session = null;
List garages = null;
try {
session = HibernateService.getSessionFactory().getCurrentSession();
Transaction tx = session.beginTransaction();
garages = session.createCriteria(Garage.class).list();
tx.commit();
return garages;
} catch (Exception var5) {
var5.printStackTrace();
RemoteDatabaseLogger.error(var5);
return null;
}
}
}
СДЕЛАЙ НАКОНЕЦ ЧТОБЫ ЭТОТ МЕТОД public synchronized void onTryBuyItem(String itemId, int count) {
if (count > 0 && count <= 9999) {
Item item = (Item)GarageItemsLoader.items.get(itemId.substring(0, itemId.length() - 3));
Item fromUser = null;
int price = item.price * count;
int itemRang = item.modifications[0].rank;
if (this.checkMoney(price)) {
if (this.getLocalUser().getRang() + 1 < itemRang) {
return;
}
if ((fromUser = this.localUser.getGarage().buyItem(itemId, count, 0)) != null) {
this.send(Type.GARAGE, “buy_item”, StringUtils.concatStrings(item.id, “_m”, String.valueOf(item.modificationIndex)), JSONUtils.parseItemInfo(fromUser));
this.addCrystall(-price);
this.localUser.getGarage().parseJSONData();
database.update(this.localUser); // Обновите информацию о пользователе, чтобы изменить значение поля “isAchievementCompleted”
this.send(Type.LOBBY, “complete_achievement”, String.valueOf(0));
} else {
this.send(Type.GARAGE, “try_buy_item_NO”);
}
}
} else {
this.crystallToZero();
}
}
МЕНЯЛ ИМЕННО ЗНАЧЕНИЕ isAchievementCompleted В ТАБЛИЦЕ БАЗЫ ДАННЫХ НА TRUE ТОЕСТЬ НА 1
|
97a0bd1d4f09895d26048118c7e962f8
|
{
"intermediate": 0.30643248558044434,
"beginner": 0.5510717630386353,
"expert": 0.14249572157859802
}
|
31,424
|
Implementation of OFDM based on MATLAB
|
6cc53b4fc998bc2a1088118909edfd70
|
{
"intermediate": 0.3259311318397522,
"beginner": 0.188373401761055,
"expert": 0.4856955111026764
}
|
31,425
|
paraphrase detection simple code
|
dc1ebf95a9872f34535a0e6fee9c167e
|
{
"intermediate": 0.24068933725357056,
"beginner": 0.3719756007194519,
"expert": 0.38733506202697754
}
|
31,426
|
if (this.localUser.getGarage().getItemCount() < 6) {
this.send(Type.LOBBY,"complete_achievement", String.valueOf(0));
} как это переделать его под show_nube_new_rank только уже с вместо количества предметов в гараже, поднятия ранга до 1 а дальше уже не показывать окно. надо его добавить сюда public void addScore(LobbyManager lobby, int score) {
if (lobby == null) {
RemoteDatabaseLogger.error("TanksServices::addScore: lobby null!");
} else {
User user = lobby.getLocalUser();
if (user == null) {
RemoteDatabaseLogger.error("TanksServices::addScore: user null!");
} else {
user.addScore(score);
boolean increase = user.getScore() >= user.getNextScore();
boolean fall = user.getScore() < RankUtils.getRankByIndex(user.getRang()).min;
if (increase || (fall && user.getRang() == 2)) {
user.setRang(RankUtils.getNumberRank(RankUtils.getRankByScore(user.getScore())));
user.setNextScore(user.getRang() == 26 ? RankUtils.getRankByIndex(user.getRang()).max : RankUtils.getRankByIndex(user.getRang()).max + 1);
lobby.send(Type.LOBBY, "update_rang_progress", String.valueOf(10000));
lobby.send(Type.LOBBY, "update_rang", String.valueOf(user.getRang() + 1), String.valueOf(user.getNextScore()));
}
int update = RankUtils.getUpdateNumber(user.getScore());
lobby.send(Type.LOBBY, "update_rang_progress", String.valueOf(update));
lobby.send(Type.LOBBY, "add_score", String.valueOf(user.getScore()));
this.database.update(user);
}
}
}
|
8ccc4ed773846e7776b946826e8f1707
|
{
"intermediate": 0.30993935465812683,
"beginner": 0.4573523998260498,
"expert": 0.23270821571350098
}
|
31,427
|
The input is given as a series of positive integers of arbitrary length. Each series ends with the number -1. In other words, your program should accept input until it sees the number -1. Note that the value 1- is only a sign of the end of the string and is not among the chart values in c++
|
2d99d21200272c813a2b56a25c14fce3
|
{
"intermediate": 0.3906404674053192,
"beginner": 0.15556959807872772,
"expert": 0.45378991961479187
}
|
31,428
|
I just realized how much data you could actually collect on a website visitor with just the navigator.
you can make so many assumptions based on that data and theres much more past just navigator.
|
1fcecb47405b270f2cb484ef4385c212
|
{
"intermediate": 0.45858415961265564,
"beginner": 0.20859557390213013,
"expert": 0.3328202962875366
}
|
31,429
|
how to get some number with function in c++
|
e7fdea2331e4f6c04282cf58e9605290
|
{
"intermediate": 0.27049124240875244,
"beginner": 0.45721402764320374,
"expert": 0.272294819355011
}
|
31,430
|
help me figure out why I can't move in 3d:
extends CharacterBody3D
enum State { IDLE, RUN, JUMP, ATTACK }
var state = State.IDLE
var velocity = Vector3.ZERO # Adding velocity as a member variable
@export var movement_data : MovementData
@export var stats : Stats
# References
@onready var animation_tree : AnimationTree = $AnimationTree
@onready var animation_state : AnimationNodeStateMachinePlayback = animation_tree.get("parameters/playback")
func _ready():
animation_tree.active = true
stats.health = stats.max_health
func _physics_process(delta):
process_movement_input(delta)
process_gravity(delta)
process_actions()
# Move and slide with snap when on floor, else without snap
var snap = Vector3.DOWN * 20 if is_on_floor() else Vector3.ZERO
move_and_slide_with_snap(velocity, snap, Vector3.UP)
update_animation_state()
func process_gravity(delta):
if not is_on_floor():
velocity.y += movement_data.gravity * movement_data.gravity_scale * delta
else:
velocity.y = -0.01 # The small sinking force to keep the player snapped to the floor
func process_movement_input(delta):
print("Input Vector: ", input_vector)
print("Direction: ", direction)
print("Velocity before: ", velocity)
var input_vector = Vector2(Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
Input.get_action_strength("move_back") - Input.get_action_strength("move_forward"))
if input_vector.length() > 0:
input_vector = input_vector.normalized() # Normalize input_vector if it has a length
var direction = -transform.basis.z * input_vector.y + transform.basis.x * input_vector.x
state = State.RUN
velocity.x = direction.x * movement_data.max_speed
velocity.z = direction.z * movement_data.max_speed
look_at(global_transform.origin + direction, Vector3.UP) # Rotate player to face the direction of movement
else:
if state == State.RUN:
state = State.IDLE # When there’s no input, and we were running, switch to idle state
velocity.x = lerp(velocity.x, 0, movement_data.friction * delta)
velocity.z = lerp(velocity.z, 0, movement_data.friction * delta)
func process_actions():
if Input.is_action_just_pressed("jump") and is_on_floor():
perform_jump()
if Input.is_action_just_pressed("attack"):
perform_attack()
func perform_jump():
velocity.y = movement_data.jump_strength
state = State.JUMP # Update state to JUMP when jumping is performed
# Handle jump animation, sound etc.
func perform_attack():
state = State.ATTACK # Set state to ATTACK
animation_state.travel("Attack")
# Add attack logic here …
func update_animation_state():
match state:
State.IDLE:
animation_state.travel("Idle")
State.RUN:
animation_state.travel("Run")
State.JUMP:
if velocity.y > 0:
animation_state.travel("Jump")
else:
animation_state.travel("Fall")
State.ATTACK:
# Assuming perform_attack will ensure the state transitions out of ATTACK when done
# Override method from player base to handle damage and death
func take_damage(damage: int):
stats.health -= damage
if stats.health <= 0:
die()
else:
# Play damage animation, sound etc.
func die():
state = State.IDLE # Consider whether you want to change animation or state after death
# Play death animation, particle effect etc.
queue_free() # Be sure you want to remove the player from the scene at this point
|
8f967f3ce0b14d2e75cd5e4531a7565c
|
{
"intermediate": 0.31633296608924866,
"beginner": 0.41167503595352173,
"expert": 0.2719919979572296
}
|
31,431
|
apply bert for feature extraction using quora dataset
|
18e898e39fcea96849a343c4ebb57cfc
|
{
"intermediate": 0.23002073168754578,
"beginner": 0.20551417768001556,
"expert": 0.5644650459289551
}
|
31,432
|
package gtanks.battles.timer.schedulers.runtime;
import gtanks.StringUtils;
import gtanks.battles.BattlefieldPlayerController;
import gtanks.battles.managers.SpawnManager;
import gtanks.battles.tanks.math.Vector3;
import gtanks.commands.Type;
import gtanks.json.JSONUtils;
import gtanks.logger.remote.RemoteDatabaseLogger;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
public class TankRespawnScheduler {
private static final Timer TIMER = new Timer("TankRespawnScheduler timer");
private static final long TIME_TO_PREPARE_SPAWN = 3000L;
private static final long TIME_TO_SPAWN = 5000L;
private static HashMap<BattlefieldPlayerController, TankRespawnScheduler.PrepareToSpawnTask> tasks = new HashMap();
private static boolean disposed;
public static void startRespawn(BattlefieldPlayerController player, boolean onlySpawn) {
if (!disposed) {
try {
if (player == null) {
return;
}
if (player.battle == null) {
return;
}
TankRespawnScheduler.PrepareToSpawnTask task = new TankRespawnScheduler.PrepareToSpawnTask();
task.player = player;
task.onlySpawn = onlySpawn;
tasks.put(player, task);
if (onlySpawn) {
TIMER.schedule(task, 1000L);
} else {
TIMER.schedule(task, 5000L);
}
} catch (Exception var3) {
var3.printStackTrace();
RemoteDatabaseLogger.error(var3);
}
}
}
public static void dispose() {
disposed = true;
}
public static void cancelRespawn(BattlefieldPlayerController player) {
try {
TankRespawnScheduler.PrepareToSpawnTask task = (TankRespawnScheduler.PrepareToSpawnTask)tasks.get(player);
if (task == null) {
return;
}
if (task.spawnTask == null) {
task.cancel();
} else {
task.spawnTask.cancel();
}
tasks.remove(player);
} catch (Exception var2) {
var2.printStackTrace();
RemoteDatabaseLogger.error(var2);
}
}
static class PrepareToSpawnTask extends TimerTask {
public TankRespawnScheduler.SpawnTask spawnTask;
public BattlefieldPlayerController player;
public Vector3 preparedPosition;
public boolean onlySpawn;
public void run() {
try {
if (this.player == null) {
return;
}
if (this.player.tank == null) {
return;
}
if (this.player.battle == null) {
return;
}
this.preparedPosition = SpawnManager.getSpawnState(this.player.battle.battleInfo.map, this.player.playerTeamType);
if (this.onlySpawn) {
this.player.send(Type.BATTLE, "prepare_to_spawn", StringUtils.concatStrings(this.player.tank.id, ";", String.valueOf(this.preparedPosition.x), "@", String.valueOf(this.preparedPosition.y), "@", String.valueOf(this.preparedPosition.z), "@", String.valueOf(this.preparedPosition.rot)));
} else {
if (this.player.battle == null) {
return;
}
this.player.tank.position = this.preparedPosition;
this.player.send(Type.BATTLE, "prepare_to_spawn", StringUtils.concatStrings(this.player.tank.id, ";", String.valueOf(this.preparedPosition.x), "@", String.valueOf(this.preparedPosition.y), "@", String.valueOf(this.preparedPosition.z), "@", String.valueOf(this.preparedPosition.rot)));
}
this.spawnTask = new TankRespawnScheduler.SpawnTask();
this.spawnTask.preparedSpawnTask = this;
if (this.onlySpawn) {
TankRespawnScheduler.TIMER.schedule(this.spawnTask, 1000L);
}
else {
TankRespawnScheduler.TIMER.schedule(this.spawnTask, 5000L);
}
} catch (Exception var2) {
var2.printStackTrace();
RemoteDatabaseLogger.error(var2);
}
}
}
static class SpawnTask extends TimerTask {
TankRespawnScheduler.PrepareToSpawnTask preparedSpawnTask;
public void run() {
try {
BattlefieldPlayerController player = this.preparedSpawnTask.player;
if (player == null) {
return;
}
if (player.tank == null) {
return;
}
if (player.battle == null) {
return;
}
player.battle.tanksKillModel.changeHealth(player.tank, 10000);
Thread.sleep(5000); // задержка в 5 секунд
player.battle.sendToAllPlayers(Type.BATTLE, "spawn", JSONUtils.parseSpawnCommand(player, this.preparedSpawnTask.preparedPosition));
player.tank.state = "newcome";
TankRespawnScheduler.tasks.remove(player);
} catch (Exception var2) {
var2.printStackTrace();
RemoteDatabaseLogger.error(var2);
}
}
}
}
опиши максимально действия каждой строки
|
78121e5451f91b1e0ff3c2586599b7b3
|
{
"intermediate": 0.2773163616657257,
"beginner": 0.5994316339492798,
"expert": 0.12325207889080048
}
|
31,433
|
how to retrieve latest value from service bus topic via c#
|
69dcb457067a402c1d5bad5d7f9ec122
|
{
"intermediate": 0.4290790855884552,
"beginner": 0.34747007489204407,
"expert": 0.22345083951950073
}
|
31,434
|
Script inherits from native type 'CharacterBody3D', so it can't be assigned to an object of type: 'Node3D'
extends CharacterBody3D
class_name Player3D
enum State { IDLE, RUN, JUMP, ATTACK }
var state = State.IDLE
@export var movement_data : MovementData
@export var stats : Stats
# References
@onready var animation_tree : AnimationTree = $AnimationTree
@onready var animation_state : AnimationNodeStateMachinePlayback = animation_tree.get("parameters/playback")
func _ready():
animation_tree.active = true
stats.health = stats.max_health
func _physics_process(delta):
process_movement_input(delta)
process_gravity(delta)
process_actions()
# Move and slide with snap when on floor, else without snap
var snap = Vector3.DOWN * 20 if is_on_floor() else Vector3.ZERO
move_and_slide()
update_animation_state()
func process_gravity(delta):
if not is_on_floor():
velocity.y += movement_data.gravity * movement_data.gravity_scale * delta
else:
velocity.y = -0.01 # The small sinking force to keep the player snapped to the floor
func process_movement_input(delta):
var input_vector = Vector2(
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
-(Input.get_action_strength("move_back") - Input.get_action_strength("move_forward"))
).normalized()
if input_vector.length() > 0:
var direction = global_transform.basis * Vector3(input_vector.x, 0, input_vector.y)
direction = direction.normalized()
state = State.RUN
velocity.x = direction.x * movement_data.max_speed
velocity.z = direction.z * movement_data.max_speed
look_at(global_transform.origin + direction, Vector3.UP) # Rotate the player to face the direction of movement
else:
if state == State.RUN:
state = State.IDLE # When there’s no input, and we were running, switch to idle state
velocity.x = lerp(velocity.x, 0, movement_data.friction * delta) # Smoothly reduce velocity to zero using linear interpolation
velocity.z = lerp(velocity.z, 0, movement_data.friction * delta) # Smoothly reduce velocity to zero using linear interpolation
# Debug prints (optional)
print("Input Vector: ", input_vector)
print("Velocity: ", velocity)
func process_actions():
if Input.is_action_just_pressed("jump") and is_on_floor():
perform_jump()
if Input.is_action_just_pressed("attack"):
perform_attack()
func perform_jump():
velocity.y = movement_data.jump_strength
state = State.JUMP # Update state to JUMP when jumping is performed
# Handle jump animation, sound etc.
func perform_attack():
state = State.ATTACK # Set state to ATTACK
animation_state.travel("Attack")
# Add attack logic here …
func update_animation_state():
match state:
State.IDLE:
animation_state.travel("Idle")
State.RUN:
animation_state.travel("Run")
State.JUMP:
if velocity.y > 0:
animation_state.travel("Jump")
else:
animation_state.travel("Fall")
|
c80a6bb069577600cc5b32d2c6952463
|
{
"intermediate": 0.2587839663028717,
"beginner": 0.44394350051879883,
"expert": 0.2972724735736847
}
|
31,435
|
TypeError: list indices must be integers or slices, not tuple
|
d0c44746be41bfefb3566ce18ec064c8
|
{
"intermediate": 0.5497788786888123,
"beginner": 0.1733584851026535,
"expert": 0.2768627107143402
}
|
31,436
|
rewrite this 3d character into 2d:
extends CharacterBody3D
class_name Player3D
enum State { IDLE, RUN, JUMP, ATTACK }
var state = State.IDLE
@export var movement_data : MovementData
@export var stats : Stats
func _ready():
stats.health = stats.max_health
func _physics_process(delta):
process_movement_input(delta)
process_gravity(delta)
process_actions()
# Move and slide with snap when on floor, else without snap
var snap = Vector3.DOWN * 20 if is_on_floor() else Vector3.ZERO
self.velocity = velocity # Set the velocity property of the CharacterBody3D
move_and_slide() # Call move_and_slide() without arguments
update_animation_state()
func process_gravity(delta):
if not is_on_floor() or velocity.y > 0:
velocity.y += movement_data.gravity * movement_data.gravity_scale * delta
if is_on_floor() and velocity.y <= 0:
velocity.y = 0 # Stop vertical movement when on the floor
func process_movement_input(delta):
var input_vector = Vector2(
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
Input.get_action_strength("move_back") - Input.get_action_strength("move_forward")
).normalized()
if input_vector.length() > 0:
var basis = global_transform.basis.orthonormalized()
var direction = basis.xform(Vector3(input_vector.x, 0, input_vector.y)).normalized()
state = State.RUN
velocity.x = direction.x * movement_data.max_speed
velocity.z = direction.z * movement_data.max_speed
look_at(global_transform.origin + direction, Vector3.UP)
else:
if state == State.RUN:
state = State.IDLE # When there’s no input, and we were running, switch to idle state
velocity.x = lerp(velocity.x, 0, movement_data.friction * delta)
velocity.z = lerp(velocity.z, 0, movement_data.friction * delta)
# Debug prints (optional)
print("Input Vector: ", input_vector)
print("Velocity: ", velocity)
func process_actions():
if Input.is_action_just_pressed("jump") and is_on_floor():
perform_jump()
if Input.is_action_just_pressed("attack"):
perform_attack()
func perform_jump():
velocity.y = movement_data.jump_strength
state = State.JUMP # Update state to JUMP when jumping is performed
# Handle jump animation, sound etc.
func perform_attack():
state = State.ATTACK # Set state to ATTACK
# Add attack logic here …
func update_animation_state():
match state:
State.IDLE:
# Code to update the player's animation state to idle
pass
State.RUN:
# Code to update the player's animation state to run
pass
State.JUMP:
# Code to update the player's animation state to jump
pass
State.ATTACK:
# Code to update the player's animation state to attack
pass
|
f78566f98fb6f0da6fb9a25b44b7feae
|
{
"intermediate": 0.2937013804912567,
"beginner": 0.4902971386909485,
"expert": 0.216001495718956
}
|
31,437
|
hello
|
2976007732695ca54df12c331d6c43b3
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
31,438
|
how to specify in regular expression quantity of simbols
|
b8014b56309aaceacf959a0a4a78712f
|
{
"intermediate": 0.3605712056159973,
"beginner": 0.44324812293052673,
"expert": 0.19618065655231476
}
|
31,439
|
Make sure all arrays contain the same number of samples.
in this code
epochs = 30
batch_size = 64
history = model.fit(x=[q1_X_train, q2_X_train],
y=to_categorical(y_train),
epochs=epochs,
batch_size=batch_size,
validation_data=([q1_X_test, q2_X_test], to_categorical(y_test)),callbacks=callbacks)
|
4cf95f473adb04ac931c77941b337b10
|
{
"intermediate": 0.3482554852962494,
"beginner": 0.3125629127025604,
"expert": 0.3391816020011902
}
|
31,440
|
else if (args[0] === "lobby")
{
args.shift();
lobby.onData(socket, args);
send(socket, "show_achievements", );
} как send(socket, "show_achievements", ); добавить это "{\"ids\":[0,1]}"
|
b09748e2e9bd3297bf11f7f2970f1624
|
{
"intermediate": 0.40665531158447266,
"beginner": 0.3378157913684845,
"expert": 0.25552883744239807
}
|
31,441
|
i need a complete working code for sentences similarity detection using quora
|
785b22fa9514232caa56452765d613ab
|
{
"intermediate": 0.2888489365577698,
"beginner": 0.09195122122764587,
"expert": 0.619199812412262
}
|
31,442
|
number = [1, 2, 4, 5, 1]
def find_duplicate(num):
new = 0
if len(number) == 1:
return -1
else:
for i in range(0, len(number) + 1):
n = number.count(i)
if i > 1:
print(i)
else:
print("-1")
result = find_duplicate(number)
print(result) correct my code
|
db810be7acd051f468dde9fc05aad4e5
|
{
"intermediate": 0.23524360358715057,
"beginner": 0.5727150440216064,
"expert": 0.19204135239124298
}
|
31,443
|
how can I make so it seems like the background has a collision in a 2.5d game in godot? I added the picture as the background now I need to make so the user can move freely up and down on the map and only colide with the edges or walla
my character:
extends CharacterBody2D
class_name Player25D
enum State { IDLE, RUN, JUMP, ATTACK }
var state = State.IDLE
var bullets_amount: int = 30
var attack_animation: String = "Attack1"
var player_base = PlayerBase.new()# Use PlayerBase’s set_health method¨
@export var movement_data : MovementData
@export var stats : Stats
# References
@onready var animator : AnimatedSprite2D = $AnimatedSprite2D
@onready var guns_animator : AnimationPlayer = $ShootingAnimationPlayer
@onready var hit_animator : AnimationPlayer = $HitAnimationPlayer
@onready var hand : Node2D = $Hand
@onready var pistol : Sprite2D = $Hand/Pivot/Pistol
@onready var pistol_bullet_marker : Marker2D = $Hand/Pivot/Pistol/PistolBulletMarker
@onready var attacking: bool = false
@export var camera: Camera2D
# Load Scenes
@onready var muzzle_load: PackedScene = preload("res://Scenes/Particles/muzzle.tscn")
@onready var bullet_load: PackedScene = preload("res://Scenes/Props/bullet.tscn")
@onready var death_particle_load: PackedScene = preload("res://Scenes/Particles/player_death_particle.tscn")
func _ready():
stats.health = stats.max_health
player_base.set_health(stats.health)
EventManager.bullets_amount = bullets_amount
EventManager.update_bullet_ui.emit()
func _physics_process(delta):
apply_gravity(delta)
var input_vector = Input.get_axis("move_left","move_right")
if input_vector != 0:
apply_acceleration(input_vector, delta)
else:
apply_friction(delta)
if Input.is_action_just_pressed("SwapPlane"):
_on_swapPlane()
if Input.is_action_just_pressed("jump") and is_on_floor():
jump()
if Input.is_action_just_pressed("shoot"):
animator.play("Attacking")
if bullets_amount:
guns_animator.play("Shoot")
move_and_slide()
animate(input_vector)
func apply_acceleration(input_vector, delta):
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
func apply_friction(delta):
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func apply_gravity(delta):
if not is_on_floor():
velocity.y += movement_data.gravity * movement_data.gravity_scale * delta
func process_gravity(delta):
if not is_on_floor():
velocity.y += movement_data.gravity * movement_data.gravity_scale * delta
func process_movement_input(delta):
var input_vector = Input.get_axis("move_left", "move_right")
if input_vector != 0:
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
else:
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func process_actions():
if Input.is_action_just_pressed("jump") and is_on_floor():
perform_jump()
if Input.is_action_just_pressed("shoot"):
perform_attack()
func animate(input_vector):
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
if mouse_position.x > 0 and animator.flip_h:
animator.flip_h = false
elif mouse_position.x < 0 and not animator.flip_h:
animator.flip_h = true
hand.rotation = mouse_position.angle()
if hand.scale.y == 1 and mouse_position.x < 0:
hand.scale.y = -1
elif hand.scale.y == -1 and mouse_position.x > 0:
hand.scale.y = 1
if state != State.ATTACK:
if is_on_floor():
if input_vector != 0:
animator.play("Run")
else:
animator.play("Idle")
else:
if velocity.y > 0:
animator.play("Jump")
# Check if the current animation is the attack animation
func perform_jump():
velocity.y = -movement_data.jump_strength
AudioManager.play_sound(AudioManager.JUMP)
func perform_attack():
if not bullets_amount: return
state = State.ATTACK
animator.play("Attacking")
guns_animator.play("Shoot")
shoot()
func shoot():
state = State.ATTACK
attack_animation = "Attack" + str(randi_range(1, 2))
animator.play(attack_animation)
$Hand/AttackArea/CollisionShape2D.disabled = false;
await animator.animation_looped
EventManager.update_bullet_ui.emit()
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
var muzzle = muzzle_load.instantiate()
var bullet = bullet_load.instantiate()
pistol_bullet_marker.add_child(muzzle)
bullet.global_position = pistol_bullet_marker.global_position
bullet.target_vector = mouse_position
bullet.rotation = mouse_position.angle()
get_tree().current_scene.add_child(bullet)
AudioManager.play_sound(AudioManager.SHOOT)
$Hand/AttackArea/CollisionShape2D.disabled = true;
state = State.IDLE
func update_animation_state():
if state == State.ATTACK:
return
if is_on_floor():
if velocity.x != 0:
animator.play("Run")
else:
animator.play("Idle")
else:
animator.play("Jump") if velocity.y < 0 else animator.play("Fall")
func _on_hurtbox_area_entered(_area):
if not _area.is_in_group("Bullet"):
hit_animator.play("Hit")
take_damage(1) # If damage is to be variable, extract value from _area
EventManager.frame_freeze.emit()
func die():
AudioManager.play_sound(AudioManager.DEATH)
animator.play("Died")
spawn_death_particle()
EventManager.player_died.emit()
queue_free()
func spawn_death_particle():
var death_particle = death_particle_load.instantiate()
death_particle.global_position = global_position
get_tree().current_scene.add_child(death_particle)
# Override PlayerBase method
func take_damage(damage: int) -> void:
player_base.health -= damage # Use the health property from PlayerBase
if player_base.health <= 0:
die()
else:
AudioManager.play_sound(AudioManager.HURT)
func _on_swapPlane():
PlayerState.set_last_2d_position(global_position);
SceneChanger.change_to_3d(global_position) # Calls the singleton to change to 3D scene
# Implement the move method required by PlayerBase, the actual movement
# logic is in the _physics_process function above.
func move(input_dir: Vector2) -> void:
# For Player2D, the move function is handled by process_movement_input,
# so no additional logic is needed here.
pass
# Implement the attack method required by PlayerBase. This is a placeholder
# and the actual logic for starting an attack is in the perform_attack function.
func attack() -> void:
perform_attack()
# Adjust the jump method to use jump_strength from PlayerBase
func jump():
velocity.y = -movement_data.jump_strength
AudioManager.play_sound(AudioManager.JUMP)
func _on_health_changed(new_health: int) -> void:
player_base.health = new_health # Make sure to update it when health changes
# Handle health change (e.g., update UI)
|
a59a26dc6ac80b74a0526de95c56a70e
|
{
"intermediate": 0.3909936547279358,
"beginner": 0.48361632227897644,
"expert": 0.12539006769657135
}
|
31,444
|
Write a function that receives a list of
numbers, and then returns the number
that repeats the most (mode).
Eg. If you pass [1, 2, 3, 3, 2, 5, 6, 2]
Your function should return 2.
|
cc2a4b40efc6504223f788d594c88b74
|
{
"intermediate": 0.26484373211860657,
"beginner": 0.45419037342071533,
"expert": 0.2809659242630005
}
|
31,445
|
rewrite this to work with sprite2d instead of character2d:
extends Sprite2D
class_name Player25D
enum State { IDLE, RUN, JUMP, ATTACK }
var state = State.IDLE
var bullets_amount: int = 30
var attack_animation: String = "Attack1"
var player_base = PlayerBase.new()# Use PlayerBase’s set_health method¨
@export var movement_data : MovementData
@export var stats : Stats
# References
@onready var animator : AnimatedSprite2D = $AnimatedSprite2D
@onready var guns_animator : AnimationPlayer = $ShootingAnimationPlayer
@onready var hit_animator : AnimationPlayer = $HitAnimationPlayer
@onready var hand : Node2D = $Hand
@onready var pistol : Sprite2D = $Hand/Pivot/Pistol
@onready var pistol_bullet_marker : Marker2D = $Hand/Pivot/Pistol/PistolBulletMarker
@onready var attacking: bool = false
@export var camera: Camera2D
# Load Scenes
@onready var muzzle_load: PackedScene = preload("res://Scenes/Particles/muzzle.tscn")
@onready var bullet_load: PackedScene = preload("res://Scenes/Props/bullet.tscn")
@onready var death_particle_load: PackedScene = preload("res://Scenes/Particles/player_death_particle.tscn")
func _ready():
stats.health = player_base.health
player_base.set_health(stats.health)
EventManager.bullets_amount = bullets_amount
EventManager.update_bullet_ui.emit()
func _physics_process(delta):
var input_vector = Input.get_axis("move_left","move_right")
if input_vector != 0:
apply_acceleration(input_vector, delta)
else:
apply_friction(delta)
if Input.is_action_just_pressed("SwapPlane"):
_on_swapPlane()
if Input.is_action_just_pressed("shoot"):
animator.play("Attacking")
if bullets_amount:
guns_animator.play("Shoot")
apply_gravity(delta) # Apply gravity only when not on the floor
move_and_slide() # Move the player, Vector2.UP is the default floor normal
animate(input_vector)
func apply_acceleration(input_vector, delta):
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
func apply_friction(delta):
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func apply_gravity(delta):
if not is_on_floor():
velocity.y += movement_data.gravity * delta
else:
velocity.y = 0 # Stop falling when on the floor
func process_movement_input(delta):
var input_vector = Input.get_axis("move_left", "move_right")
if input_vector != 0:
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
else:
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func process_actions():
if Input.is_action_just_pressed("jump") and is_on_floor():
perform_jump()
if Input.is_action_just_pressed("shoot"):
perform_attack()
func animate(input_vector):
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
if mouse_position.x > 0 and animator.flip_h:
animator.flip_h = false
elif mouse_position.x < 0 and not animator.flip_h:
animator.flip_h = true
hand.rotation = mouse_position.angle()
if hand.scale.y == 1 and mouse_position.x < 0:
hand.scale.y = -1
elif hand.scale.y == -1 and mouse_position.x > 0:
hand.scale.y = 1
if state != State.ATTACK:
if is_on_floor():
if input_vector != 0:
animator.play("Run")
else:
animator.play("Idle")
else:
if velocity.y > 0:
animator.play("Jump")
# Check if the current animation is the attack animation
func perform_jump():
velocity.y = -movement_data.jump_strength
AudioManager.play_sound(AudioManager.JUMP)
func perform_attack():
if not bullets_amount: return
state = State.ATTACK
animator.play("Attacking")
guns_animator.play("Shoot")
shoot()
func shoot():
state = State.ATTACK
attack_animation = "Attack" + str(randi_range(1, 2))
animator.play(attack_animation)
$Hand/AttackArea/CollisionShape2D.disabled = false;
await animator.animation_looped
EventManager.update_bullet_ui.emit()
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
var muzzle = muzzle_load.instantiate()
var bullet = bullet_load.instantiate()
pistol_bullet_marker.add_child(muzzle)
bullet.global_position = pistol_bullet_marker.global_position
bullet.target_vector = mouse_position
bullet.rotation = mouse_position.angle()
get_tree().current_scene.add_child(bullet)
AudioManager.play_sound(AudioManager.SHOOT)
$Hand/AttackArea/CollisionShape2D.disabled = true;
state = State.IDLE
func update_animation_state():
if state == State.ATTACK:
return
if is_on_floor():
if velocity.x != 0:
animator.play("Run")
else:
animator.play("Idle")
else:
animator.play("Jump") if velocity.y < 0 else animator.play("Fall")
func _on_hurtbox_area_entered(_area):
if not _area.is_in_group("Bullet"):
hit_animator.play("Hit")
take_damage(1) # If damage is to be variable, extract value from _area
EventManager.frame_freeze.emit()
func die():
AudioManager.play_sound(AudioManager.DEATH)
animator.play("Died")
spawn_death_particle()
EventManager.player_died.emit()
queue_free()
func spawn_death_particle():
var death_particle = death_particle_load.instantiate()
death_particle.global_position = global_position
get_tree().current_scene.add_child(death_particle)
# Override PlayerBase method
func take_damage(damage: int) -> void:
player_base.health -= damage # Use the health property from PlayerBase
if player_base.health <= 0:
die()
else:
AudioManager.play_sound(AudioManager.HURT)
func _on_swapPlane():
PlayerState.set_last_2d_position(global_position);
SceneChanger.change_to_2d(global_position) # Calls the singleton to change to 3D scene
# Implement the move method required by PlayerBase, the actual movement
# logic is in the _physics_process function above.
func move(input_dir: Vector2) -> void:
# For Player2D, the move function is handled by process_movement_input,
# so no additional logic is needed here.
pass
# Implement the attack method required by PlayerBase. This is a placeholder
# and the actual logic for starting an attack is in the perform_attack function.
func attack() -> void:
perform_attack()
# Adjust the jump method to use jump_strength from PlayerBase
func jump():
velocity.y = -movement_data.jump_strength
AudioManager.play_sound(AudioManager.JUMP)
func _on_health_changed(new_health: int) -> void:
player_base.health = new_health # Make sure to update it when health changes
# Handle health change (e.g., update UI)
|
f9672d024b9ea068de4efccb9cbc0b1d
|
{
"intermediate": 0.39094075560569763,
"beginner": 0.38345539569854736,
"expert": 0.2256038337945938
}
|
31,446
|
Conduct kernel density estimation of DHSILR with different kernels (Gaussian, rectangular,
triangular, and cosine) and plot the results.
|
0ae5a625636e787595b48d2ded5c75d8
|
{
"intermediate": 0.21338559687137604,
"beginner": 0.12754039466381073,
"expert": 0.6590739488601685
}
|
31,447
|
It's not clear to me where the ampersand character is here:
At line:1 char:2
+ ‼& C:/Users/victo/anaconda3/python.exe "c:/Users/victo/Desktop/Ideas/ ...
+ ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as
part of a string.
At line:1 char:98
+ ... e "c:/Users/victo/Desktop/Ideas/5. Open Interpreter/chat.py"& C:/User ...
+ ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as
part of a string.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmpersandNotAllowed
|
5c5dd83ead6fcb2f732d2c95bb80964c
|
{
"intermediate": 0.41620635986328125,
"beginner": 0.23183578252792358,
"expert": 0.35195785760879517
}
|
31,448
|
This is a strange error to me. Despite my code below providing what is asked, I get the following error:
Traceback (most recent call last):
File "C:\Users\victo\Desktop\Ideas\5. Open Interpreter\chat.py", line 17, in <module>
completion = client.chat.completions.create()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\victo\anaconda3\Lib\site-packages\openai\_utils\_utils.py", line 298, in wrapper
raise TypeError(msg)
TypeError: Missing required arguments; Expected either ('messages' and 'model') or ('messages', 'model' and 'stream') arguments to be given
...
My Code
import os
import interpreter
# Example: reuse your existing OpenAI setup
import openai
from openai import OpenAI
openai.base_url = "http://localhost:1234/v1" # point to the local server
client = OpenAI(api_key='sk-111111111111111111111111111111111111111111111111')
#client = OpenAI(
#api_key=os.environ['OPENAI_API_KEY'], # this is also the default, it can be omitted
#)
completion = client.chat.completions.create()
model="local-model", # this field is currently unused
messages=[
{"role": "system", "content": "Always answer in rhymes."},
{"role": "user", "content": "Introduce yourself."}
]
completion(model="gpt-3.5-turbo", messages=[{ "content": "what's the weather in SF","role": "user"}])
print(completion.choices[0].text)
print(dict(completion).get('usage'))
print(completion.model_dump_json(indent=2))
#currentPath = os.path.dirname(os.path.abspath(__file__))
#config_path=os.path.join(currentPath, './config.test.yaml')
#interpreter.extend_config(config_path=config_path)
#message = "What operating system are we on?"
#for chunk in interpreter.chat(message, display=False, stream=True):
#print(chunk)
|
8a1315f770ab9537f5af7b365dc4b774
|
{
"intermediate": 0.49283820390701294,
"beginner": 0.4179510474205017,
"expert": 0.08921081572771072
}
|
31,449
|
can you help me write a program that hasa search bar and drop down settings menu
|
b52b03291a1ddf744ab8f5a8a3583124
|
{
"intermediate": 0.4060896635055542,
"beginner": 0.12800848484039307,
"expert": 0.4659018814563751
}
|
31,450
|
How would you use an "if" statement correctly?
if a == b:
print("a is equal to b")
endif
if a = b:
print("a is equal to b")
if a == b:
print("a is equal to b")
if (a == b) {
print("a is equal to b")
}
|
0c35ba9561b4130635a10d9df3c228a5
|
{
"intermediate": 0.2797379791736603,
"beginner": 0.5502620935440063,
"expert": 0.16999994218349457
}
|
31,451
|
i have a tensorflow lite model that detects objects on images. how do i use it in python? so i give it a path to an image and it gives me output
|
c4edece0c9f576a85d7e4182a739cb74
|
{
"intermediate": 0.3964909315109253,
"beginner": 0.059871792793273926,
"expert": 0.5436373353004456
}
|
31,452
|
What does std in c++ mean
|
21a6235263f3a6e30950cb0d112851b1
|
{
"intermediate": 0.23391394317150116,
"beginner": 0.590670645236969,
"expert": 0.17541545629501343
}
|
31,453
|
hi , Pleas help me to solve this qusition in centos 7 :1. Change your server name to your name, verify and
display after change
3
2. Write the command to restart rsyslog
3. Write command to make sure that a target is no
longer eligible for automatic start on system boot? 4. Which command should you use to show all service
units that are currently loaded?
3
5. Check if sshd service is run,and make it available
system boot by defafult.
3
6. Start iptables in this session. Explain if it start or not,
and why it start or not.
3
7. Which unit will start befor Apache http service ,and
make it wantedBy graphical target, is any conflicat
with other unit.
4
8. Display all running process with it pid 2
9. Write examples of unit isolating
|
dd49ce5de5140a95129862995caacc66
|
{
"intermediate": 0.4085497260093689,
"beginner": 0.38073259592056274,
"expert": 0.21071769297122955
}
|
31,454
|
#include<bits/stdc++.h>
using namespace std;
int f[10000];
int f1[10000];//c++不能在变量名用’,所以从f‘改为f1
float H,h,v0,s;
float g=9.8;
int x;
int main(){
cin>>g>>H>>h>>v0>>s;
for(int i=1;i<=30;i++){
cin>>f[i];
cin>>f1[i];
x=sqrt(2*g*H/(f1[i]*f1[i])+1)*((sqrt(2*g*H*f[i])/((f1[i]*f1[i])+1)-2*g*h)+sqrt((2*g*h+2*g*H*f[i])/(f1[i]*f1[i]+1)-2*g*(h-v0/s))-2*(sqrt((2*g*H*f[i])/(f1[i]*f1[i]+1))/2*g));
}
cout<<x;
return 0;
}错误在哪
|
beac587439f83248a3cf5706b2ef9dfb
|
{
"intermediate": 0.3098101019859314,
"beginner": 0.45394113659858704,
"expert": 0.23624873161315918
}
|
31,455
|
i have a tensorflow lite model that detects objects on images. how do i use it in python? so i give it a path to an image and it gives me output
|
9e8591a5c2a15aadeaeee749e44b5488
|
{
"intermediate": 0.3964909315109253,
"beginner": 0.059871792793273926,
"expert": 0.5436373353004456
}
|
31,456
|
<div class="container pt-4 pt-xl-5" id="home">
<div class="row gx-5 align-items-center btop">
<div class="col-6" style="position: relative;">
<div class="mb-5 mb-lg-0 text-center text-lg-start">
<h1 class="fw-bold" style="display: inline;">САМОЕ ЦЕННОЕ</h1>
</div>
</div>
<div class="col-6" style="position: relative;">
<div class="mb-5 mb-lg-0 text-center text-lg-start"><img class="img-fluid" data-wow-duration="2s" src="assets/img/heart.png"></div>
</div>
</div>
<div class="row gx-5 align-items-center bbot wow bounceInUp" style="position: relative;">
<div class="col-6">
<div class="mb-5 mb-lg-0 text-center text-lg-start">
<h1 class="fw-bold" style="display: inline; position: relative;top:50px;"><br>ВСЕГДА ПОД ЗАЩИТОЙ</h1>
</div>
</div>
<div class="col-6">
<div class="mb-5 mb-lg-0 text-center text-lg-start"><img class="img-fluid" src="assets/img/bubble.png" style="opacity: 0.70;"></div>
</div>
</div>
</div> блок с классом bbot должен находитьна поверх блока с классом btop
|
caade77209b49685099866b72d21f185
|
{
"intermediate": 0.3425664007663727,
"beginner": 0.3975217938423157,
"expert": 0.25991183519363403
}
|
31,457
|
Ошибка в native c++ kotlin:
FATAL EXCEPTION: GLThread 208972
Process: com.example.jni_cube, PID: 10700
java.lang.UnsatisfiedLinkError: dlopen failed: library "libnative-lib.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.example.jni_cube.JNIWrapper.<clinit>(JNIWrapper.kt:5)
at com.example.jni_cube.RendererWrapper.onSurfaceCreated(RendererWrapper.kt:30)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1549)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1280)
|
7981f4af07704bfbf04b759b6362518a
|
{
"intermediate": 0.4143131673336029,
"beginner": 0.38257646560668945,
"expert": 0.20311033725738525
}
|
31,458
|
what gpt version are you?
|
3fd845e9e47e145053102deaedda2b05
|
{
"intermediate": 0.3063034415245056,
"beginner": 0.2799820303916931,
"expert": 0.41371455788612366
}
|
31,460
|
simply on colab call dataset quora
|
f349582f81a7a7216e78693bc23a9aad
|
{
"intermediate": 0.20629696547985077,
"beginner": 0.38259583711624146,
"expert": 0.4111071825027466
}
|
31,461
|
<input type='file' id="images" multiple>
how to use php to get the image files if the user select more than one image files and click the submit button.
|
239b946519f006cae2888cd36d2efec8
|
{
"intermediate": 0.4918981194496155,
"beginner": 0.22601141035556793,
"expert": 0.28209051489830017
}
|
31,462
|
Making a hollow square in c++
|
a5f54b8f0b58ceb5b5f1164a6949c099
|
{
"intermediate": 0.21112602949142456,
"beginner": 0.412036269903183,
"expert": 0.37683773040771484
}
|
31,463
|
I need to implement a database that has a few keys, lets say a1,a2,a3.
those key have many diffrent corresponding other keys, for example
a1 : ba,bb,bc,ge,ch...
a2 : xt,bn,aw,aa...
a3 : hm,bd,ax,br...
then I need to look up a specific key, in t his example bb and see which key it corresponds to.
will redis work for this?
|
87eaa634bef0ed04877fdcca0d91d2b0
|
{
"intermediate": 0.5631391406059265,
"beginner": 0.10910413414239883,
"expert": 0.32775673270225525
}
|
31,464
|
I need to implement a database that has a few hashes, lets say a1,a2,a3.
those hashes have many diffrent corresponding other hashes, for example
a1 : ba,bb,bc,ge,ch…
a2 : xt,bn,aw,aa…
a3 : hm,bd,ax,br…
then I need to look up a specific (other) hash, in t his example bb and see which key it corresponds to.
will redis work for this?
i'd be m ore specific but i ts a very complicated thing that I c ant put into words.
|
0191413267633e3a90c77950073638ec
|
{
"intermediate": 0.4279906451702118,
"beginner": 0.1749286949634552,
"expert": 0.397080659866333
}
|
31,465
|
#Generate paraphrases
initial_sequence = tokenizer.texts_to_sequences([‘input_question’])
initial_sequence = pad_sequences(initial_sequence, padding=‘post’, maxlen=train_input.shape[1])
generated_sequence = initial_sequence.copy()
for i in range(desired_length):
next_word = model.predict_classes(generated_sequence)
generated_sequence = np.append(generated_sequence, next_word, axis=1)
how to solve this error
NameError: name ‘desired_length’ is not defined
|
a7f290190cb6afa6edc0e1470fd23466
|
{
"intermediate": 0.43761056661605835,
"beginner": 0.10756444931030273,
"expert": 0.4548249840736389
}
|
31,466
|
in next.js how do i get the username from an url like this: localhost:3000/[username]
|
a04994a8210e15d8a26cdea3574af0ac
|
{
"intermediate": 0.5288136601448059,
"beginner": 0.2112264633178711,
"expert": 0.2599598169326782
}
|
31,467
|
simple paraphrase generation model code
|
663cf92c1a52261e9046c5c2c24dec81
|
{
"intermediate": 0.19026091694831848,
"beginner": 0.2897900342941284,
"expert": 0.5199490189552307
}
|
31,468
|
const createWindow = () => { const win = new BrowserWindow({ width: 800, height: 455, icon: path.join(__dirname + '/icon.ico'), webPreferences: { preload: path.join(__dirname, '/src/preload.js') } }) win.webContents.openDevTools() win.loadFile('index.html') } src/preload.js: const { ipcRenderer } = window.require('electron') ipcRenderer.on('FILE_OPEN', (event, args) => { console.log('got FILE_OPEN', event, args) }) but throws error Unable to load preload script: C:\Программы\JS\Video Player\src\preload.js i use electron. how to fix that?
|
972605d1cbcb03023ebf36cf12919cbc
|
{
"intermediate": 0.6691575050354004,
"beginner": 0.20028315484523773,
"expert": 0.1305592954158783
}
|
31,469
|
get index 'global_position' (on base: 'null instance'
extends Sprite2D
class_name Player25D
enum State { IDLE, RUN, JUMP, ATTACK }
var state = State.IDLE
var velocity: Vector2 = Vector2.ZERO # Declare velocity at the start of the class
var bullets_amount: int = 30
var attack_animation: String = "Attack1"
var player_base = PlayerBase.new()# Use PlayerBase’s set_health method¨
@export var movement_data : MovementData
@export var stats : Stats
# References
@onready var animator : AnimatedSprite2D = $AnimatedSprite2D
@onready var guns_animator : AnimationPlayer = $ShootingAnimationPlayer
@onready var hit_animator : AnimationPlayer = $HitAnimationPlayer
@onready var hand : Node2D = $Hand
@onready var pistol : Sprite2D = $Hand/Pivot/Pistol
@onready var pistol_bullet_marker : Marker2D = $Hand/Pivot/Pistol/PistolBulletMarker
@onready var attacking: bool = false
@export var camera: Camera2D
# Load Scenes
@onready var muzzle_load: PackedScene = preload("res://Scenes/Particles/muzzle.tscn")
@onready var bullet_load: PackedScene = preload("res://Scenes/Props/bullet.tscn")
@onready var death_particle_load: PackedScene = preload("res://Scenes/Particles/player_death_particle.tscn")
func _ready():
stats.health = player_base.health
player_base.set_health(stats.health)
EventManager.bullets_amount = bullets_amount
EventManager.update_bullet_ui.emit()
func _physics_process(delta):
var input_vector = Input.get_axis("move_left", "move_right")
process_movement_input(delta)
process_actions()
update_animation_state() # This function was incorrectly named in the previous version.
func apply_acceleration(input_vector, delta):
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
func apply_friction(delta):
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func process_movement_input(delta):
var input_vector = Input.get_axis("move_left", "move_right")
if input_vector != 0:
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
else:
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func process_actions():
if Input.is_action_just_pressed("jump"):
perform_jump()
if Input.is_action_just_pressed("shoot"):
perform_attack()
func animate(input_vector):
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
if mouse_position.x > 0 and animator.flip_h:
animator.flip_h = false
elif mouse_position.x < 0 and not animator.flip_h:
animator.flip_h = true
hand.rotation = mouse_position.angle()
if hand.scale.y == 1 and mouse_position.x < 0:
hand.scale.y = -1
elif hand.scale.y == -1 and mouse_position.x > 0:
hand.scale.y = 1
if state != State.ATTACK:
if input_vector != 0:
animator.play("Run")
else:
animator.play("Idle")
func perform_jump():
velocity.y = -movement_data.jump_strength
AudioManager.play_sound(AudioManager.JUMP)
func perform_attack():
if not bullets_amount: return
state = State.ATTACK
animator.play("Attacking")
#guns_animator.play("Shoot")
shoot()
func shoot():
state = State.ATTACK
attack_animation = "Attack" + str(randi_range(1, 2))
animator.play(attack_animation)
#$Hand/AttackArea/CollisionShape2D.disabled = false;
await animator.animation_looped
EventManager.update_bullet_ui.emit()
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
var muzzle = muzzle_load.instantiate()
var bullet = bullet_load.instantiate()
#pistol_bullet_marker.add_child(muzzle)
bullet.global_position = pistol_bullet_marker.global_position
bullet.target_vector = mouse_position
bullet.rotation = mouse_position.angle()
get_tree().current_scene.add_child(bullet)
AudioManager.play_sound(AudioManager.SHOOT)
#$Hand/AttackArea/CollisionShape2D.disabled = true;
state = State.IDLE
func update_animation_state():
if state == State.ATTACK:
return
if velocity.x != 0:
animator.play("Run")
else:
animator.play("Idle")
func _on_hurtbox_area_entered(_area):
if not _area.is_in_group("Bullet"):
hit_animator.play("Hit")
take_damage(1) # If damage is to be variable, extract value from _area
EventManager.frame_freeze.emit()
func die():
AudioManager.play_sound(AudioManager.DEATH)
animator.play("Died")
spawn_death_particle()
EventManager.player_died.emit()
queue_free()
func spawn_death_particle():
var death_particle = death_particle_load.instantiate()
death_particle.global_position = global_position
get_tree().current_scene.add_child(death_particle)
# Override PlayerBase method
func take_damage(damage: int) -> void:
player_base.health -= damage # Use the health property from PlayerBase
if player_base.health <= 0:
die()
else:
AudioManager.play_sound(AudioManager.HURT)
func _on_swapPlane():
PlayerState.set_last_2d_position(global_position);
SceneChanger.change_to_2d(global_position) # Calls the singleton to change to 3D scene
# Implement the move method required by PlayerBase, the actual movement
# logic is in the _physics_process function above.
func move(input_dir: Vector2) -> void:
# For Player2D, the move function is handled by process_movement_input,
# so no additional logic is needed here.
pass
# Implement the attack method required by PlayerBase. This is a placeholder
# and the actual logic for starting an attack is in the perform_attack function.
func attack() -> void:
perform_attack()
# Adjust the jump method to use jump_strength from PlayerBase
func jump():
velocity.y = -movement_data.jump_strength
AudioManager.play_sound(AudioManager.JUMP)
func _on_health_changed(new_health: int) -> void:
player_base.health = new_health # Make sure to update it when health changes
# Handle health change (e.g., update UI)
|
ad794ae83f4be8e00570a0288f299852
|
{
"intermediate": 0.2310447245836258,
"beginner": 0.5500360727310181,
"expert": 0.21891915798187256
}
|
31,470
|
How to combine microservices, azure and cqrs together?
|
905fdf990f5d492390a9246abdfd5964
|
{
"intermediate": 0.6366257071495056,
"beginner": 0.06845386326313019,
"expert": 0.29492032527923584
}
|
31,471
|
hey
|
e71ecd200d67c3c7cb22a9032d0e7ef0
|
{
"intermediate": 0.33180856704711914,
"beginner": 0.2916048467159271,
"expert": 0.3765866458415985
}
|
31,472
|
Hi. Write me a VBA code for power point presentation about "Stack deck in C++", I need 7 slides about Steck deck with images and code. Fill the content on your own.
|
d44d54953916135a4fd02f14b12321c8
|
{
"intermediate": 0.3561616539955139,
"beginner": 0.3721073567867279,
"expert": 0.27173104882240295
}
|
31,473
|
Invalid get index 'global_position' (on base: 'null instance').
extends Sprite2D
class_name Player25D
enum State { IDLE, RUN, JUMP, ATTACK }
var state = State.IDLE
var velocity: Vector2 = Vector2.ZERO # Declare velocity at the start of the class
var bullets_amount: int = 30
var attack_animation: String = "Attack1"
var player_base = PlayerBase.new()# Use PlayerBase’s set_health method¨
@export var movement_data : MovementData
@export var stats : Stats
# References
@onready var animator : AnimatedSprite2D = $AnimatedSprite2D
@onready var guns_animator : AnimationPlayer = $ShootingAnimationPlayer
@onready var hit_animator : AnimationPlayer = $HitAnimationPlayer
@onready var hand : Node2D = $Hand
@onready var pistol : Sprite2D = $Hand/Pivot/Pistol
@onready var pistol_bullet_marker : Marker2D = $Hand/Pivot/Pistol/PistolBulletMarker
@onready var attacking: bool = false
@export var camera: Camera2D
# Load Scenes
@onready var muzzle_load: PackedScene = preload("res://Scenes/Particles/muzzle.tscn")
@onready var bullet_load: PackedScene = preload("res://Scenes/Props/bullet.tscn")
@onready var death_particle_load: PackedScene = preload("res://Scenes/Particles/player_death_particle.tscn")
func _ready():
stats.health = player_base.health
player_base.set_health(stats.health)
EventManager.bullets_amount = bullets_amount
EventManager.update_bullet_ui.emit()
func _physics_process(delta):
var input_vector = Input.get_axis("move_left", "move_right")
process_movement_input(delta)
process_actions()
update_animation_state() # This function was incorrectly named in the previous version.
func apply_acceleration(input_vector, delta):
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
func apply_friction(delta):
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func process_movement_input(delta):
var input_vector = Input.get_axis("move_left", "move_right")
if input_vector != 0:
velocity.x = move_toward(velocity.x, movement_data.max_speed * input_vector, movement_data.acceleration * delta)
else:
velocity.x = move_toward(velocity.x, 0, movement_data.friction * delta)
func process_actions():
if Input.is_action_just_pressed("jump"):
perform_jump()
if Input.is_action_just_pressed("shoot"):
perform_attack()
func animate(input_vector):
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
if mouse_position.x > 0 and animator.flip_h:
animator.flip_h = false
elif mouse_position.x < 0 and not animator.flip_h:
animator.flip_h = true
hand.rotation = mouse_position.angle()
if hand.scale.y == 1 and mouse_position.x < 0:
hand.scale.y = -1
elif hand.scale.y == -1 and mouse_position.x > 0:
hand.scale.y = 1
if state != State.ATTACK:
if input_vector != 0:
animator.play("Run")
else:
animator.play("Idle")
func perform_jump():
velocity.y = -movement_data.jump_strength
AudioManager.play_sound(AudioManager.JUMP)
func perform_attack():
if not bullets_amount: return
state = State.ATTACK
animator.play("Attacking")
#guns_animator.play("Shoot")
shoot()
func shoot():
state = State.ATTACK
attack_animation = "Attack" + str(randi_range(1, 2))
animator.play(attack_animation)
#$Hand/AttackArea/CollisionShape2D.disabled = false;
await animator.animation_looped
EventManager.update_bullet_ui.emit()
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
var muzzle = muzzle_load.instantiate()
var bullet = bullet_load.instantiate()
#pistol_bullet_marker.add_child(muzzle)
bullet.global_position = pistol_bullet_marker.global_position
bullet.target_vector = mouse_position
bullet.rotation = mouse_position.angle()
get_tree().current_scene.add_child(bullet)
AudioManager.play_sound(AudioManager.SHOOT)
#$Hand/AttackArea/CollisionShape2D.disabled = true;
state = State.IDLE
func update_animation_state():
if state == State.ATTACK:
return
if velocity.x != 0:
animator.play("Run")
else:
animator.play("Idle")
func _on_hurtbox_area_entered(_area):
if not _area.is_in_group("Bullet"):
hit_animator.play("Hit")
take_damage(1) # If damage is to be variable, extract value from _area
EventManager.frame_freeze.emit()
func die():
AudioManager.play_sound(AudioManager.DEATH)
animator.play("Died")
spawn_death_particle()
EventManager.player_died.emit()
queue_free()
func spawn_death_particle():
var death_particle = death_particle_load.instantiate()
death_particle.global_position = global_position
get_tree().current_scene.add_child(death_particle)
# Override PlayerBase method
func take_damage(damage: int) -> void:
player_base.health -= damage # Use the health property from PlayerBase
if player_base.health <= 0:
die()
else:
AudioManager.play_sound(AudioManager.HURT)
func _on_swapPlane():
PlayerState.set_last_2d_position(global_position);
SceneChanger.change_to_2d(global_position) # Calls the singleton to change to 3D scene
# Implement the move method required by PlayerBase, the actual movement
# logic is in the _physics_process function above.
func move(input_dir: Vector2) -> void:
# For Player2D, the move function is handled by process_movement_input,
# so no additional logic is needed here.
pass
# Implement the attack method required by PlayerBase. This is a placeholder
# and the actual logic for starting an attack is in the perform_attack function.
func attack() -> void:
perform_attack()
|
6f348ff4b9bdf275aaca9e19881a7769
|
{
"intermediate": 0.2632110118865967,
"beginner": 0.498403400182724,
"expert": 0.23838557302951813
}
|
31,474
|
text generation using lstm
|
8fddecd0e6e119f71df12386e7c2dcec
|
{
"intermediate": 0.32054296135902405,
"beginner": 0.19560076296329498,
"expert": 0.4838562607765198
}
|
31,475
|
some of code in index.js:
{
label: 'Open',
accelerator: 'CmdOrCtrl+O',
click() {
dialog.showOpenDialog({
properties: ['openFile']
})
.then(function (fileObj) {
if (!fileObj.canceled) {
win.webContents.send('FILE_OPEN', fileObj.filePaths)
}
})
}
},
preload.js:
const { ipcRenderer } = window.require('electron')
ipcRenderer.on('FILE_OPEN', (event, args) => {
alert('got FILE_OPEN', event, args)
})
but i can't see alert
how to fix that? i use electron
|
78dbb96e5ed16eed776c11fa699dc483
|
{
"intermediate": 0.48293378949165344,
"beginner": 0.35861149430274963,
"expert": 0.15845471620559692
}
|
31,476
|
write some python code to find a yellow spot surrounded by a blue background
|
aac1ab675eea55cb961d5a069980d117
|
{
"intermediate": 0.32538658380508423,
"beginner": 0.2769360840320587,
"expert": 0.39767736196517944
}
|
31,477
|
Hi. Write me a VBA code for power point presentation about “Stack deck in C++”, I need 7 slides about Steck deck on russian language with code. Fill the content on your own.
|
55575d8e0bae7a9a98091316c323b944
|
{
"intermediate": 0.35177499055862427,
"beginner": 0.39828944206237793,
"expert": 0.24993552267551422
}
|
31,478
|
write code for nn learning with this train_data = [
['<%= variable %>', '{{ variable }}'],
['<% if condition %>', '{% if condition %}'],
# Add more training examples here
]
|
4dd45dd70ab1eef32a7dc1045adb7d65
|
{
"intermediate": 0.1088019460439682,
"beginner": 0.3574090301990509,
"expert": 0.5337890386581421
}
|
31,479
|
font1 = ("times", 16, "normal")
my_w = tk.Tk()
my_w.geometry("300x200")
n = 26
for i in range(n):
for j in range(6):
e = Button(my_w, text=j, font=font1)
e.grid(row=0, column=j)
my_w.mainloop() i want 5 columns and 5 rows
|
52561d0d716ec37b66c1cfaa218c95e3
|
{
"intermediate": 0.2530131936073303,
"beginner": 0.5575388669967651,
"expert": 0.18944793939590454
}
|
31,480
|
writer = tf.summary.create_file_writer('./logs')
with writer.as_default():
# 将结果记录到摘要中
for i in range(len(results)):
tf.summary.image(“Test Image {}”.format(i), results[i], step=0)
writer.flush()中的writer.flush()缩进怎么设置?
|
2f3bee3d3d16a7229b68dcefb0f8b7a6
|
{
"intermediate": 0.3546103835105896,
"beginner": 0.3551260530948639,
"expert": 0.2902635335922241
}
|
31,481
|
mount /dev/md0 /boot wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error. dmesg has some stuff like md/raid1:md0 not clean -- starting background reconstruction md/raid1:md0 active with 2 out of 2 mirrors md0: detected capacity change from 0 to 995328 md: resync of RAID array md0 md: md0 resync done.
|
c7d66f7b8b423e76181e66134f7788a4
|
{
"intermediate": 0.49849677085876465,
"beginner": 0.2165960818529129,
"expert": 0.28490719199180603
}
|
31,482
|
模型训练代码和测试代码如下:# #训练方法二:Train with npy file
imgs_train,imgs_mask_train = geneTrainNpy("data/membrane/train/aug/","data/membrane/train/aug/")
model = unet()
model_checkpoint = ModelCheckpoint('unet_membrane.hdf5', monitor='loss',verbose=1, save_best_only=True)
model.fit(imgs_train, imgs_mask_train, batch_size=2, nb_epoch=10, verbose=1,validation_split=0.2, shuffle=True, callbacks=[model_checkpoint,tensorboard_callback])和#test your model and save predicted results
testGene = testGenerator("data/membrane/test")
results = model.predict_generator(testGene,30,verbose=1)
saveResult("data/membrane/test",results)。根据以上代码,新建一个predict.py文件,编写代码,写一个简单的GUI,允许用户指定路径打开某细胞图像展示并调用训练好的模型进行图像分割,展示分割结果。
|
7fbee475f477da4acfd7c3a1fc771837
|
{
"intermediate": 0.3763292729854584,
"beginner": 0.21987973153591156,
"expert": 0.40379098057746887
}
|
31,483
|
import sys
sys.setrecursionlimit(2000000)
def closest_adj_price(listk):
close_prise = abs(listk[1] - listk[0])
for i in range(1, len(listk) - 1):
new_prise = abs(listk[i + 1] - listk[i])
if new_prise < close_prise:
close_prise = new_prise
print(str(close_prise))
def closest_price(listk):
sorted_list = sorted(listk)
close_prise = sorted_list[1] - sorted_list[0]
for i in range(1, len(sorted_list) - 1):
new_prise = sorted_list[i + 1] - sorted_list[i]
if new_prise < close_prise:
close_prise = new_prise
print(str(close_prise))
m = input().split()
a1 = int(m[0])
a2 = int(m[1])
n = input().split()
k = [int(i) for i in n]
for i in range(a2):
l = input().split()
if l[0] == ‘BUY’:
k.append(int(l[1]))
elif l[0] == ‘CLOSEST_ADJ_PRICE’:
closest_adj_price(k)
elif l[0] == ‘CLOSEST_PRICE’:
closest_price(k)优化程序使它在面对大数据量时有更好地表现
|
df54a9a149c4aa5974510afd45cc12c6
|
{
"intermediate": 0.30669212341308594,
"beginner": 0.419910728931427,
"expert": 0.27339717745780945
}
|
31,484
|
现有训练模型代码如下:imgs_train,imgs_mask_train = geneTrainNpy("data/membrane/train/aug/","data/membrane/train/aug/")
model = unet()
model_checkpoint = ModelCheckpoint('unet_membrane.hdf5', monitor='loss',verbose=1, save_best_only=True)
model.fit(imgs_train, imgs_mask_train, batch_size=2, nb_epoch=10, verbose=1,validation_split=0.2, shuffle=True, callbacks=[model_checkpoint,tensorboard_callback])。目前的损失为0.3,准确率为0.8,请更改对应参数以提高准确率。
|
92211ebd760fd14d060f6add08fddc06
|
{
"intermediate": 0.3332640528678894,
"beginner": 0.22247371077537537,
"expert": 0.44426223635673523
}
|
31,485
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foleon</groupId>
<artifactId>bazaar</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>bazaar</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project> это файл зависимостей моего плагина, можешь сюда добавить плагин essentials и скинуть полный код?
|
b87b8044aa678b689a1ca065ef62a04c
|
{
"intermediate": 0.32363399863243103,
"beginner": 0.5443893074989319,
"expert": 0.13197673857212067
}
|
31,486
|
When I reboot, I get a grub prompt, so what am I doing wrong?:
root@debian:~# lsblk && blkid
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 3.7G 0 rom
vda 254:0 0 20G 0 disk
├─vda1 254:1 0 487M 0 part /boot
├─vda2 254:2 0 1K 0 part
└─vda5 254:5 0 19.5G 0 part
└─vda5_crypt 252:0 0 19.5G 0 crypt
├─debian--vg-root 252:1 0 18.5G 0 lvm /
└─debian--vg-swap_1 252:2 0 980M 0 lvm [SWAP]
vdb 254:16 0 20G 0 disk
├─vdb1 254:17 0 487M 0 part
├─vdb2 254:18 0 1K 0 part
└─vdb5 254:21 0 19.5G 0 part
└─vdb5_crypt 252:3 0 19.5G 0 crypt
├─debian--vg2-swap_2 252:4 0 980M 0 lvm [SWAP]
└─debian--vg2-root 252:5 0 18.5G 0 lvm
/dev/mapper/debian--vg-root: UUID="787e196d-c852-491e-9583-34d1bc621ace" UUID_SUB="5246486c-8c05-4d72-b494-b9bbf2e62825" BLOCK_SIZE="4096" TYPE="btrfs"
/dev/vdb5: UUID="584aa6ad-c8c0-43e5-b32d-eda94ea8501b" TYPE="crypto_LUKS" PARTUUID="a36f14d2-05"
/dev/vdb1: UUID="55762e61-a486-47b9-92cc-29d597b37312" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="a36f14d2-01"
/dev/mapper/debian--vg2-swap_2: UUID="662d79c0-2db1-4247-bb77-7d05dfb6917c" TYPE="swap"
/dev/sr0: BLOCK_SIZE="2048" UUID="2023-10-07-11-48-54-00" LABEL="Debian 12.2.0 amd64 1" TYPE="iso9660" PTUUID="515b3f36" PTTYPE="dos"
/dev/mapper/debian--vg-swap_1: UUID="3f8a7e7e-21c1-47d3-a19a-72dfe9f8b164" TYPE="swap"
/dev/mapper/vda5_crypt: UUID="UmwnNd-voGV-v1lc-eKPP-nLeP-cwpX-tXaA7V" TYPE="LVM2_member"
/dev/mapper/debian--vg2-root: UUID="787e196d-c852-491e-9583-34d1bc621ace" UUID_SUB="2c6c20fe-abf0-4b5c-9896-3239dbbbe8f5" BLOCK_SIZE="4096" TYPE="btrfs"
/dev/vda5: UUID="c8e57554-de8b-44c0-862a-32cd1e4f92b1" TYPE="crypto_LUKS" PARTUUID="00819e90-05"
/dev/vda1: UUID="c2206369-9b9f-44b3-8319-1d46ed4c559e" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="00819e90-01"
/dev/mapper/vdb5_crypt: UUID="mtToH2-apOl-L8Wq-UrcM-QmF9-cUBk-7POUGH" TYPE="LVM2_member"
root@debian:~# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/vda1 /dev/vdb1
mdadm: super1.x cannot open /dev/vda1: Device or resource busy
mdadm: ddf: Cannot use /dev/vda1: Device or resource busy
mdadm: Cannot use /dev/vda1: It is busy
mdadm: cannot open /dev/vda1: Device or resource busy
root@debian:~# umount /boot
root@debian:~# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/vda1 /dev/vdb1
mdadm: /dev/vda1 appears to contain an ext2fs file system
size=498688K mtime=Sun Nov 19 07:55:07 2023
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: /dev/vdb1 appears to contain an ext2fs file system
size=498688K mtime=Wed Dec 31 19:00:00 1969
mdadm: size set to 497664K
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
root@debian:~# mkfs.ext2 /dev/md0
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 497664 1k blocks and 124440 inodes
Filesystem UUID: 20abf9b7-04fe-48c3-939a-030ebe363b98
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
root@debian:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point> <type> <options> <dump> <pass>
#OLD_BUT_KEEP_FOR_REFERENCE/dev/mapper/debian--vg-root / btrfs defaults,subvol=@rootfs 0 0
UUID=787e196d-c852-491e-9583-34d1bc621ace / btrfs defaults,subvol=@rootfs 0 0
#OLD+RM:/dev/mapper/debian--vg2-root /mnt/2nd_root btrfs defaults,subvol=@rootfs 0 0
# /boot was on /dev/vda1 during installation
UUID=c2206369-9b9f-44b3-8319-1d46ed4c559e /boot ext2 defaults 0 2
/dev/mapper/debian--vg-swap_1 none swap sw 0 0
/dev/mapper/debian--vg2-swap_2 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
root@debian:~# vim /etc/fstab
root@debian:~# blkid
/dev/mapper/debian--vg-root: UUID="787e196d-c852-491e-9583-34d1bc621ace" UUID_SUB="5246486c-8c05-4d72-b494-b9bbf2e62825" BLOCK_SIZE="4096" TYPE="btrfs"
/dev/vdb5: UUID="584aa6ad-c8c0-43e5-b32d-eda94ea8501b" TYPE="crypto_LUKS" PARTUUID="a36f14d2-05"
/dev/vdb1: UUID="53f0e6f7-7800-c6e1-31db-f89ee06768fa" UUID_SUB="27009b95-ced4-0102-14ec-e5ae5d4719ac" LABEL="debian:0" TYPE="linux_raid_member" PARTUUID="a36f14d2-01"
/dev/mapper/debian--vg2-swap_2: UUID="662d79c0-2db1-4247-bb77-7d05dfb6917c" TYPE="swap"
/dev/sr0: BLOCK_SIZE="2048" UUID="2023-10-07-11-48-54-00" LABEL="Debian 12.2.0 amd64 1" TYPE="iso9660" PTUUID="515b3f36" PTTYPE="dos"
/dev/mapper/debian--vg-swap_1: UUID="3f8a7e7e-21c1-47d3-a19a-72dfe9f8b164" TYPE="swap"
/dev/mapper/vda5_crypt: UUID="UmwnNd-voGV-v1lc-eKPP-nLeP-cwpX-tXaA7V" TYPE="LVM2_member"
/dev/mapper/debian--vg2-root: UUID="787e196d-c852-491e-9583-34d1bc621ace" UUID_SUB="2c6c20fe-abf0-4b5c-9896-3239dbbbe8f5" BLOCK_SIZE="4096" TYPE="btrfs"
/dev/vda5: UUID="c8e57554-de8b-44c0-862a-32cd1e4f92b1" TYPE="crypto_LUKS" PARTUUID="00819e90-05"
/dev/vda1: UUID="53f0e6f7-7800-c6e1-31db-f89ee06768fa" UUID_SUB="acfcbda3-2ec3-da37-2d4b-072e450b33c7" LABEL="debian:0" TYPE="linux_raid_member" PARTUUID="00819e90-01"
/dev/mapper/vdb5_crypt: UUID="mtToH2-apOl-L8Wq-UrcM-QmF9-cUBk-7POUGH" TYPE="LVM2_member"
/dev/md0: UUID="20abf9b7-04fe-48c3-939a-030ebe363b98" BLOCK_SIZE="1024" TYPE="ext2"
root@debian:~# vim /etc/fstab
root@debian:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point> <type> <options> <dump> <pass>
#OLD_BUT_KEEP_FOR_REFERENCE/dev/mapper/debian--vg-root / btrfs defaults,subvol=@rootfs 0 0
UUID=787e196d-c852-491e-9583-34d1bc621ace / btrfs defaults,subvol=@rootfs 0 0
#OLD+RM:/dev/mapper/debian--vg2-root /mnt/2nd_root btrfs defaults,subvol=@rootfs 0 0
# /boot was on /dev/vda1 during installation
#UUID=c2206369-9b9f-44b3-8319-1d46ed4c559e /boot ext2 defaults 0 2
UUID=20abf9b7-04fe-48c3-939a-030ebe363b98 /boot ext2 defaults 0 2
/dev/mapper/debian--vg-swap_1 none swap sw 0 0
/dev/mapper/debian--vg2-swap_2 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
root@debian:~# ls /boot
root@debian:~# mount /dev/md0 /boot
mount: (hint) your fstab has been modified, but systemd still uses
the old version; use 'systemctl daemon-reload' to reload.
root@debian:~# systemctl daemon-reload
root@debian:~# mount /dev/md0 /boot
mount: /boot: /dev/md0 already mounted on /boot.
dmesg(1) may have more information after failed mount system call.
root@debian:~# umount /boot
root@debian:~# mount /dev/md0 /boot
root@debian:~# ls /boot
lost+found
root@debian:~# grub-install /dev/vda && ls /boot && grub-install /dev/vdb && ls /boot
Installing for i386-pc platform.
Installation finished. No error reported.
grub lost+found
Installing for i386-pc platform.
Installation finished. No error reported.
grub lost+found
root@debian:~#
|
2e0e1ed2e16012ecea0e58d98b3e5f42
|
{
"intermediate": 0.3767875134944916,
"beginner": 0.44192448258399963,
"expert": 0.18128803372383118
}
|
31,487
|
modify this code to go to octocaptcha.com and automatically get the token, it does this by goin there, waitin for a request to https://github-api.arkoselabs.com/fc/gfct/ ets made, then it looks at the response and gets the session_token from the json response
original code:
//const puppeteer = require('puppeteer');
const axios = require('axios');
async function scrapeToken(token, useragent) {
const apiEndpoint = 'http://127.0.0.1:5000/api/solve';
const data = {
'token': token,
'user-agent': useragent
};
try {
console.log('scraping...')
const response = await axios.get(apiEndpoint, {data,headers: {'Content-Type': 'application/json'}});
console.log('Token sent:', response.data);
} catch (error) {
console.error('Failed to send token to API:', error);
}
}
const ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
const token = "912179908c05be309.9937065205"
for (let i = 1; i<10; i++) {
scrapeToken(token, ua)
}
|
1687ae91b40e3c4b19315cc9970bc17c
|
{
"intermediate": 0.5090814232826233,
"beginner": 0.3323861360549927,
"expert": 0.15853239595890045
}
|
31,488
|
I have the following information, but I am not sure what to do with it so that it matches the required format. Is the http_client proxies and transport the same or different than what I have? Can I get away with only using the base_url as the OpenAI-compatible API URL?
import httpx
from openai import OpenAI
client = OpenAI(
# Or use the `OPENAI_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=httpx.Client(
proxies="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
What I have:
Running on local URL: http://127.0.0.1:7860
2023-11-19 13:43:17 INFO:OpenAI-compatible API URL:
https://supposed-sanyo-fairy-plastic.trycloudflare.com
INFO: Started server process [2409]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:5000 (Press CTRL+C to quit)
Running on public URL: https://0f9d3635083cb36a31.gradio.live
|
af5cf73118eb5f037a332bf7b5e81319
|
{
"intermediate": 0.5958870053291321,
"beginner": 0.184561088681221,
"expert": 0.2195519059896469
}
|
31,489
|
in centos 7 and By using the shell expansion techniques, and the minimum number of commands needed, create the schema S1 parent folder for S2 ,docs and the directory S2 contain 2 subdiroctries month ,GGG and the diroctry docs contain 4 subdirodtories A,B,C,d
Be aware that the less commands used is the better.
|
2ebe8532429847bb0c32607365148737
|
{
"intermediate": 0.3399662971496582,
"beginner": 0.27301421761512756,
"expert": 0.3870195150375366
}
|
31,490
|
help me make so the lookat only flips the charcter to left and right and don't rotate the character:
func _read_input():
look_at(get_global_mouse_position())
var movement = []
if Input.is_action_pressed("move_up"): movement.append("up")
if Input.is_action_pressed("move_down"): movement.append("down")
if Input.is_action_pressed("move_right"): movement.append("right")
if Input.is_action_pressed("move_left"): movement.append("left")
move.execute(self, movement)
if last_ability > global_cooldown:
if Input.is_action_just_pressed("interact"):
interact()
last_ability = 0
#if Input.is_action_just_pressed("ability_1"):
# fireball.execute(self)
# last_ability = 0
#if Input.is_action_just_pressed("inventory"):
# inventory.execute(self)
# last_ability = 0
|
5a4214f746759365382dbbe06ad3d17a
|
{
"intermediate": 0.339304655790329,
"beginner": 0.3706238269805908,
"expert": 0.2900714874267578
}
|
31,491
|
• Extend the program so that you can enter the number of components as command-line
parameter.
• Create class methods (static) in your component class:
o writeComponent() to insert the data (componentID, name etc.) into your component
object
o printComponent() to print the data in a selected component
• Write a class method (static) for the BestBikeManagement class that allows you to change
the component object. without scanner and shortly
|
97b64456f9371ea1287bd67f65fc5848
|
{
"intermediate": 0.3664890229701996,
"beginner": 0.5551756024360657,
"expert": 0.07833540439605713
}
|
31,492
|
How to build sound waveform from audio file using Kotlin and Android SDK
|
2d303f7fc17ba059b1400d8788360ec2
|
{
"intermediate": 0.6253501176834106,
"beginner": 0.19008184969425201,
"expert": 0.18456807732582092
}
|
31,493
|
Traceback (most recent call last):
File "/home/studio-lab-user/ComfyUI/main.py", line 72, in <module>
import execution
File "/home/studio-lab-user/ComfyUI/execution.py", line 12, in <module>
import nodes
File "/home/studio-lab-user/ComfyUI/nodes.py", line 20, in <module>
import comfy.diffusers_load
File "/home/studio-lab-user/ComfyUI/comfy/diffusers_load.py", line 4, in <module>
import comfy.sd
File "/home/studio-lab-user/ComfyUI/comfy/sd.py", line 5, in <module>
from comfy import model_management
File "/home/studio-lab-user/ComfyUI/comfy/model_management.py", line 114, in <module>
total_vram = get_total_memory(get_torch_device()) / (1024 * 1024)
File "/home/studio-lab-user/ComfyUI/comfy/model_management.py", line 83, in get_torch_device
return torch.device(torch.cuda.current_device())
File "/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/torch/cuda/__init__.py", line 769, in current_device
_lazy_init()
File "/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/torch/cuda/__init__.py", line 298, in _lazy_init
torch._C._cuda_init()
RuntimeError: The NVIDIA driver on your system is too old (found version 11040). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver.
|
dd3274e94dda27646c019fa548455081
|
{
"intermediate": 0.4197714626789093,
"beginner": 0.26323845982551575,
"expert": 0.31699004769325256
}
|
31,494
|
How to use azure services with microservices for MES systems?
|
66b8c18b56366925772ca9853fc91395
|
{
"intermediate": 0.6713622808456421,
"beginner": 0.1286538541316986,
"expert": 0.19998382031917572
}
|
31,495
|
создай код на с++ для хука игры cs2 с помощи библиотеки minhook
|
81f344b0fda21812962650a678812bdc
|
{
"intermediate": 0.3885366916656494,
"beginner": 0.2727159857749939,
"expert": 0.3387473225593567
}
|
31,496
|
which one is more common between c++ developers? and what do you suggest for modern c++?
// Definable in wrapper
API_DEFINABLE_IN_WRAPPER API_NODISCARD virtual constexpr bool HasParent() const = 0;
Or
// Definable in wrapper
API_NODISCARD virtual constexpr bool HasParent() const = 0;
|
6ad727693dd7a29e9371ead4150646ef
|
{
"intermediate": 0.6455857157707214,
"beginner": 0.2425033003091812,
"expert": 0.11191097646951675
}
|
31,497
|
Flight& Flight::operator=(const Flight& flightToCopy) {
if (this != &flightToCopy) {
delete numPassengers;
/* Your code goes here */
*numPassengers = *(flightToCopy.numPassengers);
}
return *this;
}
|
2350af081603435aa2eb29670e590b18
|
{
"intermediate": 0.32147136330604553,
"beginner": 0.416616827249527,
"expert": 0.2619118094444275
}
|
31,498
|
You are at the world debate championship. The motion of the debate is “This house supports universal income for all citizens”. The coalition are in favor of the motion. Think about arguments in favor of the motion, using a hierarchical table of contents that classify the arguments to at least 3 topics, then write the speech of the coalition. Then do the same for the opposition, who should argue against the arguments of the coalition.
|
e2e8a4bea1a09dfcafd5e70c61ac3f66
|
{
"intermediate": 0.40082496404647827,
"beginner": 0.2655855715274811,
"expert": 0.33358943462371826
}
|
31,499
|
Mermaid JS notation:
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Popularisation
British popular psychology author Tony Buzan
Research
On effectivness<br/>and features
On Automatic creation
Uses
Creative techniques
Strategic planning
Argument mapping
Tools
Pen and paper
Mermaid
Please create a mindmap in mermaidJS notation for an AGI that wants to coexist with humans and create a peaceful world
|
b44c96ace505a5a7fcd5e6c5d5acb415
|
{
"intermediate": 0.3076508641242981,
"beginner": 0.25714442133903503,
"expert": 0.4352046847343445
}
|
31,500
|
сделай плагин на майнкрафт на валюту золото. добавь команды /pay (передать золото) и /goldgive (выдать золото) (для операторов). Добавь команду /top (показывает топ игроков по балансу.), сделай так чтобы баланс игроков сохранялся в файле gold.yml. Сделай scoreboard в котором будет написано на 1 строке mining simulator а на 2 количество золота игрока.
|
7ef319f0353d8237067551da350af811
|
{
"intermediate": 0.3233020305633545,
"beginner": 0.3513942062854767,
"expert": 0.32530370354652405
}
|
31,501
|
Mermaid JS notation:
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Popularisation
British popular psychology author Tony Buzan
Research
On effectivness<br/>and features
On Automatic creation
Uses
Creative techniques
Strategic planning
Argument mapping
Tools
Pen and paper
Mermaid
Please create a mindmap in mermaidJS notation for a comprehensive overview of all existing prompt engineering techniques with a short use case for each technique.
|
6649d470e7ddf1ea5e79d5ed31034abc
|
{
"intermediate": 0.26458677649497986,
"beginner": 0.33960556983947754,
"expert": 0.3958076238632202
}
|
31,502
|
where view function is launching in flask app
|
33e82457bef01281bd0832a420b07bc7
|
{
"intermediate": 0.44410422444343567,
"beginner": 0.32978135347366333,
"expert": 0.22611436247825623
}
|
31,503
|
напиши hook DirectX 11 используя библиотеку detours под dllMain
|
4d0d5f74854038dd12316c5ba33ea0d5
|
{
"intermediate": 0.39892148971557617,
"beginner": 0.2372768223285675,
"expert": 0.36380162835121155
}
|
31,504
|
короче смотри, надо сделать дешифрование вот строки из сервера private static final String SPLITTER_CMDS = "end~";
private StringBuffer inputRequest;
private StringBuffer badRequest = new StringBuffer();
public LobbyManager lobby;
public Auth auth;
private Channel channel;
private ChannelHandlerContext context;
private int _lastKey = 1;
private final int[] _keys = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9};
//
�
�
:
�
�
�
�
ℎ
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
[
]
FF:syntheticfieldprivatestaticint[]SWITCH_TABLE
�
�
�
�
�
�
gtankscommands$Type;
public ProtocolTransfer(Channel channel, ChannelHandlerContext context) {
this.channel = channel;
this.context = context;
}
public void decryptProtocol(String protocol) {
if ((this.inputRequest = new StringBuffer(protocol)).length() > 0) {
if (this.inputRequest.toString().endsWith("end~")) {
this.inputRequest = new StringBuffer(StringUtils.concatStrings(this.badRequest.toString(), this.inputRequest.toString()));
String[] var5;
int var4 = (var5 = this.parseCryptRequests()).length;
for(int var3 = 0; var3 < var4; ++var3) {
String request = var5[var3];
int key;
try {
key = Integer.parseInt(String.valueOf(request.charAt(0)));
} catch (Exception var8) {
Logger.log("[EXCEPTION] Detected cheater(replace protocol): " + this.channel.toString());
NettyUsersHandler.block(this.channel.getRemoteAddress().toString().split(":")[0]);
this.closeConnection();
return;
}
if (key == this._lastKey) {
Logger.log("Detected cheater(replace protocol): " + this.channel.toString());
NettyUsersHandler.block(this.channel.getRemoteAddress().toString().split(":")[0]);
this.closeConnection();
return;
}
int nextKey = (this._lastKey + 1) % this._keys.length;
if (key != (nextKey == 0 ? 1 : nextKey)) {
Logger.log("[NOT QUEQUE KEY " + nextKey + " " + this._lastKey + "] Detected cheater(replace protocol): " + this.channel.toString());
NettyUsersHandler.block(this.channel.getRemoteAddress().toString().split(":")[0]);
this.closeConnection();
return;
}
this.inputRequest = new StringBuffer(this.decrypt(request.substring(1, request.length()), key));
this.sendRequestToManagers(this.inputRequest.toString());
}
this.badRequest = new StringBuffer();
} else {
this.badRequest = new StringBuffer(StringUtils.concatStrings(this.badRequest.toString(), this.inputRequest.toString()));
}
}
}
private String[] parseCryptRequests() {
return this.inputRequest.toString().split("end~");
}
private String decrypt(String request, int key) {
this._lastKey = key;
char[] _chars = request.toCharArray();
for(int i = 0; i < request.length(); ++i) {
_chars[i] = (char)(_chars[i] - (key + 1));
}
return new String(_chars);
}
private void sendRequestToManagers(String request) {
this.sendCommandToManagers(Commands.decrypt(request));
}
private void sendCommandToManagers(Command cmd) {
if (this.auth == null) {
this.auth = new Auth(this, this.context);
}
switch($SWITCH_TABLE$gtanks$commands$Type()[cmd.type.ordinal()]) {
case 1:
this.auth.executeCommand(cmd);
break;
case 2:
this.auth.executeCommand(cmd);
break;
case 3:
this.lobby.executeCommand(cmd);
break;
case 4:
this.lobby.executeCommand(cmd);
break;
case 5:
this.lobby.executeCommand(cmd);
break;
case 6:
this.lobby.executeCommand(cmd);
break;
case 7:
this.lobby.executeCommand(cmd);
break;
case 8:
this.auth.executeCommand(cmd);
break;
case 9:
Logger.log("User " + this.channel.toString() + " send unknowed request: " + cmd.toString());
case 10:
default:
break;
case 11:
if (this.auth != null) {
this.auth.executeCommand(cmd);
}
if (this.lobby != null) {
this.lobby.executeCommand(cmd);
}
}
}
public boolean send(Type type, String... args) throws IOException {
StringBuilder request = new StringBuilder();
request.append(type.toString());
request.append(";");
for(int i = 0; i < args.length - 1; ++i) {
request.append(StringUtils.concatStrings(args[i], ";"));
}
request.append(StringUtils.concatStrings(args[args.length - 1], "end~"));
if (this.channel.isWritable() && this.channel.isConnected() && this.channel.isOpen()) {
this.channel.write(request.toString());
}
request = null;
return true;
}
protected void onDisconnect() {
if (this.lobby != null) {
this.lobby.onDisconnect();
}
}
public void closeConnection() {
this.channel.close();
}
public String getIP() {
return this.channel.getRemoteAddress().toString();
}
вот это подключение из клиента public function send(str:String):void
{
try
{
str = ((this.AESDecrypter == null) ? this.crypt(str) : this.AESDecrypter.encrypt(str, this.AESKey));
str = (str + DELIM_COMMANDS_SYMBOL);
this.socket.writeUTFBytes(str);
this.socket.flush();
}
catch(e:Error)
{
Logger.warn((((“Error sending: " + e.message) + “\n”) + e.getStackTrace()));
};
}
private function crypt(request:String):String
{
var key:int = ((this.lastKey + 1) % this.keys.length);
if (key <= 0)
{
key = 1;
};
this.lastKey = key;
var _array:Array = request.split(”“);
var i:int;
while (i < request.length)
{
_array[i] = String.fromCharCode((request.charCodeAt(i) + (key + 1)));
i++;
};
return (key + _array.join(”"));
} "Метод send отправляет сообщение на сервер. Если this.AESDecrypter равен null, то вызывается метод crypt, который преобразует и шифрует сообщение перед отправкой. В противном случае, используется AESDecrypter для шифрования сообщения перед отправкой." как правильно все это реализовать на сервере ?
|
1d6c8c0533eda0668da5f0f5225a5b67
|
{
"intermediate": 0.33884185552597046,
"beginner": 0.49716082215309143,
"expert": 0.1639973521232605
}
|
31,505
|
I need to mutate same column with if else in python pandas
|
35360ab5a5934fee74e4b5e53df1fffd
|
{
"intermediate": 0.38471701741218567,
"beginner": 0.23622408509254456,
"expert": 0.3790588676929474
}
|
31,506
|
I have the following string: "Result 1:\n[\n \"Introduction to the Healing Power of Physiotherapy in Sports\",\n \"Conclusion: Empowering Athletes Through Expert Physiotherapy\"\n]\n\nResult 2:\n[\n \"Welcome to the World of Sports Injury Recovery\",\n \"Wrapping Up: The Unseen Hero in Sports\u2014Physiotherapy\"\n]"
I want to write a regex to extract the array part of this string ignoring new line
|
703ca5c59fcb03448e074f50b92d39fc
|
{
"intermediate": 0.34434273838996887,
"beginner": 0.412749320268631,
"expert": 0.24290794134140015
}
|
31,507
|
why my code does not work?
|
9c43295145bfed5f17e68bd97afd3e88
|
{
"intermediate": 0.3164411187171936,
"beginner": 0.39226579666137695,
"expert": 0.2912931442260742
}
|
31,508
|
GPT4 is a auto regressive prediction model. How many different tokens can it use?
|
15d5b8d0c1557e14231be8cc7c0a3fb3
|
{
"intermediate": 0.20572510361671448,
"beginner": 0.16542883217334747,
"expert": 0.6288460493087769
}
|
31,509
|
it spam change the direction of the sprite when you move < 0 :
func _read_input():
var mouse_position = get_global_mouse_position()
var direction = (mouse_position - position).normalized()
if direction.x < 0:
scale.x = -1
else:
scale.x = 1
var movement = []
if Input.is_action_pressed("move_up"): movement.append("up")
if Input.is_action_pressed("move_down"): movement.append("down")
if Input.is_action_pressed("move_right"): movement.append("right")
if Input.is_action_pressed("move_left"): movement.append("left")
move.execute(self, movement)
if last_ability > global_cooldown:
if Input.is_action_just_pressed("interact"):
interact()
last_ability = 0
#if Input.is_action_just_pressed("ability_1"):
# fireball.execute(self)
# last_ability = 0
#if Input.is_action_just_pressed("inventory"):
# inventory.execute(self)
# last_ability = 0
|
b4d4d3d0cb1fc144f61c3d6576027956
|
{
"intermediate": 0.3615899085998535,
"beginner": 0.4180073142051697,
"expert": 0.2204027771949768
}
|
31,510
|
Write a function capable of taking one string
as a parameter and one character.
Your function should open a file (with the
name in the string), and then count how
many times that character is in the file – and
return this number
|
67f3dd8a5286276d51b69f6fc70a2599
|
{
"intermediate": 0.36862945556640625,
"beginner": 0.409268319606781,
"expert": 0.22210220992565155
}
|
31,511
|
package foleon.mmso2;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
public class Mmso2 extends JavaPlugin implements Listener {
private Map<UUID, String> captchaCodes = new HashMap<>();
private Map<UUID, Integer> captchaTimers = new HashMap<>();
private Map<UUID, Boolean> captchaInProgress = new HashMap<>();
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
generateCaptchaCode(player);
startCaptchaTimer(player);
new BukkitRunnable() {
@Override
public void run() {
player.sendMessage(ChatColor.GREEN + "Введите код из центра экрана в чат: " + ChatColor.YELLOW + captchaCodes.get(player.getUniqueId()));
}
}.runTaskLater(this, 20);
}
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
UUID playerUUID = player.getUniqueId();
String message = event.getMessage();
if (captchaInProgress.containsKey(playerUUID)) {
event.setCancelled(true);
if (message.equalsIgnoreCase(captchaCodes.get(playerUUID))) {
stopCaptchaTimer(playerUUID);
player.sendMessage(ChatColor.GREEN + "Проверка пройдена!");
captchaInProgress.remove(playerUUID);
player.setGameMode(GameMode.SURVIVAL);
} else {
player.kickPlayer(ChatColor.RED + "Проверка не пройдена!");
cleanup(playerUUID);
}
}
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
UUID playerUUID = player.getUniqueId();
if (captchaInProgress.containsKey(playerUUID)) {
event.setCancelled(true);
}
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
UUID playerUUID = player.getUniqueId();
if (captchaInProgress.containsKey(playerUUID)) {
event.setCancelled(true);
}
}
@EventHandler
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
UUID playerUUID = player.getUniqueId();
if (captchaInProgress.containsKey(playerUUID)) {
event.setCancelled(true);
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
UUID playerUUID = player.getUniqueId();
cleanup(playerUUID);
}
private void generateCaptchaCode(Player player) {
UUID playerUUID = player.getUniqueId();
int code = new Random().nextInt(9000) + 1000;
String captchaCode = String.valueOf(code);
captchaCodes.put(playerUUID, captchaCode);
captchaInProgress.put(playerUUID, true);
player.setGameMode(GameMode.ADVENTURE);
}
private void startCaptchaTimer(Player player) {
UUID playerUUID = player.getUniqueId();
captchaTimers.put(playerUUID, 30);
new BukkitRunnable() {
@Override
public void run() {
int timeLeft = captchaTimers.get(playerUUID);
if (timeLeft > 0) {
if (!player.isOnline()) {
stopCaptchaTimer(playerUUID);
cleanup(playerUUID);
} else {
player.sendTitle(ChatColor.RED + "Капча: " + timeLeft + " секунд", "");
captchaTimers.put(playerUUID, timeLeft - 1);
}
} else {
player.kickPlayer(ChatColor.RED + "Время на капчу истекло!");
stopCaptchaTimer(playerUUID);
cleanup(playerUUID);
}
}
}.runTaskTimer(this, 20, 20);
}
private void stopCaptchaTimer(UUID playerUUID) {
captchaCodes.remove(playerUUID);
captchaTimers.remove(playerUUID);
}
private void cleanup(UUID playerUUID) {
captchaInProgress.remove(playerUUID);
captchaCodes.remove(playerUUID);
captchaTimers.remove(playerUUID);
}
} заблокируй возможность вводить команды пока ты не пройдешь капчу и пофикси спам в консоли. скинь итоговый код
|
0a7babcb74d5bc723e684a28d671875f
|
{
"intermediate": 0.27898913621902466,
"beginner": 0.5700016617774963,
"expert": 0.151009202003479
}
|
31,512
|
Write a program that asks the
user to enter a number from 1,
2, 3, 4. If the user enters a
different number the programme
should ask the user again. If
one of these numbers is
entered, it should end.
|
e2633346af139939b394474c86574195
|
{
"intermediate": 0.4226691722869873,
"beginner": 0.22196772694587708,
"expert": 0.355363130569458
}
|
31,513
|
package foleon.mmso2;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
public class CaptchaPlugin extends JavaPlugin implements Listener {
private Map<Player, String> captchas = new HashMap<>();
private Map<Player, GameMode> previousGameModes = new HashMap<>();
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setTo(event.getFrom());
player.sendMessage(ChatColor.RED + “Вы не можете двигаться во время капчи!”);
}
}
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
String captcha = captchas.get(player);
if (event.getMessage().equalsIgnoreCase(captcha)) {
player.sendMessage(ChatColor.GREEN + “Капча пройдена успешно!”);
captchas.remove(player);
// Возвращаем предыдущий режим игры
if (previousGameModes.containsKey(player)) {
player.setGameMode(previousGameModes.get(player));
previousGameModes.remove(player);
}
} else {
player.kickPlayer(ChatColor.RED + “Вы ввели неправильную капчу!”);
}
}
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + “Вы не можете выкидывать предметы во время капчи!”);
}
}
@EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + “Вы не можете подбирать предметы во время капчи!”);
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
captchas.remove(player);
previousGameModes.remove(player);
}
@EventHandler
public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + “Вы не можете вводить команды во время капчи!”);
}
}
public void startCaptcha(Player player) {
StringBuilder captcha = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 6; i++) {
char randomChar = (char) (random.nextInt(36) + (random.nextInt(2) == 0 ? 65 : 97));
captcha.append(randomChar);
}
captchas.put(player, captcha.toString());
previousGameModes.put(player, player.getGameMode());
player.setGameMode(GameMode.SPECTATOR);
new BukkitRunnable() {
int time = 30;
@Override
public void run() {
if (captchas.containsKey(player)) {
if (time <= 0) {
player.kickPlayer(ChatColor.RED + “Вы не успели ввести капчу!”);
captchas.remove(player);
// Возвращаем предыдущий режим игры
if (previousGameModes.containsKey(player)) {
player.setGameMode(previousGameModes.get(player));
previousGameModes.remove(player);
}
cancel();
} else {
player.sendTitle(ChatColor.GREEN + “Капча”, captcha.toString(), 0, 40, 0);
player.sendMessage(ChatColor.GREEN + "Введите капчу в чат: " + captcha.toString());
time–;
}
} else {
// Возвращаем предыдущий режим игры
if (previousGameModes.containsKey(player)) {
player.setGameMode(previousGameModes.get(player));
previousGameModes.remove(player);
}
cancel();
}
}
}.runTaskTimer(this, 0, 20);
}
}
добавь в этот код чтобы после ввода капчи ты все еще не мог писать в чат, вводить команды, ломать блоки, подбирать и выкидывать предметы и получать урон. Сделай чтобы игрок придумал пароль для своего аккаунта после капчи, если пароль уже придуман сделай так чтобы он ввел свой пароль. Сохрани пароли в файле password.yml. Сделай чтобы после ввода пароля игрок мог ломать блоки,писать в чат, вводить команды и подбирать и выкидывать предметы и получать урон.
|
745554acae1586420375113039fc1a94
|
{
"intermediate": 0.260836124420166,
"beginner": 0.5087767839431763,
"expert": 0.23038709163665771
}
|
31,514
|
package foleon.mmso2;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
public class CaptchaPlugin extends JavaPlugin implements Listener {
private Map<Player, String> captchas = new HashMap<>();
private Map<Player, GameMode> previousGameModes = new HashMap<>();
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setTo(event.getFrom());
player.sendMessage(ChatColor.RED + “Вы не можете двигаться во время капчи!”);
}
}
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
String captcha = captchas.get(player);
if (event.getMessage().equalsIgnoreCase(captcha)) {
player.sendMessage(ChatColor.GREEN + “Капча пройдена успешно!”);
captchas.remove(player);
// Возвращаем предыдущий режим игры
if (previousGameModes.containsKey(player)) {
player.setGameMode(previousGameModes.get(player));
previousGameModes.remove(player);
}
} else {
player.kickPlayer(ChatColor.RED + “Вы ввели неправильную капчу!”);
}
}
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + “Вы не можете выкидывать предметы во время капчи!”);
}
}
@EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + “Вы не можете подбирать предметы во время капчи!”);
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
captchas.remove(player);
previousGameModes.remove(player);
}
@EventHandler
public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (captchas.containsKey(player)) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + “Вы не можете вводить команды во время капчи!”);
}
}
public void startCaptcha(Player player) {
StringBuilder captcha = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 6; i++) {
char randomChar = (char) (random.nextInt(36) + (random.nextInt(2) == 0 ? 65 : 97));
captcha.append(randomChar);
}
captchas.put(player, captcha.toString());
previousGameModes.put(player, player.getGameMode());
player.setGameMode(GameMode.SPECTATOR);
new BukkitRunnable() {
int time = 30;
@Override
public void run() {
if (captchas.containsKey(player)) {
if (time <= 0) {
player.kickPlayer(ChatColor.RED + “Вы не успели ввести капчу!”);
captchas.remove(player);
// Возвращаем предыдущий режим игры
if (previousGameModes.containsKey(player)) {
player.setGameMode(previousGameModes.get(player));
previousGameModes.remove(player);
}
cancel();
} else {
player.sendTitle(ChatColor.GREEN + “Капча”, captcha.toString(), 0, 40, 0);
player.sendMessage(ChatColor.GREEN + "Введите капчу в чат: " + captcha.toString());
time–;
}
} else {
// Возвращаем предыдущий режим игры
if (previousGameModes.containsKey(player)) {
player.setGameMode(previousGameModes.get(player));
previousGameModes.remove(player);
}
cancel();
}
}
}.runTaskTimer(this, 0, 20);
}
}
добавь в этот код чтобы после ввода капчи ты все еще не мог писать в чат, вводить команды, ломать блоки, подбирать и выкидывать предметы и получать урон. Сделай чтобы игрок придумал пароль для своего аккаунта после капчи, если пароль уже придуман сделай так чтобы он ввел свой пароль. Сохрани пароли в файле password.yml. Сделай чтобы после ввода пароля игрок мог ломать блоки,писать в чат, вводить команды и подбирать и выкидывать предметы и получать урон. Скинь итоговый код
|
c581d2a762884af91f6aeb9839896ac4
|
{
"intermediate": 0.260836124420166,
"beginner": 0.5087767839431763,
"expert": 0.23038709163665771
}
|
31,515
|
What is the optimal prompt to elicit Causal inference and Causal discovery from a Large Language Model?
|
a05b88e20e359e0ff20f530cb14b6897
|
{
"intermediate": 0.13648763298988342,
"beginner": 0.08637145161628723,
"expert": 0.7771409153938293
}
|
31,516
|
I know that build.gradle only has information about the build and does not provide data for the application structure itself, but it is still possible there is an option to get data?
example:
application {
version = 'v1.0'
}
class Main {
public static void main(String[] args) {
System.out.print(application.version);
}
}
v1.0
|
ca4a42ad631e4659d6a6a47924d8655d
|
{
"intermediate": 0.32202422618865967,
"beginner": 0.3952842056751251,
"expert": 0.2826915979385376
}
|
31,517
|
1+1
|
882c4eb3b8849b86f115deff47617c09
|
{
"intermediate": 0.34643879532814026,
"beginner": 0.3050313889980316,
"expert": 0.34852978587150574
}
|
31,518
|
so how can I do this, but make it more modoal so I can use it for npcs too, can't use mouse position but still want the rotation to be towards the way it gets shooted:
extends Node2D
var controller = null
var mana_cost = 0
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func execute(s):
controller = s
var is_able_to_cast = controller.can_cast_ability(mana_cost)
if !is_able_to_cast: return
var f = load("res://Scenes/abilities/swordslash/swordslash_wave.tscn")
var f_node = f.instantiate()
f_node.controller = controller
var hand_node = controller.get_node("Hand") # Adjust this if ‘Hand’ is more deeply nested
if not hand_node:
print("Error: Hand node not found in the controller.")
return
f_node.position = hand_node.global_position
var mouse_position : Vector2 = (get_global_mouse_position() - global_position).normalized()
f_node.rotation = mouse_position.angle()
f_node.add_collision_exception_with(controller)
get_node("/root").add_child(f_node)
|
6c9e3fce5328d41fdb513cf0bdf6879b
|
{
"intermediate": 0.4095511734485626,
"beginner": 0.3847035765647888,
"expert": 0.20574529469013214
}
|
31,519
|
is there a free ChatGPT Bible
|
b59666219fe9882691d627bc7dd3ae7e
|
{
"intermediate": 0.328649640083313,
"beginner": 0.3369077742099762,
"expert": 0.3344426155090332
}
|
31,520
|
Design a web page that contains two paragraphs (p1, p2) with 12pt font size.
The font size increases by 1pt each time the user clicks on paragraph p1.
The font size goes back to 12pt when the user clicks on the p2 paragraph
using php
|
5826aeef3c41d8197d339a1da9a38496
|
{
"intermediate": 0.3814269006252289,
"beginner": 0.323099285364151,
"expert": 0.29547378420829773
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.