row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
1,906
you cant change the other moduels, you are only allowedd to change kayttoliittyma.js. make the code i ahve to add or replace as simple and short as you can. make sure the code is compatible with other modules and that it wont say undefined and should display the right number or symbol when the number is beyond 10why are the numbers beyong 10 in my card game not displaying as letters. my card game has one javascript called kayttoliittyma.js that is connected to other modules(kasi.js, kortti.js, maa.js, pakka.js). kayttoliittyma.js://pelaajien kädet, pakka ja DOM-elementit import { Pakka } from “./moduulit/pakka.js”; import { Kasi } from “./moduulit/kasi.js”; import { Maa } from “./moduulit/maa.js”; const pelaajankasi = Kasi.luoKasi(); const jakajankasi = Kasi.luoKasi(); const pakka = Pakka.luoPakka(); const pelaajaElementit = document.querySelectorAll(“#pelaajan-kortit > .kortti”); const jakajaElementit = document.querySelectorAll(“#jakajan-kortit > .kortti”); const tulos = document.getElementById(“tulos”); const otaKorttiButton = document.getElementById(“ota-kortti”); const jaaButton = document.getElementById(“jaa”); const uusiPeliButton = document.getElementById(“uusi-peli”); //funktiot korttien päivittämiseen ja tuloksen näyttämiseen function paivitaKortit(elementit, kortit) { for (let i = 0; i < elementit.length; i++) { if (kortit[i]) { if (elementit === jakajaElementit) { setTimeout(() => { elementit[i].innerHTML = kortit[i].toString(); if (kortit[i].maa.vari === “punainen”) { elementit[i].classList.add(“punainen”); elementit[i].classList.remove(“musta”); } else { elementit[i].classList.add(“musta”); elementit[i].classList.remove(“punainen”); } }, 500 * (i + 1)); } else { elementit[i].innerHTML = kortit[i].toString(); if (kortit[i].maa.vari === “punainen”) { elementit[i].classList.add(“punainen”); elementit[i].classList.remove(“musta”); } else { elementit[i].classList.add(“musta”); elementit[i].classList.remove(“punainen”); } } } else { elementit[i].innerHTML = “”; elementit[i].classList.remove(“musta”); elementit[i].classList.remove(“punainen”); } } } function paivitaTulos() { tulos.innerHTML = Pelaajan summa: {pelaajankasi.summa} | Jakajan summa:{jakajankasi.summa}; } //aloitetaan peli function aloitaPeli() { pakka.sekoita(); pelaajankasi.lisaaKortti(pakka.otaKortti()); jakajankasi.lisaaKortti(pakka.otaKortti()); paivitaKortit(pelaajaElementit, pelaajankasi.kortit); paivitaKortit(jakajaElementit, [jakajankasi.kortit[0], null]); paivitaTulos(); } //lisätään kortteja jakajalle kunnes summa >= 17 function jakajaVuoro() { while (jakajankasi.summa < 17) { jakajankasi.lisaaKortti(pakka.otaKortti()); } paivitaKortit(jakajaElementit, jakajankasi.kortit); paivitaTulos(); if (jakajankasi.summa > 21 || pelaajankasi.summa > jakajankasi.summa) { tulos.innerHTML = Pelaaja voitti! Pelaajan summa: {pelaajankasi.summa} | Jakajan summa:{jakajankasi.summa}; } else if (pelaajankasi.summa < jakajankasi.summa) { tulos.innerHTML = Jakaja voitti! Pelaajan summa: {pelaajankasi.summa} | Jakajan summa:{jakajankasi.summa}; } else { tulos.innerHTML = Tasapeli! Pelaajan summa: {pelaajankasi.summa} | Jakajan summa:{jakajankasi.summa}; } otaKorttiButton.disabled = true; jaaButton.disabled = true; uusiPeliButton.disabled = false; } //kuunnellaan klikkauksia otaKorttiButton.addEventListener(“click”, () => { pelaajankasi.lisaaKortti(pakka.otaKortti()); paivitaKortit(pelaajaElementit, pelaajankasi.kortit); paivitaTulos(); if (pelaajankasi.summa > 21) { tulos.innerHTML = Hävisit! Pelaajan summa: {pelaajankasi.summa} | Jakajan summa:{jakajankasi.summa}; otaKorttiButton.disabled = true; jaaButton.disabled = true; uusiPeliButton.disabled = false; } }); jaaButton.addEventListener(“click”, () => { paivitaKortit(jakajaElementit, jakajankasi.kortit); jaaButton.disabled = true; jakajaVuoro(); }); //aloitetaan uusi peli uudestaan uusiPeliButton.addEventListener(“click”, () => { window.location.reload(); }); aloitaPeli(); maa.js:/* Tämä moduuli sisältää maiden (pata, risti, hertta, ruutu) määrittelyt. / / Ominaisuuksiin viitataan pistenotaatiolla, eli esim. jos muuttujan nimi on maa, niin maa.nimi, maa.symboli tai maa.vari. / export const Maa={ PATA:Object.freeze({nimi:‘pata’, symboli:‘\u2660’, vari:‘musta’}), RISTI:Object.freeze({nimi:‘risti’, symboli:‘\u2663’, vari:‘musta’}), HERTTA:Object.freeze({nimi:‘hertta’, symboli:‘\u2665’, vari:‘punainen’}), RUUTU:Object.freeze({nimi:‘ruutu’, symboli:‘\u2666’, vari:‘punainen’}) };kasi.js/ Kasi (käsi) -luokka edustaa pelaajan tai jakajan kättä. Pakka-luokan aliluokkana se saa kaikki Pakka-luokan metodit. / / Lisäksi se osaa laskea kädessä olevien korttien summan ja kertoa niiden määrän. / import { Kortti } from “./kortti.js”; import { Pakka } from “./pakka.js”; export class Kasi extends Pakka { constructor() { super(); } / Staattinen metodi eli sitä kutsutaan luokan kautta: Kasi.luoKasi(); / / Palauttaa uuden Kasi-olion eli tyhjän käden. Ei voi kutsua olioissa. / static luoKasi() { let apukasi = new Kasi(); return apukasi; } / Palauttaa kädessä olevien korttien määrän. / / Tämä on ns. getteri eli sitä käytetään olion ominaisuutena, ei funktiona (eli ilman sulkuja). Esim. let maara = omaPakka.kortteja; / get kortteja() { return this.kortit.length; } / Palauttaa kädessä olevien korttien summan. / get summa() { return this.kortit.reduce((summa, kortti) => summa + kortti.arvo, 0); } } kortti.js:/ Tämä moduuli määrittelee yhden pelikortin. / export class Kortti { / Konstruktori uusien korttien luomiseen. maa-parametri on Maa-tyypin vakio, arvo numero. / / Vain Pakka-luokan käyttöön. Ei tarkoitettu käytettäväksi suoraan käyttöliittymästä. / constructor(maa, arvo) { this.maa = maa; this.arvo = arvo; } / Palauttaa kortissa näytettävän arvosymbolin (A, J, Q, K tai numero). / / Tämä on ns. getteri eli sitä käytetään olion ominaisuutena, ei funktiona (eli ilman sulkuja). Esim. console.log(omaKortti.arvosymboli); / get arvosymboli() { switch (this.arvo) { case 1: return “A”; case 11: return “J”; case 12: return “Q”; case 13: return “K”; default: return this.arvo; } } / Palauttaa kortin tiedot merkkijonona. Ei hyödyllinen graafista käyttöliittymää tehdessä. / toString() { return {this.maa.symboli}{this.arvo}; } } pakka.js:/ Pakka-luokka edustaa yhtä korttipakkaa eli 52 korttia. / import {Maa} from “./maa.js”; import {Kortti} from “./kortti.js”; export class Pakka{ / Konstruktori. Kun Pakka-luokasta luodaan olio, se saa tyhjän taulukon korteille. / / Tätä ei ole tarkoitus kutsua ulkopuolelta, vain luoPakka-metodin kautta. / constructor() { this.kortit=[]; } / Lisää kortin (Kortti-olion) tähän pakkaan. Tästä metodista on enemmän hyötyä aliluokassa Kasi. / lisaaKortti(uusiKortti){ this.kortit.push(uusiKortti); } / Poistaa kortin tästä pakasta ja palauttaa sen. / otaKortti() { return this.kortit.pop(); } / Sekoittaa pakan eli laittaa kortit satunnaiseen järjestykseen. */ sekoita() { if(this.kortit.length<2) { return; } else { for(let i=0; i<this.kortit.length; i++){ let indA=Math.floor(Math.random()*this.kortit.length); let indB=Math.floor(Math.random()this.kortit.length); [this.kortit[indA], this.kortit[indB]]=[this.kortit[indB],this.kortit[indA]]; } } } / Staattinen metodi eli sitä kutsutaan luokan kautta: Pakka.luoPakka(); / / Palauttaa uuden Pakka-olion, jossa on 52 korttia. Ei voi kutsua olioissa. / static luoPakka() { let apupakka=new Pakka(); for(let i=1; i<=13; i++) { apupakka.lisaaKortti(new Kortti(Maa.HERTTA, i)); apupakka.lisaaKortti(new Kortti(Maa.RUUTU, i)); apupakka.lisaaKortti(new Kortti(Maa.PATA, i)); apupakka.lisaaKortti(new Kortti(Maa.RISTI,i)); } return apupakka; } / Palauttaa pakan tiedot merkkijonona. Ei hyödyllinen graafista käyttöliittymää tehdessä. */ toString() { return this.kortit.map(Kortti=>Kortti.toString()).join(', '); } };
a77da6a9c2f263a33ef75b0574772fc2
{ "intermediate": 0.25232261419296265, "beginner": 0.47063934803009033, "expert": 0.27703800797462463 }
1,907
layout = [ [ sg.Frame("Parameters", [[sg.Text("Method"),sg.Radio("R1", "R", key="r1"), sg.Radio("R2", "R", key="r2")], [sg.Text("Radius"), sg.Slider((3, 5, 7), 2, orientation="h", key="radius")]], element_justification="left"), sg.Button("Remove Watermark", key="remove_watermark") ], [ sg.Frame("Original", [[sg.Image(filename="", key="image1")]], element_justification="left"), sg.Frame("Mask", [[sg.Image(filename="", key="image2")]], element_justification="left"), sg.Frame("Output", [[sg.Image(filename="", key="image3")]], element_justification="right") ] ] 上面的layout需要修改,Method里面的radio希望纵向排列,3个frame希望左2右1排列,默认里面没有图片,又一个+号,点击+号弹出图片选择框,选择本地文件展示。
2ccd6ce7f619aa9466d89e37e1a9ff82
{ "intermediate": 0.32023003697395325, "beginner": 0.43739837408065796, "expert": 0.24237152934074402 }
1,908
write a python script that continuously generate random words using gpt and then store it on a log. the script will continuously running and generating random words until i press esc to exit.
f95d5f7c6240c04affc3b6e6ee2e319a
{ "intermediate": 0.38081586360931396, "beginner": 0.18288201093673706, "expert": 0.436302125453949 }
1,909
give me a mvc example, use javascript
a9f76a7d4921595d665f5aca987b1ceb
{ "intermediate": 0.6754195690155029, "beginner": 0.1924581378698349, "expert": 0.13212229311466217 }
1,910
Please demonstrate some code for a vector database
14217f141da3469d8590a52a0a25d823
{ "intermediate": 0.548042893409729, "beginner": 0.17917706072330475, "expert": 0.27278003096580505 }
1,911
Help me to write a python script to automate login for https://52pojie.cn
6fb455c7f0cc4f12f87e1c6e2e40a224
{ "intermediate": 0.38121721148490906, "beginner": 0.14141303300857544, "expert": 0.4773698151111603 }
1,912
import pyperclip import time import string from pynput import keyboard from PyQt5 import QtWidgets, QtGui, QtCore delay = 100 first_char_delay = 2000 shift_delay = 100 SETTINGS_FILE = 'settings.txt' class SystemTrayIcon(QtWidgets.QSystemTrayIcon): def init(self, icon, parent=None): super().init(icon, parent) self.menu = QtWidgets.QMenu() self.settings_action = self.menu.addAction('Settings') self.exit_action = self.menu.addAction('Exit') self.setContextMenu(self.menu) self.settings_action.triggered.connect(self.open_settings) self.exit_action.triggered.connect(self.close_program) self.settings_dialog = None self.worker = Worker() self.worker.start() self.worker.clipboard_changed.connect(self.handle_clipboard_change) self.is_typing = False self.setup_keyboard_listener() def setup_keyboard_listener(self): def for_canonical(f): return lambda k: f(self.l.canonical(k)) self.hotkeys = { frozenset([keyboard.Key.shift, keyboard.Key.alt, keyboard.Key.ctrl]): self.type_copied_text } self.current_keys = set() self.l = keyboard.Listener( on_press=for_canonical(self.press_key), on_release=for_canonical(self.release_key), ) self.l.start() def press_key(self, key): try: if any([key in self.current_keys for key in self.hotkeys.keys()]): return self.current_keys.add(key) for hotkey in self.hotkeys.keys(): if self.current_keys == hotkey: self.hotkeyshotkey except Exception as e: print(str(e)) pass def release_key(self, key): try: self.current_keys.remove(key) except KeyError as e: print(str(e)) pass def type_copied_text(self): new_clipboard_content = pyperclip.paste().strip() if new_clipboard_content: time.sleep(first_char_delay / 1000) keyboard_controller = keyboard.Controller() shift_chars = string.ascii_uppercase + ''.join( c for c in string.printable if not c.isalnum() ) for char in new_clipboard_content: if char in string.printable: if char in shift_chars: keyboard_controller.press(keyboard.Key.shift) time.sleep(shift_delay / 1000) keyboard_controller.press(char) keyboard_controller.release(char) if char in shift_chars: time.sleep(shift_delay / 1000) keyboard_controller.release(keyboard.Key.shift) time.sleep(delay / 1000) def handle_clipboard_change(self, text): self.worker.clipboard_content = text def open_settings(self): if not self.settings_dialog: self.settings_dialog = SettingsDialog() self.settings_dialog.show() def close_program(self): self.l.stop() QtWidgets.QApplication.quit() class Worker(QtCore.QThread): clipboard_changed = QtCore.pyqtSignal(str) def init(self, parent=None): super().init(parent) self.clipboard_content = pyperclip.paste() def run(self): while True: new_clipboard_content = pyperclip.paste() if new_clipboard_content != self.clipboard_content: self.clipboard_content = new_clipboard_content self.clipboard_changed.emit(new_clipboard_content) time.sleep(0.1) class SettingsDialog(QtWidgets.QDialog): def init(self, parent=None): super().init(parent) self.setWindowTitle('Settings') self.setFixedSize(400, 300) self.delay_label = QtWidgets.QLabel('Delay between characters (ms):') self.delay_spinbox = QtWidgets.QSpinBox() self.delay_spinbox.setMinimum(0) self.delay_spinbox.setMaximum(10000) self.delay_spinbox.setValue(delay) self.first_char_delay_label = QtWidgets.QLabel('Delay before first character (ms):') self.first_char_delay_spinbox = QtWidgets.QSpinBox() self.first_char_delay_spinbox.setMinimum(0) self.first_char_delay_spinbox.setMaximum(10000) self.first_char_delay_spinbox.setValue(first_char_delay) self.shift_delay_label = QtWidgets.QLabel('Shift key delay (ms):') self.shift_delay_spinbox = QtWidgets.QSpinBox() self.shift_delay_spinbox.setMinimum(0) self.shift_delay_spinbox.setMaximum(1000) self.shift_delay_spinbox.setValue(shift_delay) self.save_button = QtWidgets.QPushButton('Save') self.cancel_button = QtWidgets.QPushButton('Cancel') self.save_button.clicked.connect(self.save_settings) self.cancel_button.clicked.connect(self.reject) layout = QtWidgets.QVBoxLayout() layout.addWidget(self.delay_label) layout.addWidget(self.delay_spinbox) layout.addWidget(self.first_char_delay_label) layout.addWidget(self.first_char_delay_spinbox) layout.addWidget(self.shift_delay_label) layout.addWidget(self.shift_delay_spinbox) buttons_layout = QtWidgets.QHBoxLayout() buttons_layout.addWidget(self.save_button) buttons_layout.addWidget(self.cancel_button) layout.addLayout(buttons_layout) self.setLayout(layout) def save_settings(self): global delay, first_char_delay, shift_delay delay = self.delay_spinbox.value() first_char_delay = self.first_char_delay_spinbox.value() shift_delay = self.shift_delay_spinbox.value() with open(SETTINGS_FILE, 'w') as f: f.write(f"{delay}\n{first_char_delay}\n{shift_delay}") self.accept() def main(): app = QtWidgets.QApplication([]) app.setQuitOnLastWindowClosed(False) tray_icon = SystemTrayIcon(QtGui.QIcon('icon.png')) tray_icon.show() try: with open(SETTINGS_FILE, 'r') as f: lines = f.read().splitlines() delay = int(lines[0]) first_char_delay = int(lines[1]) shift_delay = int(lines[2]) except (FileNotFoundError, ValueError): pass app.exec_() if __name__ == '__main__': main()
707389a846338dc00ef9dfd425f92472
{ "intermediate": 0.35939422249794006, "beginner": 0.4621271789073944, "expert": 0.17847858369350433 }
1,913
Write me code that recursively scrapes all folders in https://arcjav.arcjavdb.workers.dev/0:/001-050/%E4%B8%8A%E5%8E%9F%E4%BA%9A%E8%A1%A3/ and provides the links for movies and images to download
71f7e582a008b070eadd8cc8ae322835
{ "intermediate": 0.6520383954048157, "beginner": 0.10994160920381546, "expert": 0.23802001774311066 }
1,914
I wrote a code following, Why the i value is { 1 . . 10 }? for i in { 1..10} do echo $i done
bc72460e871c169e0791c46ffadc1f09
{ "intermediate": 0.3508111536502838, "beginner": 0.4343520402908325, "expert": 0.21483680605888367 }
1,915
jetpack compose styling page with 4 buttons textfield and 2 texts
02e62e5757de7084c42614d8821cb77d
{ "intermediate": 0.40767669677734375, "beginner": 0.2801450490951538, "expert": 0.3121783137321472 }
1,916
flutter listview scroll to bottom code
5a0ef111b99d7e10771d1cc536ebf3d6
{ "intermediate": 0.31716763973236084, "beginner": 0.2992909848690033, "expert": 0.38354143500328064 }
1,917
Write a batch script which uploads a file to a server via winscp
c0de9a22cacc2a48fd2341e82d3b0f96
{ "intermediate": 0.4203956425189972, "beginner": 0.18300454318523407, "expert": 0.39659976959228516 }
1,918
import struct import sqlite3 import time import sys import getopt #import Exceptions from pymodbus.client import ModbusSerialClient as ModbusClient from pymodbus.exceptions import ModbusInvalidResponseError # 打开串口 client = ModbusClient(method="rtu", port='COM1', baudrate=9600) client.connect() filename = 'data.db' # 创建数据库 conn = sqlite3.connect(filename) cursor = conn.cursor() cursor.execute('CREATE TABLE IF NOT EXISTS data(id INTEGER PRIMARY KEY AUTOINCREMENT,data FLOAT,date DATE,time TIME,timestamp TIMESTAMP)') # args def usage(): print(''' -h, --help: 帮助 -m, --measure: 读取测量值 -w, --warning: 读取继电器报警 -s, --setting: 写寄存器 -r, --read: 读取寄存器 -mo, --monitor: 持续读取测量值并记录 -o, --output: 输出文件名 ''') ### 寄存器操作 def read_register(reg_addr, reg_count) -> int: # 读取寄存器并返回值 rr = client.read_holding_registers(reg_addr, reg_count,unit=0x01) ans = rr.registers[0] return ans def read_float(register_addr) -> int: # 读取寄存器并转换为浮点数 # count: 2 ans = read_register(register_addr,2) result = struct.unpack('>f', struct.pack('>HH', ans))[0] return result def write_register(register_addr, value) -> int: # 往一个寄存器写入值 result = client.write_register(register_addr, value, unit=0x01) return result def write_float(register_addr, value) -> int: # 往一个寄存器写入浮点数 val = struct.unpack('>HH', struct.pack('>f', value)) result = client.write_registers(register_addr, val, unit=0x01) return result ### 测量操作 def measure_float() -> float: # 读取测量值浮点数 # addr: 0x20 # count: 2 ans = read_float(0x20) return ans.__round__(4) ### 读取操作 def read_current_ct(): # 读取电流变比 # addr: 0x1C # count: 1 ans = read_register(0x1C, 1) return ans def read_comm_addr(): # 读取通讯地址 # addr: 0x1B # count: 1 ans = read_register(0x1B, 1) return ans def read_comm_bin(): # 读取通讯比特率 # addr: 0x1C # count: 1 ans = read_register(0x1C, 1) return ans def read_dp(): # 小数点位置 # addr: 0x1E # count: 1 ans = read_register(0x1E, 1) dp = ans.registers[0] return bin(dp)[-1] def measure_int(): # DM5 不支持 pass def read_war_uperhigh(): # 读取上上限 # addr: 0x20 ans = read_float(0x20) return ans.__round__(4) def read_war_high(): # 读取上限 # addr: 0x22 ans = read_float(0x22) return ans.__round__(4) def read_out_delay(): # 读取输出延时 # addr: 0x24 ans = read_float(0x24) return ans.__round__(4) def read_war_low(): # 读取下限 # addr: 0x26 ans = read_float(0x26) return ans.__round__(4) def read_war_uperlow(): # 读取下下限 # addr: 0x28 ans = read_float(0x28) return ans.__round__(4) def read_out_offset(): # 读取输出偏移 # addr: 0x2C ans = read_float(0x2C) return ans.__round__(4) def read_warning(): # 继电器报警 # addr: 0x2E | 46 war = read_register(0x2E, 2) war = client.read_holding_registers(0x002E, 2, unit=0x01).registers[0] war_HH = int(war & 0b1111000000000000) >> 12 #上上限 war_HI = int(war & 0b0000111100000000) >> 8 #上限 war_GO = int(war & 0b0000000011110000) >> 4 war_LO = int(war & 0b0000000000001111) #下限 war_LL = int(war & 0b1111000000000000) >> 12 #下下限 return war_HH, war_HI, war_GO, war_LO, war_LL ### 写入操作 def setting(current_ct=None, comm_addr=None, comm_bin=None, war_uperhigh=None, war_high=None, war_uperlow=None, war_low=None, out_delay=None, out_offset=None): # 配置 ### Int # current_ct: 电流变比CT 0x14 1 # comm_addr: 通讯地址 0x1B 1 # comm_bin: 通讯比特率 0x1C 1 ### Float # war_uperhigh: 上上限 0x20 2 # war_high: 上限 0x22 2 # war_uperlow: 下下限 0x28 2 # war_low: 下限 0x26 2 # out_delay: 输出延时 0x24 2 # out_offset: 输出偏移 0x2C 2 # 写入电流变比触发器 CT 值 if current_ct is not None: write_register(0x14, current_ct) # 写入通讯地址 if comm_addr is not None: write_register(0x1B, comm_addr) # 写入通讯比特率 if comm_bin is not None: write_register(0x1C, comm_bin) # 写入上上限 if war_uperhigh is not None: write_float(0x20, war_uperhigh) # 写入上限 if war_high is not None: write_float(0x22, war_high) # 写入下下限 if war_uperlow is not None: write_float(0x28, war_uperlow) # 写入下限 if war_low is not None: write_float(0x26, war_low) # 写入输出延时 if out_delay is not None: write_float(0x24, out_delay) # 写入输出偏移 if out_offset is not None: write_float(0x2C, out_offset) ### 记录操作 def record(): # 记录 try: # 持续记录数据 while True: # 读取寄存器 result = measure_float() # 存储数据 date = time.strftime("%Y-%m-%d", time.localtime()) current_time = time.strftime("%H:%M:%S", time.localtime()) timestamp = int(time.time()) cursor.execute('INSERT INTO data(data, date, time, timestamp) VALUES(?, ?, ?, ?)', (result, date, current_time, timestamp)) conn.commit() # 打印数据 print(f"Received data: {result}, Date: {date}, Time: {current_time}") # 等待 time.sleep(0.1) except KeyboardInterrupt: # 关闭串口和数据库连接 print('KeyboardInterrupt') client.close() cursor.close() conn.close() if __name__ == "__main__": record() 看一下这个代码,对于args部分你可以帮我修改补充代码吗?
3cd2a05bf77dde2fa16c23902b6afc26
{ "intermediate": 0.4050639569759369, "beginner": 0.31373757123947144, "expert": 0.28119853138923645 }
1,919
fivem scripting local teams = {['A']= 0, ['B']= 0} for k,v in pairs(teams) do if v == 0 then trigger event end end how do i only get the event to trigger if the v == 0 for both 'A' and 'B'
51170ea0ab370f779d5ab31757a26246
{ "intermediate": 0.3146877884864807, "beginner": 0.42804616689682007, "expert": 0.25726595520973206 }
1,920
is it possible to use putty to upload a file
ff7e76734b431ce36f58bf6c311bd357
{ "intermediate": 0.51010662317276, "beginner": 0.2367771565914154, "expert": 0.2531161606311798 }
1,921
Provide me with the best rclone mount script for watching large video files using onedrive. The script should try and reduce seek delay as much as possible and load the videos as quickly as possible with no buffering. I am using the most recent version, Rclone 1.62.2.
a49ace68b8042918baa195c538561a58
{ "intermediate": 0.3571031391620636, "beginner": 0.2428368628025055, "expert": 0.4000599980354309 }
1,922
How can i calculate shipping rate using royal mail api in javascript
a6cb6dccc5424ed4ed0d42a77c71255d
{ "intermediate": 0.727591872215271, "beginner": 0.09801820665597916, "expert": 0.1743900030851364 }
1,923
Check the following javascript code for any mistakes and explain what is wrong with it, asume all the images are named correctly and on the folder with the code <html> <head> <link rel="icon" href="http://www.iconarchive.com/download/i87143/graphicloads/colorful-long-shadow/Restaurant.ico"> <TITLE> O 100 Saladas </TITLE> </head> <body TEXT="blue" > <center> <I> <FONT FACE="Harlow Solid Italic"> <P> <FONT SIZE="7"> O 100 Saladas </FONT> </P> </I> <script type="text/javascript"> img0= new Image(); img0.src="restaurante.jpg"; img1= new Image(); img1.src="carne.jpg"; img2= new Image(); img2.src="carnea.jpg"; img3= new Image(); img3.src="carneb.jpg"; img4= new Image(); img4.src="carnes.jpg"; img5= new Image(); img5.src="carneab.jpg"; img6= new Image(); img6.src="carneas.jpg"; img7= new Image(); img7.src="carnebs.jpg"; img8= new Image(); img8.src="carneabs.jpg"; img9= new Image(); img9.src="peixe.jpg"; img10= new Image(); img10.src="peixea.jpg"; img11= new Image(); img11.src="peixeb.jpg"; img12= new Image(); img12.src="peixes.jpg"; img13= new Image(); img13.src="peixeab.jpg"; img14= new Image(); img14.src="peixeas.jpg"; img15= new Image(); img15.src="peixebs.jpg"; img16= new Image(); img16.src="peixeabs.jpg"; img17= new Image(); img17.src="vegetariano.jpg"; img18= new Image(); img18.src="vegeta.jpg"; img19= new Image(); img19.src="vegetb.jpg"; img20= new Image(); img20.src="vegets.jpg"; img21= new Image(); img21.src="vegetab.jpg"; img22= new Image(); img22.src="vegetas.jpg"; img23= new Image(); img23.src="vegetbs.jpg"; img24= new Image(); img24.src="vegetabs.jpg"; function reset() { var acompanhamento = ['arroz', 'batatas']; // Limpar as checkboxes relativas ao acompanhamento for (var each in acompanhamento){ document.getElementById(acompanhamento[each]).checked = false; } // Faz reset à lista pendente ( Tipo de prato ) document.getElementById("prato").selectedIndex = 0; um.src = img0.src; // Coloca imagem por defeito } function pedido() { var pratoprincipal = document.getElementById("prato"); var tipodeprato = pratoprincipal.options[pratoprincipal.selectedIndex].value; var arroz = document.getElementById('arroz').checked; var Batata = document.getElementById('batatas').checked; if( (tipodeprato=="carne") && (arroz==false) && (Batata==false) ) { um.src=img1.src; } if( (tipodeprato=="carne") && (arroz==true) && (Batata==false) ) { um.src=img2.src; } if( (tipodeprato=="carne") && (arroz==false) && (Batata==true) ) { um.src=img3.src; } if( (tipodeprato=="carne") && (arroz==true) && (Batata==true) ) { um.src=img5.src; } if( (tipodeprato=="peixe") && (arroz==false) && (Batata==false) ) { um.src=img9.src; } if( (tipodeprato=="peixe") && (arroz==true) && (Batata==false) ) { um.src=img10.src; } if( (tipodeprato=="peixe") && (arroz==false) && (Batata==true) ) { um.src=img11.src; } if( (tipodeprato=="peixe") && (arroz==true) && (Batata==true) ) { um.src=img13.src; } if( (tipodeprato=="vegetariano") && (arroz==false) && (Batata==false) ) { um.src=img17.src; } if( (tipodeprato=="vegetariano") && (arroz==true) && (Batata==false) ) { um.src=img18.src; } if( (tipodeprato=="vegetariano") && (arroz==false) && (Batata==true) ) { um.src=img19.src; } if( (tipodeprato=="vegetariano") && (arroz==true) && (Batata==true) ) { um.src=img21.src; } } reset(); </script> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- Lista pendente para escolher o tipo de prato --> <select id="prato"> <option value="" disabled="disabled" selected="selected">Escolha um prato</option> <option value="carne"> Carne </option> <option value="peixe"> Peixe </option> <option value="vegetariano"> Vegetariano </option> </select> <br> <H4> <input name="arroz" id="arroz" type="checkbox"/> Arroz <input name="batatas" id="batatas" type="checkbox"/> Batatas </H4> <br> <input type="button" value="Reset" onclick="reset();" ;> <input type="button" value="Fazer pedido" onclick="pedido();" ;> <br><br> <img src="restaurante.jpg" border=1 width=400 height=400 name="um"></img> </center> </body> </html>
f61715abbf8ad13dc82772d2818b5ffc
{ "intermediate": 0.31635403633117676, "beginner": 0.3953733742237091, "expert": 0.28827255964279175 }
1,924
How can I repair grub menu inside of windows 10
f6c26534c93702eebaaa726add80ebd6
{ "intermediate": 0.3008037805557251, "beginner": 0.37581682205200195, "expert": 0.3233794569969177 }
1,925
for (i = 0; i < result.length; i++) { var resultJson = JSON.parse(JSON.stringify(result[i])); var operationName = resultJson.operationName; if (operationName == "updatedCount") { updatedCount = resultJson.result; break; } } nodejs package.json中设置了type:module 函数中为甚么执行这段代码会报错
2c1256a9d4eee6bab43e2a77c768d6c0
{ "intermediate": 0.42478883266448975, "beginner": 0.3099050521850586, "expert": 0.26530611515045166 }
1,926
for c# maui mvvm, what is the best practice to present color change based on values
973803c02b6765e72a4e07537cdc4ba4
{ "intermediate": 0.5580871105194092, "beginner": 0.10717625170946121, "expert": 0.3347366750240326 }
1,927
Correct this syntax and explain what it does : pd.DataFrame(df4.groupby(['A', 'B']).apply(lambda x: x.nunique(dropna=True) if x=='C'))
6afdf0248c427390da87d7798fb4daf7
{ "intermediate": 0.18222327530384064, "beginner": 0.7299546003341675, "expert": 0.08782214671373367 }
1,928
c# maui cross app using MVU pattern
9dc6a995a88944266473f7a5e85171a0
{ "intermediate": 0.39796480536460876, "beginner": 0.2599092125892639, "expert": 0.34212595224380493 }
1,929
c# maui cross app using MVU pattern
2017f21c4067fbb515d0e6d9b3de75c0
{ "intermediate": 0.39796480536460876, "beginner": 0.2599092125892639, "expert": 0.34212595224380493 }
1,930
In an oncology trial, I have 350 subjects randomized, and 210 of them died up to date, and the remaining 140 are all alive and have been observed for 3 months. I want to predict how long the remaining alive patients will live afterwards, taking into consideration their baseline age and gender. Please provide R software example code with simulated data, and step by step explanation.
e41fd7addc8ca00f6e42d0310fdc4820
{ "intermediate": 0.5501390695571899, "beginner": 0.15522636473178864, "expert": 0.29463455080986023 }
1,931
fivem scripting how to detect vehicle engine temperature
a1dfff464e2453623c3ea1047f655980
{ "intermediate": 0.24229350686073303, "beginner": 0.22498078644275665, "expert": 0.5327256917953491 }
1,932
hey
1b53dce1d6fa9332ab45aa4ae0e01561
{ "intermediate": 0.33180856704711914, "beginner": 0.2916048467159271, "expert": 0.3765866458415985 }
1,933
void drawTable() { // table top glColor3f(0.0f, 0.0f, 0.0f); // brown color glPushMatrix(); glTranslatef(0.0f, 1.5f, 0.0f); glScalef(3.0f, 0.5f, 2.0f); glutSolidCube(1.0f); glPopMatrix(); // table legs glPushMatrix(); glTranslatef(-1.25f, 0.75f, -0.75f); glScalef(0.5f, 1.5f, 0.5f); glutSolidCube(1.0f); glPopMatrix(); glPushMatrix(); glTranslatef(-1.25f, 0.75f, 0.75f); glScalef(0.5f, 1.5f, 0.5f); glutSolidCube(1.0f); glPopMatrix(); glPushMatrix(); glTranslatef(1.25f, 0.75f, -0.75f); glScalef(0.5f, 1.5f, 0.5f); glutSolidCube(1.0f); glPopMatrix(); glPushMatrix(); glTranslatef(1.25f, 0.75f, 0.75f); glScalef(0.5f, 1.5f, 0.5f); glutSolidCube(1.0f); glPopMatrix(); } void drawTree() { // trunk glColor3f(0.5f, 0.35f, 0.05f); // brown color glPushMatrix(); glTranslatef(0.0f, 1.0f, 0.0f); glScalef(0.5f, 2.0f, 0.5f); glutSolidCube(1.0f); glPopMatrix(); // leaves glColor3f(0.0f, 1.0f, 0.0f); // green color glPushMatrix(); glTranslatef(0.0f, 2.5f, 0.0f); glutSolidSphere(1.5f, 10, 10); glPopMatrix(); } void drawFloor() { // grass glColor3f(0.0f, 1.0f, 0.0f); // green color glPushMatrix(); glTranslatef(-2.5f, -0.1f, -2.5f); glScalef(6.0f, 0.2f, 6.0f); glutSolidCube(1.0f); glPopMatrix(); } void drawCheeseBoard() { // cheese board glColor3f(0.5f, 0.35f, 0.05f); // brown color glPushMatrix(); glTranslatef(0.0f, 1.6f, 0.0f); glScalef(2.0f, 0.2f, 1.5f); glutSolidCube(1.0f); glPopMatrix(); // handle glPushMatrix(); glTranslatef(1.1f, 1.7f, 0.0f); glScalef(0.2f, 0.4f, 0.2f); glutSolidCube(1.0f); glPopMatrix(); } void drawPlate() { // plate glColor3f(1.0f, 1.0f, 1.0f); // white color GLUquadricObj* quadratic; quadratic = gluNewQuadric(); glPushMatrix(); glTranslatef(0.0f, 1.6f, 0.0f); glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); glScalef(0.75f, 0.75f, 0.75f); gluDisk(quadratic, 0.0f, 1.0f, 32, 32); glPopMatrix(); } void drawWater() { // enable blending glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // water glColor4f(0.0f, 0.5f, 1.0f, 0.5f); // blue color with 50% transparency glPushMatrix(); glTranslatef(-2.5f, 0.0f, -2.5f); glScalef(6.5f, 0.1f, 6.5f); glutSolidCube(1.0f); glPopMatrix(); // disable blending glDisable(GL_BLEND); }
c4a298112e4e4b172c3aa51ca6bcb2ef
{ "intermediate": 0.3002902865409851, "beginner": 0.4672696590423584, "expert": 0.2324400544166565 }
1,934
fivem scripting I want to make it when you use nitrous the engine temperature increases if it hits above 300 you've got a change of killing the engine
78b1d97bf1370e555a8d39c548dbb677
{ "intermediate": 0.22191515564918518, "beginner": 0.4228343963623047, "expert": 0.35525044798851013 }
1,935
draw a tree with branches opengl c++
8258ca932a5b67bd174ff819efef43c5
{ "intermediate": 0.3364019989967346, "beginner": 0.39918333292007446, "expert": 0.26441460847854614 }
1,936
change this basic libre office calc code so that it organize nome congnome e telefono for rows instead then for column:
253c9835439117229b806299f95768b3
{ "intermediate": 0.5623306035995483, "beginner": 0.21398530900478363, "expert": 0.22368408739566803 }
1,937
Your task is to take the text I will be giving you, create a vocabulary that will include all the words in this text. The text is: "Once upon a time, in a land far, far away there was a brave knight named Sir Robert. Sir Robert had a quest to rescue the princess from the dragon’s lair. He set out on his trusty horse and fought the dragon with all his might. After a fierce battle, Sir Robert emerged victorious and rescued the princess. The kingdom rejoiced and Sir Robert was hailed a hero."
58fefe6b6e5f96413c18fd1ff6b2f9fb
{ "intermediate": 0.3197585642337799, "beginner": 0.4276563823223114, "expert": 0.2525849938392639 }
1,938
In an oncology trial, I have 350 subjects randomized, and 210 of them died up to date, and the remaining 140 are all alive and have been observed for 3 months. I want to predict how long the remaining alive patients will live afterwards, taking into consideration their baseline age and gender. Please provide R software example code with simulated data, and step by step explanation. In the R example code, Please don't use "$" character, and use "[[" and "]]" instead.
078d31c37758a619fc41c08ffdf262ea
{ "intermediate": 0.27670273184776306, "beginner": 0.2555418312549591, "expert": 0.46775540709495544 }
1,939
Write me code that recursively scrapes all folders in https://arcjav.arcjavdb.workers.dev/0:/001-050/上原亚衣/ and provides the links for movies and images to download. The site uses javascript. The folders on the page: CSS Selector: a.list-group-item:nth-child(1) CSS Path: html body div div#content div.container div#list.list-group.text-break a.list-group-item.list-group-item-action XPath: /html/body/div/div[1]/div/div[3]/a[1] The items inside the folders: CSS Selector: div.list-group-item:nth-child(5) > a:nth-child(2) CSS Path: html body div div#content div.container div#list.list-group.text-break div.list-group-item.list-group-item-action a.list-group-item-action XPath: /html/body/div/div[1]/div/div[3]/div[4]/a[1]
8ac9fb52216f84903ad672638ccaeb6a
{ "intermediate": 0.508629560470581, "beginner": 0.24334022402763367, "expert": 0.24803020060062408 }
1,940
library(survival) set.seed(42) # Generate a larger dataset with 100 patients n <- 100 data <- data.frame(time = abs(rnorm(n, mean=5, sd=3)), status = rbinom(n, 1, prob=0.6), age = sample(30:80, n, replace=T), gender = as.factor(sample(c("Male", "Female"), n, replace=T)), time_interval = as.factor(sample(1:4, n, replace=T))) # Fit the Cox proportional hazards model with piecewise hazard by time interval cox_model <- coxph(Surv(time, status) ~ age + gender + time_interval, data=data) # Create a new dataset with remaining patients, including their already survived time remaining_data <- data.frame(age = c(45, 55, 65), gender = as.factor(c("Male", "Female", "Female")), time_interval = as.factor(c(3, 4, 2)), time_survived = c(2, 3, 1)) # Calculate the predicted additional survival time: predicted_additional_survival_times <- numeric(length = nrow(remaining_data)) for (i in 1:nrow(remaining_data)) { time_seq <- seq(remaining_data[["time_survived"]][i], max(data[["time"]]), length.out = 100) patient_data <- expand.grid(time = time_seq, age = remaining_data[["age"]][i], gender = remaining_data[["gender"]][i], time_interval = remaining_data[["time_interval"]][i]) # Estimate the survival function for the remaining patient at each time point after their already survived time survival_fit <- survfit(cox_model, newdata=patient_data) surv_probs <- survival_fit[["surv"]] # Adjust the survival probabilities by removing the already_survived_time already_survived_time <- remaining_data[["time_survived"]][i] start_idx <- min(which(time_seq == already_survived_time)) adjusted_surv_probs <- c(1, surv_probs[-c(1:start_idx)]) / surv_probs[start_idx] # Calculate the expected additional survival time predicted_additional_survival_times[i] <- sum(adjusted_surv_probs * diff(c(already_survived_time, time_seq))) } predicted_additional_survival_times
fd2df0e5ba9ef39971ea694a769035d0
{ "intermediate": 0.32907235622406006, "beginner": 0.41735050082206726, "expert": 0.25357717275619507 }
1,941
so this script monitor the clipboard for any changes and translate copied japanese text to english using gpt and then show the translation on a created window. unfortunately the OAI endpoint we are going to use have a filter that rejects any prompts with chinese letters, and this dragged japanese kanjis along so we can’t have any prompts with japanese kanjis. i want you to make the script to encode the japanese text using html encode before sending it, and then giving prompt to gpt to decode the html before translating it. import time import pyperclip import openai import json import tkinter as tk import threading from tkinter import font, Menu from tkinter import font # Set your OpenAI API key and base openai.api_base = “” openai.api_key = “” # Toggleable features KEEP_LOGS = True # Initialize dictionary to store translated texts translated_dict = {} # Define JSON file to store translations jsonfile = “translations.json” # Load existing translations from JSON file try: with open(jsonfile, “r”, encoding=“utf-8”) as f: translated_dict = json.load(f) except FileNotFoundError: pass def translate_text(text_to_translate): prompt = f"Translate the following Japanese text to English:{text_to_translate}“ try: completion = openai.ChatCompletion.create( model=“gpt-3.5”, messages=[ { “role”: “user”, “content”: f”{prompt}“, } ], ) translated_text = ( completion[“choices”][0] .get(“message”) .get(“content”) .encode(“utf8”) .decode() ) except Exception as e: print(e, “No credits found in key. Close the window to exit…”) return translated_text def update_display(display, text): display.delete(1.0, tk.END) display.insert(tk.END, text) def retranslate(): untranslated_text = untranslated_textbox.get(1.0, tk.END).strip() if untranslated_text: pyperclip.copy(untranslated_text) def clipboard_monitor(): old_clipboard = “” while True: new_clipboard = pyperclip.paste() # Compare new_clipboard with old_clipboard to detect changes if new_clipboard != old_clipboard: old_clipboard = new_clipboard if new_clipboard in translated_dict: translated_text = translated_dict[new_clipboard] else: translated_text = translate_text(new_clipboard) translated_dict[new_clipboard] = translated_text with open(jsonfile, “w”, encoding=“utf-8”) as f: json.dump(translated_dict, f, ensure_ascii=False, indent=4) update_display(untranslated_textbox, new_clipboard) update_display(translated_textbox, translated_text) time.sleep(1) def toggle_translated(): current_bg = translated_textbox.cget(“background”) if current_bg == “black”: translated_textbox.configure(background=“white”) translated_textbox.delete(1.0, tk.END) translated_textbox.insert(tk.END, translated_dict[untranslated_textbox.get(1.0, tk.END).strip()]) else: translated_textbox.configure(background=“black”) translated_textbox.delete(1.0, tk.END) def set_always_on_top(): root.attributes(”-topmost", always_on_top_var.get()) def increase_opacity(): opacity = root.attributes(“-alpha”) opacity = min(opacity + 0.1, 1.0) root.attributes(“-alpha”, opacity) def decrease_opacity(): opacity = root.attributes(“-alpha”) opacity = max(opacity - 0.1, 0.1) root.attributes(“-alpha”, opacity) def font_window(): global current_font current_font = { “family”: font.Font(font=untranslated_textbox[“font”]).actual(“family”), “size”: font.Font(font=untranslated_textbox[“font”]).actual(“size”), “color”: untranslated_textbox.cget(“foreground”) } font_window = tk.Toplevel() font_window.title(“Font Settings”) font_window.geometry(“150x150”) font_family = tk.StringVar() font_family_label = tk.Label(font_window, text=“Font Family”) font_family_label.pack() font_family_entry = tk.Entry(font_window, textvariable=font_family) font_family_entry.insert(0, current_font[“family”]) font_family_entry.pack() font_size = tk.StringVar() font_size_label = tk.Label(font_window, text=“Font Size”) font_size_label.pack() font_size_entry = tk.Entry(font_window, textvariable=font_size) font_size_entry.insert(0, current_font[“size”]) font_size_entry.pack() font_color = tk.StringVar() font_color_label = tk.Label(font_window, text=“Font Color”) font_color_label.pack() font_color_entry = tk.Entry(font_window, textvariable=font_color) font_color_entry.insert(0, current_font[“color”]) font_color_entry.pack() def apply_changes(): new_font_family = font_family.get() or current_font[“family”] new_font_size = font_size.get() or current_font[“size”] new_font_color = font_color.get() or current_font[“color”] current_font = {“family”: new_font_family, “size”: new_font_size, “color”: new_font_color} untranslated_textbox.configure(font=(current_font[“family”], current_font[“size”]), fg=current_font[“color”]) translated_textbox.configure(font=(current_font[“family”], current_font[“size”]), fg=current_font[“color”]) font_window.destroy() apply_button = tk.Button(font_window, text=“Apply”, command=apply_changes) apply_button.pack() cancel_button = tk.Button(font_window, text=“Cancel”, command=font_window.destroy) cancel_button.pack() root = tk.Tk() root.title(“Clipboard Translation Monitor”) root.geometry(“400x200”) menu_bar = Menu(root) # Add Options menu options_menu = Menu(menu_bar, tearoff=0) menu_bar.add_cascade(label=“Options”, menu=options_menu) # Add Always on top option to Options menu always_on_top_var = tk.BooleanVar(value=False) options_menu.add_checkbutton(label=“Always on top”, variable=always_on_top_var, command=set_always_on_top) # Add Increase opacity option to Options menu options_menu.add_command(label=“Increase opacity”, command=increase_opacity) # Add Decrease opacity option to Options menu options_menu.add_command(label=“Decrease opacity”, command=decrease_opacity) # Add Font option to Options menu options_menu.add_command(label=“Font”, command=font_window) root.config(menu=menu_bar) paned_window = tk.PanedWindow(root, sashrelief=“groove”, sashwidth=5, orient=“horizontal”) paned_window.pack(expand=True, fill=“both”) untranslated_textbox = tk.Text(paned_window, wrap=“word”) paned_window.add(untranslated_textbox) translated_textbox = tk.Text(paned_window, wrap=“word”) paned_window.add(translated_textbox) retranslate_button = tk.Button(root, text=“Copy/Retranslate”, command=retranslate) retranslate_button.place(relx=0, rely=1, anchor=“sw”) toggle_button = tk.Button(root, text=“Hide/Show Translated Text”, command=toggle_translated) toggle_button.place(relx=1, rely=1, anchor=“se”) if name == “main”: print(“Starting Clipboard Translation Monitor…\n”) clipboard_monitor_thread = threading.Thread(target=clipboard_monitor) clipboard_monitor_thread.start() root.mainloop()
1f7d8159c753bd8b2a9c8a76ce7781f3
{ "intermediate": 0.3590927720069885, "beginner": 0.39236822724342346, "expert": 0.24853897094726562 }
1,942
hello
ca4bcb3faff1cab07b4a92f91a49b197
{ "intermediate": 0.32064199447631836, "beginner": 0.28176039457321167, "expert": 0.39759764075279236 }
1,943
i want to make an arpg game, what difficulties i may encounter in programming
ed657dc18106fa44109f455ff7fef3a4
{ "intermediate": 0.29066792130470276, "beginner": 0.4574936330318451, "expert": 0.25183841586112976 }
1,944
cmake link libraries to a static lib, substitue all $ sign to ~
298f0b84b0bab9213ec9772376b8cf82
{ "intermediate": 0.6394249200820923, "beginner": 0.2150605320930481, "expert": 0.1455145925283432 }
1,945
fivem scripting for some reason this does not work triggering from client.lua RegisterNetEvent('main-volleyball:client:animation') AddEventHandler('main-volleyball:client:animation', function(animationDirectory, animationName, speed) local playerPed = PlayerPedId() if (DoesEntityExist(playerPed) and not IsEntityDead(playerPed)) then loadAnimationDict(animationDirectory) TaskPlayAnim(playerPed, animationDirectory, animationName, speed, 4.0, 300, 51, 0, false, false, false) end end) TriggerEvent('main-volleyball:client:animation', "amb@prop_human_movie_bulb@base", "base", 4.0)
e88d53dc5c9ab593c6b4c4a24711d0c2
{ "intermediate": 0.43305638432502747, "beginner": 0.37333881855010986, "expert": 0.1936047524213791 }
1,946
so this script monitor the clipboard for any changes and translate copied japanese text to english using gpt and then show the translation on a created window. unfortunately the OAI endpoint we are going to use have a filter that rejects any prompts with chinese letters, and this dragged japanese kanjis along so we can’t have any prompts with japanese kanjis. i want you to make the script to encode the japanese text using javascript URI before sending it, and then giving prompt to gpt to decode the URI before translating it. import time import pyperclip import openai import json import tkinter as tk import threading from tkinter import font, Menu from tkinter import font # Set your OpenAI API key and base openai.api_base = “” openai.api_key = “” # Toggleable features KEEP_LOGS = True # Initialize dictionary to store translated texts translated_dict = {} # Define JSON file to store translations jsonfile = “translations.json” # Load existing translations from JSON file try: with open(jsonfile, “r”, encoding=“utf-8”) as f: translated_dict = json.load(f) except FileNotFoundError: pass def translate_text(text_to_translate): prompt = f"Translate the following Japanese text to English:{text_to_translate}“ try: completion = openai.ChatCompletion.create( model=“gpt-3.5”, messages=[ { “role”: “user”, “content”: f”{prompt}“, } ], ) translated_text = ( completion[“choices”][0] .get(“message”) .get(“content”) .encode(“utf8”) .decode() ) except Exception as e: print(e, “No credits found in key. Close the window to exit…”) return translated_text def update_display(display, text): display.delete(1.0, tk.END) display.insert(tk.END, text) def retranslate(): untranslated_text = untranslated_textbox.get(1.0, tk.END).strip() if untranslated_text: pyperclip.copy(untranslated_text) def clipboard_monitor(): old_clipboard = “” while True: new_clipboard = pyperclip.paste() # Compare new_clipboard with old_clipboard to detect changes if new_clipboard != old_clipboard: old_clipboard = new_clipboard if new_clipboard in translated_dict: translated_text = translated_dict[new_clipboard] else: translated_text = translate_text(new_clipboard) translated_dict[new_clipboard] = translated_text with open(jsonfile, “w”, encoding=“utf-8”) as f: json.dump(translated_dict, f, ensure_ascii=False, indent=4) update_display(untranslated_textbox, new_clipboard) update_display(translated_textbox, translated_text) time.sleep(1) def toggle_translated(): current_bg = translated_textbox.cget(“background”) if current_bg == “black”: translated_textbox.configure(background=“white”) translated_textbox.delete(1.0, tk.END) translated_textbox.insert(tk.END, translated_dict[untranslated_textbox.get(1.0, tk.END).strip()]) else: translated_textbox.configure(background=“black”) translated_textbox.delete(1.0, tk.END) def set_always_on_top(): root.attributes(”-topmost", always_on_top_var.get()) def increase_opacity(): opacity = root.attributes(“-alpha”) opacity = min(opacity + 0.1, 1.0) root.attributes(“-alpha”, opacity) def decrease_opacity(): opacity = root.attributes(“-alpha”) opacity = max(opacity - 0.1, 0.1) root.attributes(“-alpha”, opacity) def font_window(): global current_font current_font = { “family”: font.Font(font=untranslated_textbox[“font”]).actual(“family”), “size”: font.Font(font=untranslated_textbox[“font”]).actual(“size”), “color”: untranslated_textbox.cget(“foreground”) } font_window = tk.Toplevel() font_window.title(“Font Settings”) font_window.geometry(“150x150”) font_family = tk.StringVar() font_family_label = tk.Label(font_window, text=“Font Family”) font_family_label.pack() font_family_entry = tk.Entry(font_window, textvariable=font_family) font_family_entry.insert(0, current_font[“family”]) font_family_entry.pack() font_size = tk.StringVar() font_size_label = tk.Label(font_window, text=“Font Size”) font_size_label.pack() font_size_entry = tk.Entry(font_window, textvariable=font_size) font_size_entry.insert(0, current_font[“size”]) font_size_entry.pack() font_color = tk.StringVar() font_color_label = tk.Label(font_window, text=“Font Color”) font_color_label.pack() font_color_entry = tk.Entry(font_window, textvariable=font_color) font_color_entry.insert(0, current_font[“color”]) font_color_entry.pack() def apply_changes(): new_font_family = font_family.get() or current_font[“family”] new_font_size = font_size.get() or current_font[“size”] new_font_color = font_color.get() or current_font[“color”] current_font = {“family”: new_font_family, “size”: new_font_size, “color”: new_font_color} untranslated_textbox.configure(font=(current_font[“family”], current_font[“size”]), fg=current_font[“color”]) translated_textbox.configure(font=(current_font[“family”], current_font[“size”]), fg=current_font[“color”]) font_window.destroy() apply_button = tk.Button(font_window, text=“Apply”, command=apply_changes) apply_button.pack() cancel_button = tk.Button(font_window, text=“Cancel”, command=font_window.destroy) cancel_button.pack() root = tk.Tk() root.title(“Clipboard Translation Monitor”) root.geometry(“400x200”) menu_bar = Menu(root) # Add Options menu options_menu = Menu(menu_bar, tearoff=0) menu_bar.add_cascade(label=“Options”, menu=options_menu) # Add Always on top option to Options menu always_on_top_var = tk.BooleanVar(value=False) options_menu.add_checkbutton(label=“Always on top”, variable=always_on_top_var, command=set_always_on_top) # Add Increase opacity option to Options menu options_menu.add_command(label=“Increase opacity”, command=increase_opacity) # Add Decrease opacity option to Options menu options_menu.add_command(label=“Decrease opacity”, command=decrease_opacity) # Add Font option to Options menu options_menu.add_command(label=“Font”, command=font_window) root.config(menu=menu_bar) paned_window = tk.PanedWindow(root, sashrelief=“groove”, sashwidth=5, orient=“horizontal”) paned_window.pack(expand=True, fill=“both”) untranslated_textbox = tk.Text(paned_window, wrap=“word”) paned_window.add(untranslated_textbox) translated_textbox = tk.Text(paned_window, wrap=“word”) paned_window.add(translated_textbox) retranslate_button = tk.Button(root, text=“Copy/Retranslate”, command=retranslate) retranslate_button.place(relx=0, rely=1, anchor=“sw”) toggle_button = tk.Button(root, text=“Hide/Show Translated Text”, command=toggle_translated) toggle_button.place(relx=1, rely=1, anchor=“se”) if name == “main”: print(“Starting Clipboard Translation Monitor…\n”) clipboard_monitor_thread = threading.Thread(target=clipboard_monitor) clipboard_monitor_thread.start() root.mainloop()
715f5129389e61ced057b23dcb19200e
{ "intermediate": 0.3635990619659424, "beginner": 0.39620745182037354, "expert": 0.24019353091716766 }
1,947
find me the site that provides data on the most important military indicators
6ba9c6f7e5259b086d0dc729126557e6
{ "intermediate": 0.39788010716438293, "beginner": 0.2805005609989166, "expert": 0.32161933183670044 }
1,948
How can i send a file to you
8e9c09838e6ae2570bc1f05d5713fe61
{ "intermediate": 0.46846291422843933, "beginner": 0.19937783479690552, "expert": 0.3321593105792999 }
1,949
fivem scripting I'm trying to Task Play Anim "missfam4", "base" so its only upperbody and the animation stays until its cleared
e2c439e898c27d5f6c410245d634bab4
{ "intermediate": 0.2773245573043823, "beginner": 0.33371636271476746, "expert": 0.3889591693878174 }
1,950
fivem scripting I'm trying to Task Play Anim "missfam4", "base" so its only upperbody and the animation stays until its cleared
1dff534d6fc9d4cdb434288cb79eddae
{ "intermediate": 0.2773245573043823, "beginner": 0.33371636271476746, "expert": 0.3889591693878174 }
1,951
cmake link libraries to static library, while answering you substitu $ in your answer to -
a3f1d2ed94d6cbc08057ae0c06390ab2
{ "intermediate": 0.5432964563369751, "beginner": 0.2822819650173187, "expert": 0.17442165315151215 }
1,952
please improve this function setStep((currStep) => ++currStep);
3e59a305a32e8cd0672197c04d1c148a
{ "intermediate": 0.3264712691307068, "beginner": 0.3260366916656494, "expert": 0.3474920392036438 }
1,953
cmake iterate list
db37c01ec163d4a11974c4d48ac5c468
{ "intermediate": 0.3547442853450775, "beginner": 0.20683439075946808, "expert": 0.4384213089942932 }
1,954
Your task is to take the text I will be giving you, create a vocabulary that will include all the words in this text. The text is: "Once upon a time, in a land far, far away there was a brave knight named Sir Robert. Sir Robert had a quest to rescue the princess from the dragon’s lair. He set out on his trusty horse and fought the dragon with all his might. After a fierce battle, Sir Robert emerged victorious and rescued the princess. The kingdom rejoiced and Sir Robert was hailed a hero."
5210ae58618934e34d7596c30df1e330
{ "intermediate": 0.3197585642337799, "beginner": 0.4276563823223114, "expert": 0.2525849938392639 }
1,955
summarize this article: Horace's friend Publius Vergilius Maro, known in English as Virgil, was born in 70 BC and so was five years older than Horace. He was brought up on his father's farm at Mantua in North Italy, and completed his education in Rome and Naples. He belonged to a group of poets who celebrated in their work the first Roman emperor Augustus. Horace, who described Virgil as 'half of my soul', was also one of the group. Virgil's greatest poem was the Aeneid. It was in twelve books, begun in 29 BC and still unfinished at his death in 19 BC. Its central figure is Aeneas, the son of Venus and the Trojan Anchises. The story tells how he flees from the smoking ruins of Troy and travels to Italy where Destiny plans that he should found the Roman race. We now describe the events of that dreadful night in more detail than was possible in the Latin. On the night when their city fell the Trojans held joyful . celebrations, wrongly believing that the Greeks had given up their siege and departed. The whole of Troy was buried in slumber and wine. The ghost of Hector appeared to Aeneas as he lay sleeping. Aeneas was horribly shocked by his appearance, 58 evadunt escape; ardentem burning montes mountains er ipit rescues incensa burnt supersumus we survive mecum with me; condere found oram shore ignotas unknown; undis waves er rant wander; s ubeunt undergo Virgil and two Musesfor he was black with the dust through which Achilles had dragged him when he killed him. But Hector paid no attention to Aeneas' reaction, and told him that Troy was now in the enemy's hands. He ordered him to rescue the Trojan gods from the burning city and to sail away to found a new Troy in some other country. Aeneas was now thoroughly awakened by the noise of the fighting, and climbing to the top of his house he saw the flames which were sweeping through the city. Hector's instructions vanished from his mind and he ran into the streets where he fought with tremendous courage, killing many Greeks. A dreadful sight met his eyes as he reached the royal palace. He saw Achilles' son slaughter King Priam on the step of the altar itself. Aeneas' anger burned fiercely as he sought vengeance for the destruction ofTroy. But now his mother Venus appeared to him and reminded him that his duty was to his family. He must try, she said, to bring them to safety. Aeneas realized that she was right. There was no longer anything he could do for Troy. He rushed back to his house, gathered together his followers and made his way from the city. He bore on his shoulders his father, who carried the little statues of the household gods, and he held his son by the hand. His wife followed them as they set out on this terrifying journey. Suddenly Aeneas was aware that his wife was no longer behind him. Desperately he ran back into the city, now eerily still, calling her name again and again, but there was no answer. Finally her ghost appeared to him. She told him that she was dead. He must set out for the new land which awaited him. Three times Aeneas attempted to fling his arms around his wife. Three times his wife's ghost dissolved in his embrace like the light winds. He returned sadly to his companions who were safely hidden in a hollow valley in the mountains by Troy. A dangerous and uncertain future awaited them.
05a3af74ec8896c7d4070309979e9293
{ "intermediate": 0.18846121430397034, "beginner": 0.5385229587554932, "expert": 0.2730158567428589 }
1,956
hello world
d87ebd3c8bf2bd94e85d63b5f703d151
{ "intermediate": 0.35190486907958984, "beginner": 0.30643847584724426, "expert": 0.3416566252708435 }
1,957
fivem scripting I've got an event that triggers a server event how can i check on the server that both clients in a list triggered the same event
f1e4ef8c7c70fd0a60ec61def49ff857
{ "intermediate": 0.5086172819137573, "beginner": 0.23231881856918335, "expert": 0.2590639591217041 }
1,958
write a python script, draw a random picture
fe4150bcb9f17d7e26b67791f45b6838
{ "intermediate": 0.3205307722091675, "beginner": 0.3845492899417877, "expert": 0.2949199378490448 }
1,959
Привет подскажи как добавить еще один путь до файла, чтобы его архивировать сильно не изменяя метод createArchive: def createArchiveForExchange(self): archivePath = f'{squishinfo.testCase}/stmobile.zip' filePath = f'{squishinfo.testCase}/stmobile.db3' password = '969969' fs.createArchive(archivePath, filePath, password)
1c1c459a5e439df64b2de74063826a9e
{ "intermediate": 0.37477564811706543, "beginner": 0.28871721029281616, "expert": 0.3365071415901184 }
1,960
fivem scripting I've got an event that triggers a server event how can i check on the server that both clients in a list triggered the same event
aa32e551d2ce2c64f703c143f6ba19c8
{ "intermediate": 0.5086172819137573, "beginner": 0.23231881856918335, "expert": 0.2590639591217041 }
1,961
Как изменить количество файлов при архивировании не изменяя метод createArchive def createArchiveForExchange(self): archivePath = f'{squishinfo.testCase}/stmobile.zip' filePath = f'{squishinfo.testCase}/stmobile.db3' password = '969969' fs.createArchive(archivePath, filePath, password) def createArchive(archivePath, filePath, password): subprocess.run(['zip', '-j', '-P', password, archivePath, filePath])
cd5f3ea984d730e3f9f3f7922372d45e
{ "intermediate": 0.36133572459220886, "beginner": 0.35120242834091187, "expert": 0.28746187686920166 }
1,962
import socket import threading import tkinter as tk from tkinter import filedialog import logging logging.basicConfig(filename=‘TCPClient.log’, level=logging.INFO, format=‘%(asctime)s:%(levelname)s:%(message)s’) # 读取文件中的16进制报文 def read_hex_packets(file_path): packets = [] try: with open(file_path, “r”) as f: lines = f.readlines() for line in lines: line = line.strip() if not line: continue if len(line) % 2 == 1: line = “0” + line try: packet = bytes.fromhex(line) except ValueError: logging.error(“无效的报文格式: %s”, line) continue packets.append(packet) except IOError as e: logging.error(“读取文件 %s 失败: %s”, file_path, str(e)) return packets # 发送报文并打印发送和接收的报文 def send_packets(): # 获取输入的服务器ip和端口号 server_ip = server_ip_entry.get() server_port = int(server_port_entry.get()) # 获取是否开启"发送每一帧报文之后都等待服务器回传数据"功能的勾选状态 wait_for_response = wait_for_response_var.get() # 获取报文发送间隔 send_interval = int(send_interval_entry.get()) # 读取16进制报文 packets = read_hex_packets(packet_file_path) # 创建TCP客户端socket try: client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error as e: logging.error(“创建socket失败: %s”, str(e)) return try: # 连接服务器 client_socket.connect((server_ip, server_port)) # 清空发送和接收框 text.delete(1.
61b85a23f3b13eef2d40543d2075b7c2
{ "intermediate": 0.3673143982887268, "beginner": 0.3964357078075409, "expert": 0.23624996840953827 }
1,963
WHat is bipki&
2b7cc18c4542e7bf902eb2334e523635
{ "intermediate": 0.3605065941810608, "beginner": 0.2553963363170624, "expert": 0.38409706950187683 }
1,964
fivem scripting I have a variable which is set to "A" I want to check if the value is "A" then it triggers an event with arg "B" but if the variable is "B" then it triggers event with arg "A" pretty much the opposite value to what's given
4b08ba8b43fe7dfb61837bca00ea74f8
{ "intermediate": 0.19534827768802643, "beginner": 0.7075896263122559, "expert": 0.09706206619739532 }
1,965
C:\Users\zhangchenxi\python\TcpClient>python TcpClient.py File "C:\Users\zhangchenxi\python\TcpClient\TcpClient.py", line 29 except IOError as e: SyntaxError: expected 'except' or 'finally' block
5458824bd2d3fa2e75aae65c1d925ee7
{ "intermediate": 0.360595703125, "beginner": 0.403594046831131, "expert": 0.2358102649450302 }
1,966
import socket import threading import tkinter as tk from tkinter import filedialog import logging import time logging.basicConfig(filename='TCPClient.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s') packet_file_path = '' # 读取文件中的16进制报文 def read_hex_packets(file_path): packets = [] try: with open(file_path, "r") as f: lines = f.readlines() for line in lines: # 缩进块要注意缩进的空格数,通常为四个空格 line = line.strip() if not line: continue if len(line) % 2 == 1: line = "0" + line try: packet = bytes.fromhex(line) except ValueError: logging.error("无效的报文格式: %s", line) # continue packets.append(packet) except IOError as e: logging.error("读取文件 %s 失败: %s", file_path, str(e)) return packets # 发送报文并打印发送和接收的报文 def send_packets(): # 获取输入的服务器ip和端口号 server_ip = server_ip_entry.get() server_port = int(server_port_entry.get()) # 获取是否开启"发送每一帧报文之后都等待服务器回传数据"功能的勾选状态 wait_for_response = wait_for_response_var.get() # 获取报文发送间隔 send_interval = int(send_interval_entry.get()) # 读取16进制报文 packets = read_hex_packets(packet_file_path) # 创建TCP客户端socket try: client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error as e: logging.error("创建socket失败: %s", str(e)) return try: # 连接服务器 client_socket.connect((server_ip, server_port)) # 清空发送和接收框 text.delete(1.0,tk.END) response_text.delete(1.0,tk.END) for i, packet in enumerate(packets): # 发送报文 try: client_socket.sendall(packet) except socket.error as e: logging.error("发送第%d帧报文失败: %s", i+1, str(e)) continue logging.info("发送第%d帧报文: %s", i+1, packet.hex()) # 等待服务器回传 if wait_for_response: try: response_packet = client_socket.recv(1024) logging.info("收到第%d帧回传报文: %s", i+1, response_packet.hex()) response_text.insert(tk.END, response_packet.hex() + "\n") except socket.error as e: logging.error("接收第%d帧回传报文失败: %s", i+1, str(e)) # 等待一定时间再发送下一帧 if i != len(packets)-1: time.sleep(send_interval / 1000) except socket.error as e: logging.error(str(e)) finally: # 关闭socket连接 client_socket.close() # 打开文件对话框 def open_file_dialog(): global packet_file_path packet_file_path = filedialog.askopenfilename(filetypes=(("Text files", "*.txt"),)) file_path_label.config(text=packet_file_path) # 创建GUI界面 root = tk.Tk() root.title("TCP客户端") # 服务器ip和端口号输入框 server_frame = tk.Frame() server_frame.pack(side=tk.TOP, padx=10, pady=10) server_ip_label = tk.Label(server_frame, text="服务器IP: ") server_ip_label.pack(side=tk.LEFT) server_ip_entry = tk.Entry(server_frame, width=15) server_ip_entry.pack(side=tk.LEFT) server_port_label = tk.Label(server_frame, text="服务器端口号: ") server_port_label.pack(side=tk.LEFT) server_port_entry = tk.Entry(server_frame, width=5) server_port_entry.pack(side=tk.LEFT) # 选择报文文件和发送间隔输入框 file_frame = tk.Frame() file_frame.pack(side=tk.TOP, padx=10, pady=10) open_file_button = tk.Button(file_frame, text="选择报文文件", command=open_file_dialog) open_file_button.pack(side=tk.LEFT) file_path_label = tk.Label(file_frame, text="尚未选择文件") file_path_label.pack(side=tk.LEFT, padx=10) send_interval_label = tk.Label(file_frame, text="发送间隔(ms): ") send_interval_label.pack(side=tk.LEFT) send_interval_entry = tk.Entry(file_frame, width=5) send_interval_entry.pack(side=tk.LEFT) # "发送每一帧报文之后都等待服务器回传数据"勾选框 wait_for_response_var = tk.BooleanVar() wait_for_response_checkbox = tk.Checkbutton(root, text="发送每一帧报文之后都等待服务器回传数据", variable=wait_for_response_var) wait_for_response_checkbox.pack(side=tk.TOP) # 发送和接收框 text_frame = tk.Frame() text_frame.pack(side=tk.TOP, padx=10, pady=10) text = tk.Text(text_frame, height=10, width=50) text.pack(side=tk.LEFT) response_text = tk.Text(text_frame, height=10, width=50) response_text.pack(side=tk.RIGHT) # 发送按钮 send_button = tk.Button(root, text="发送", command=send_packets) send_button.pack(side=tk.BOTTOM, pady=10) root.mainloop()
f07e8388ec1f457b2c6601baca1f5916
{ "intermediate": 0.3158835470676422, "beginner": 0.5128027200698853, "expert": 0.17131371796131134 }
1,967
I need to load variables from a .env file and to load them in pydantic Setting fields
1de486f34361aca3f68f1cb71e2942b6
{ "intermediate": 0.2524210810661316, "beginner": 0.5455999970436096, "expert": 0.201978862285614 }
1,968
can you write python code
9d1a4fce1c4bc659cd5fcb522f1dd56e
{ "intermediate": 0.2844567596912384, "beginner": 0.38316458463668823, "expert": 0.33237865567207336 }
1,969
I need a roblox script.
657745b2d71f2e8e9c1ad2ab9054c257
{ "intermediate": 0.4354991018772125, "beginner": 0.3234768509864807, "expert": 0.24102407693862915 }
1,970
using excel vba search column G4 to G80 in all sheets of a workbook. If value of cell in column G is greater than 1499 and corresponding value in column F is not equal to "Grand Total", then copy matches found in column G to column I in sheet named Totals and also copy the corresponding value in column F for the matches found in column G to column H in the sheet named Totals
00532de2b52b79d6461ed7bba1ce97e6
{ "intermediate": 0.4869842231273651, "beginner": 0.2210671305656433, "expert": 0.29194867610931396 }
1,971
lua test = {['A'] = 1, ['B'] =2} how can i use math.random to randomly select one of items then print the values eg if selcts 'A' then it would print 1
57a341a652265c7058cfc6298a1d3fa1
{ "intermediate": 0.37238991260528564, "beginner": 0.36831116676330566, "expert": 0.2592989206314087 }
1,972
lua print the first value in a table but the table looks like this test = { ['A'] = 1, ['B'] = 2 }
83298b16c7f9677979f03dd2e1090f0f
{ "intermediate": 0.3650563955307007, "beginner": 0.30286648869514465, "expert": 0.33207711577415466 }
1,973
import socket import threading import tkinter as tk from tkinter import filedialog import logging import time logging.basicConfig(filename='TCPClient.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s') packet_file_path = '' # 读取文件中的16进制报文 def read_hex_packets(file_path): packets = [] try: with open(file_path, "r") as f: lines = f.readlines() for line in lines: # 缩进块要注意缩进的空格数,通常为四个空格 line = line.strip() if not line: continue try: packet = bytes.fromhex(line) except ValueError: logging.error("无效的报文格式: %s", line) continue packets.append(packet) except IOError as e: logging.error("读取文件 %s 失败: %s", file_path, str(e)) return packets # 发送报文并打印发送和接收的报文 def send_packets(): # 获取输入的服务器ip和端口号 server_ip = server_ip_entry.get() server_port = int(server_port_entry.get()) # 获取是否开启"发送每一帧报文之后都等待服务器回传数据"功能的勾选状态 wait_for_response = wait_for_response_var.get() # 获取报文发送间隔 send_interval = int(send_interval_entry.get()) # 读取16进制报文 packets = read_hex_packets(packet_file_path) # 创建TCP客户端socket try: client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error as e: logging.error("创建socket失败: %s", str(e)) return try: # 连接服务器 client_socket.connect((server_ip, server_port)) # 清空发送和接收框 text.delete(1.0,tk.END) response_text.delete(1.0,tk.END) for i, packet in enumerate(packets): # 发送报文 try: client_socket.sendall(packet) except socket.error as e: logging.error("发送第%d帧报文失败: %s", i+1, str(e)) text.insert(tk.END, "发送第%d帧报文失败: %s\n" % (i+1, str(e))) continue logging.info("发送第%d帧报文: %s", i+1, packet.hex()) text.insert(tk.END, "发送第%d帧报文: %s\n" % (i+1, packet.hex())) # 等待服务器回传 if wait_for_response: try: response_packet = client_socket.recv(1024) logging.info("收到第%d帧回传报文: %s", i+1, response_packet.hex()) response_text.insert(tk.END, response_packet.hex() + "\n") except socket.error as e: logging.error("接收第%d帧回传报文失败: %s", i+1, str(e)) response_text.insert(tk.END, "接收第%d帧回传报文失败: %s\n" % (i+1, str(e))) # 等待一定时间再发送下一帧 if i != len(packets)-1: time.sleep((send_interval + 500) / 1000) # 加上500ms的传输延迟 except socket.error as e: logging.error(str(e)) finally: # 关闭socket连接 client_socket.close() # 打开文件对话框 def open_file_dialog(): global packet_file_path packet_file_path = filedialog.askopenfilename(filetypes=(("Text files", "*.txt"),)) file_path_label.config(text=packet_file_path) # 创建GUI界面 root = tk.Tk() root.title("TCP客户端") # 服务器ip和端口号输入框 server_frame = tk.Frame() server_frame.pack(side=tk.TOP, padx=10, pady=10) server_ip_label = tk.Label(server_frame, text="服务器IP: ") server_ip_label.pack(side=tk.LEFT) server_ip_entry = tk.Entry(server_frame, width=15) server_ip_entry.pack(side=tk.LEFT) server_port_label = tk.Label(server_frame, text="服务器端口号: ") server_port_label.pack(side=tk.LEFT) server_port_entry = tk.Entry(server_frame, width=5) server_port_entry.pack(side=tk.LEFT) # 选择报文文件和发送间隔输入框 file_frame = tk.Frame() file_frame.pack(side=tk.TOP, padx=10, pady=10) open_file_button = tk.Button(file_frame, text="选择报文文件", command=open_file_dialog) open_file_button.pack(side=tk.LEFT) file_path_label = tk.Label(file_frame, text="尚未选择文件") file_path_label.pack(side=tk.LEFT, padx=10) send_interval_label = tk.Label(file_frame, text="发送间隔(ms): ") send_interval_label.pack(side=tk.LEFT) send_interval_entry = tk.Entry(file_frame, width=5) send_interval_entry.pack(side=tk.LEFT) # "发送每一帧报文之后都等待服务器回传数据"勾选框 wait_for_response_var = tk.BooleanVar() wait_for_response_checkbox = tk.Checkbutton(root, text="发送每一帧报文之后都等待服务器回传数据", variable=wait_for_response_var) wait_for_response_checkbox.pack(side=tk.TOP) # 发送和接收框 text_frame = tk.Frame() text_frame.pack(side=tk.TOP, padx=10, pady=10) text = tk.Text(text_frame, height=10, width=50) text.pack(side=tk.LEFT) response_text = tk.Text(text_frame, height=10, width=50) response_text.pack(side=tk.RIGHT) # 发送按钮 send_button = tk.Button(root, text="发送", command=send_packets) send_button.pack(side=tk.BOTTOM, pady=10) root.mainloop()
1713fdb8d46a5fd7ae53778396646e88
{ "intermediate": 0.4018629193305969, "beginner": 0.40898072719573975, "expert": 0.18915638327598572 }
1,974
To create a feature complete REST API for time scheduling. Tech requirements Use an SQL Database with an ORM Store data in related tables with foreign keys, don’t use json columns Use a high level Javascript or PHP framework (NestJS, Laravel, Symfony, …) Scope Only backend APIs are in the scope of this hackathon, No frontend HTML/JS/CSS should be created. User stories As a user, I would like to book an appointment As a user, I would like to select the date and see all available slots for this day As a user, I want to open the scheduling page and book appointments for multiple people at once (think of booking a haircut for yourself and your two kids) Business stories As a business administrator, I want to allow users to book for an appointment for available services. As a business administrator, I want to show a calendar to users, with all available slots for booking for all available services. As a business administrator, I want to configure my bookable schedule (bookable calendar) for different services all user stories below Example: As an owner of Hair saloon, I want to create an online bookable calendar for Men haircut, Women haircut and Hair colouring services. As a business administrator, I want to configure opening hours which can differ from day to day Example: Monday to Friday men haircut can be booked from 08:00 to 20:00, and Women haircut can be booked from 10:00 to 22:00 on Saturday, men haircut and women haircut, can be booked from 10:00 to 22:00 As a business administrator, I want to configure the duration of appointment that can be booked by users. Example: For Men haircut, An appointment can be of 30 minutes and For Women haircut, An appointment can be of 60 minutes. As a business administrator, I want to have a configurable break between appointments. Example: 5 minutes to clean the shop before next appointment of Men haircut, and 10 minutes to clean up before next Women haircut. As a business administrator, I want to allow users to book a time slot in x days in future but not for more than x days, where x is configurable number of days. Example: If a user tries to book a slot today, they can be allowed to book for 7 days in future but not for 8th day. As a business administrator, I want to configure one or more breaks (Off time) when a service can’t be booked. Example: Lunch break 12:00 - 13:00, Coffee Break 17:00 - 17:30 etc. As a business administrator, I want that a configurable number (1 or more) of clients can book one time slot. Example: A hair saloon, can serve 5 men haircuts and 3 women haircuts at same time. As a business administrator, I would like to specify date and time duration when business is would be off, these are different from weekly off. (These are planned off date and time duration.) Example: Men and women haircut service, would remain closed in second half Christmas, full day on Eid and Diwali. Women haircut service would remain closed on 25th January because our women’s hair expert is on leave. As a business administrator, I don’t want to allow users to book for an invalid slot. A requested slot is invalid - if requested slot is booked out if requested slot doesn’t exist in bookable calendar if requested slot falls between configured breaks if requested slot falls between configured break between appointments. if requested slot falls on a planned off date and time duration. As a business administrator, I want to create multiple scheduling events with totally different configurations (Men haircut, Women haircut, hair colouring, etc) As a business administrator, I want those different events to be totally separate As a business administrator, I want users to specify their personal details (First name, last name and email address) for each individual in booking request. Example: If a booking request is created for 3 people, booking request must contain 3 person’s details. As a business administrator, I want to allow a person to book multiple times without any unique restriction. Example: A user should be allowed to make booking for 3 people, even if they don’t know the person’s details, in such case they can copy their own details. As another developer I want peace of mind and just run the automated test suite and know that I did not break anything Acceptance criteria A time scheduling JSON based Rest API should be created 1 GET api which provides all data an SPA might need to display a calendar and a time selection. 1 POST api which creates a booking for 1 or more people for a single time slot API should accept single slot for which booking needs to be created. API should accept personal details (Email, First name and Last name) of one or multiple people to be booked. Implement automated testing that ensures the functionality of your code Important: don’t trust the frontend, validate the data so that the API returns an exception in case something does not fit into the schema or is already booked out For a men haircut booking should not be possible at 7am because its before the shop opens. booking at 8:02 should not be possible because its not fitting in any slot. booking at 12:15 should not be possible as its lunch break. … Seed your database with the following scheduling using seeder files Men Haircut slots for the next 7 days, Sunday off. from 08:00-20:00 Monday to Friday. from 10:00-22:00 Saturday. lunch break at 12:00-13:00. cleaning break at 15:00-16:00. max 3 clients per slot. slots every 10 minutes. 5 minutes cleanup break between slots. the third day starting from now is a public holiday. Woman Haircut slots for the next 7 days, Sunday off. lunch break at 12:00-13:00. from 08:00-20:00 Monday to Friday. from 10:00-22:00 Saturday. cleaning break at 15:00-16:00. slots every 1 hour. 10 minutes cleanup break. max 3 clients per slot. the third day starting from now is a public holiday. make tutorial to do this in code step by step in laravel ?
5f45e74d78c1f199b2dfa88ca4b062b3
{ "intermediate": 0.4434363543987274, "beginner": 0.33789414167404175, "expert": 0.21866951882839203 }
1,975
使用js 对数组{ “id”: 1, “topId”: 1, “pid”: 0, “level”: null, “name”: “七年级”, “tel”: null, “email”: null, “status”: 1, “createTime”: “2023-04-13 09:33:17”, “updateTime”: “2023-04-13 09:45:10”, “attr”: null, “type”: 10, “year”: “2022”, “graduate”: 1, “childNum”: 4, “children”: [ { “id”: 7, “topId”: 1, “pid”: 1, “level”: null, “name”: “1班”, “tel”: null, “email”: null, “status”: 1, “createTime”: “2023-04-13 10:00:05”, “updateTime”: “2023-04-13 12:22:31”, “attr”: null, “type”: 100, “year”: “2015”, “graduate”: 1, “childNum”: 0, “children”: null, “childOrgIds”: null }, { “id”: 8, “topId”: 1, “pid”: 1, “level”: null, “name”: “2班”, “tel”: null, “email”: null, “status”: 1, “createTime”: “2023-04-13 10:27:34”, “updateTime”: “2023-04-13 12:22:32”, “attr”: null, “type”: 100, “year”: “2015”, “graduate”: 1, “childNum”: 0, “children”: null, “childOrgIds”: null }, { “id”: 9, “topId”: 1, “pid”: 1, “level”: null, “name”: “3班”, “tel”: null, “email”: null, “status”: 1, “createTime”: “2023-04-14 01:49:18”, “updateTime”: “2023-04-14 01:49:18”, “attr”: null, “type”: 100, “year”: “2023”, “graduate”: 1, “childNum”: 0, “children”: null, “childOrgIds”: null }, { “id”: 10, “topId”: 1, “pid”: 1, “level”: null, “name”: “4班”, “tel”: null, “email”: null, “status”: 1, “createTime”: “2023-04-17 10:38:35”, “updateTime”: “2023-04-17 10:38:35”, “attr”: null, “type”: 100, “year”: “2023”, “graduate”: 1, “childNum”: 0, “children”: null, “childOrgIds”: null } ], “childOrgIds”: [ 7, 8, 9, 10 ] } 筛选出包含id为7或9的所有子类及父类元素
625cb052867ec02fc4fb2daf14da236c
{ "intermediate": 0.3252693712711334, "beginner": 0.5026655793190002, "expert": 0.17206509411334991 }
1,976
使用js对数组[{ "id": 0, "name": "负极", "childNum": 1, "childOrgIds": [ 7, 8, 9, 10 ], "children": [ { "id": 1, "topId": 1, "pid": 0, "level": null, "name": "七年级", "tel": null, "email": null, "status": 1, "createTime": "2023-04-13 09:33:17", "updateTime": "2023-04-13 09:45:10", "attr": null, "type": 10, "year": "2022", "graduate": 1, "childNum": 4, "children": [ { "id": 7, "topId": 1, "pid": 1, "level": null, "name": "1班", "tel": null, "email": null, "status": 1, "createTime": "2023-04-13 10:00:05", "updateTime": "2023-04-13 12:22:31", "attr": null, "type": 100, "year": "2015", "graduate": 1, "childNum": 0, "children": null, "childOrgIds": null }, { "id": 8, "topId": 1, "pid": 1, "level": null, "name": "2班", "tel": null, "email": null, "status": 1, "createTime": "2023-04-13 10:27:34", "updateTime": "2023-04-13 12:22:32", "attr": null, "type": 100, "year": "2015", "graduate": 1, "childNum": 0, "children": null, "childOrgIds": null }, { "id": 9, "topId": 1, "pid": 1, "level": null, "name": "3班", "tel": null, "email": null, "status": 1, "createTime": "2023-04-14 01:49:18", "updateTime": "2023-04-14 01:49:18", "attr": null, "type": 100, "year": "2023", "graduate": 1, "childNum": 0, "children": null, "childOrgIds": null }, { "id": 10, "topId": 1, "pid": 1, "level": null, "name": "4班", "tel": null, "email": null, "status": 1, "createTime": "2023-04-17 10:38:35", "updateTime": "2023-04-17 10:38:35", "attr": null, "type": 100, "year": "2023", "graduate": 1, "childNum": 0, "children": null, "childOrgIds": null } ], "childOrgIds": [ 7, 8, 9, 10 ] } ] }]去除不包含id为7或9的所有子类及父类元素 保持原数组结构
39be2efbe86eb39bab418528353dfc89
{ "intermediate": 0.25034525990486145, "beginner": 0.5356464385986328, "expert": 0.21400825679302216 }
1,977
Lua I've got a table that looks like local teams = {['A']= 0, ['B']= 0} how could I randomly select one of the values and save it to a variable
cb692e5ec59ae999bdc3af7b771948a7
{ "intermediate": 0.392364501953125, "beginner": 0.3918437659740448, "expert": 0.21579177677631378 }
1,978
fivem scripting I've got a table that looks like local teams = {['A']= 0, ['B']= 0} how could I randomly select one of the values and save it to a variable
41bfebf505db526de865b6d8b95bfc7b
{ "intermediate": 0.18631039559841156, "beginner": 0.5999653935432434, "expert": 0.21372421085834503 }
1,979
If while preparing dataset for an ML model and during feature extraction if month is extracted from the date column, then what's the advisable dtypes for the extracted column?
8c1d3185d6f5c6057deb289bb6c2c8fe
{ "intermediate": 0.15024791657924652, "beginner": 0.044889044016599655, "expert": 0.8048630356788635 }
1,980
import socket import threading import tkinter as tk from tkinter import filedialog import logging import time logging.basicConfig(filename='TCPClient.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s') packet_file_path = '' # 读取文件中的16进制报文 def read_hex_packets(file_path): packets = [] try: with open(file_path, "r") as f: lines = f.readlines() for line in lines: # 缩进块要注意缩进的空格数,通常为四个空格 line = line.strip() if not line: continue try: packet = bytes.fromhex(line) except ValueError: logging.error("无效的报文格式: %s", line) continue packets.append(packet) except IOError as e: logging.error("读取文件 %s 失败: %s", file_path, str(e)) return packets # 发送报文并打印发送和接收的报文 def send_packets(): # 获取输入的服务器ip和端口号 server_ip = server_ip_entry.get() server_port = int(server_port_entry.get()) # 获取是否开启"发送每一帧报文之后都等待服务器回传数据"功能的勾选状态 wait_for_response = wait_for_response_var.get() # 获取报文发送间隔 send_interval = int(send_interval_entry.get()) # 读取16进制报文 packets = read_hex_packets(packet_file_path) # 创建TCP客户端socket try: client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error as e: logging.error("创建socket失败: %s", str(e)) return try: # 连接服务器 client_socket.connect((server_ip, server_port)) # 清空发送和接收框 text.delete(1.0,tk.END) response_text.delete(1.0,tk.END) for i, packet in enumerate(packets): # 发送报文 try: client_socket.sendall(packet) except socket.error as e: logging.error("发送第%d帧报文失败: %s", i+1, str(e)) text.insert(tk.END, "发送第%d帧报文失败: %s\n" % (i+1, str(e))) continue logging.info("发送第%d帧报文: %s", i+1, packet.hex()) text.insert(tk.END, "发送第%d帧报文: %s\n" % (i+1, packet.hex())) # 等待服务器回传 if wait_for_response: try: response_packet = client_socket.recv(1024) logging.info("收到第%d帧回传报文: %s", i+1, response_packet.hex()) response_text.insert(tk.END, response_packet.hex() + "\n") except socket.error as e: logging.error("接收第%d帧回传报文失败: %s", i+1, str(e)) response_text.insert(tk.END, "接收第%d帧回传报文失败: %s\n" % (i+1, str(e))) # 等待一定时间再发送下一帧 if i != len(packets)-1: time.sleep((send_interval + 500) / 1000) # 加上500ms的传输延迟 except socket.error as e: logging.error(str(e)) finally: # 关闭socket连接 client_socket.close() # 打开文件对话框 def open_file_dialog(): global packet_file_path packet_file_path = filedialog.askopenfilename(filetypes=(("Text files", "*.txt"),)) file_path_label.config(text=packet_file_path) # 创建GUI界面 root = tk.Tk() root.title("TCP客户端") # 服务器ip和端口号输入框 server_frame = tk.Frame() server_frame.pack(side=tk.TOP, padx=10, pady=10) server_ip_label = tk.Label(server_frame, text="服务器IP: ") server_ip_label.pack(side=tk.LEFT) server_ip_entry = tk.Entry(server_frame, width=15) server_ip_entry.pack(side=tk.LEFT) server_port_label = tk.Label(server_frame, text="服务器端口号: ") server_port_label.pack(side=tk.LEFT) server_port_entry = tk.Entry(server_frame, width=5) server_port_entry.pack(side=tk.LEFT) # 选择报文文件和发送间隔输入框 file_frame = tk.Frame() file_frame.pack(side=tk.TOP, padx=10, pady=10) open_file_button = tk.Button(file_frame, text="选择报文文件", command=open_file_dialog) open_file_button.pack(side=tk.LEFT) file_path_label = tk.Label(file_frame, text="尚未选择文件") file_path_label.pack(side=tk.LEFT, padx=10) send_interval_label = tk.Label(file_frame, text="发送间隔(ms): ") send_interval_label.pack(side=tk.LEFT) send_interval_entry = tk.Entry(file_frame, width=5) send_interval_entry.pack(side=tk.LEFT) # "发送每一帧报文之后都等待服务器回传数据"勾选框 wait_for_response_var = tk.BooleanVar() wait_for_response_checkbox = tk.Checkbutton(root, text="发送每一帧报文之后都等待服务器回传数据", variable=wait_for_response_var) wait_for_response_checkbox.pack(side=tk.TOP) # 发送和接收框 text_frame = tk.Frame() text_frame.pack(side=tk.TOP, padx=10, pady=10) text = tk.Text(text_frame, height=10, width=50) text.pack(side=tk.LEFT) response_text = tk.Text(text_frame, height=10, width=50) response_text.pack(side=tk.RIGHT) # 发送按钮 send_button = tk.Button(root, text="发送", command=send_packets) send_button.pack(side=tk.BOTTOM, pady=10) root.mainloop()
749ff678ad7837db93b5e53ef108309d
{ "intermediate": 0.4018629193305969, "beginner": 0.40898072719573975, "expert": 0.18915638327598572 }
1,981
4, 0, 0, 0, 0, 0, 0, 0, 0 0, -2, -2, 0, 0, -2, -2, 0 0, -2, -2, 0, 0, -2, -2, 0 0, 0, -2, -2, 0, 0, -2, 2 0, 2, 0, 2, 0, -2, 0,2 0, 0, 2, -2, 0, 0, 2, 2 0, 2, 0, -2, 0, -2, 0, -2 0, 0, 0, 0, -4, 0, 0, 0 0, 2, -2, 0, 0, 2, 2, 0 public class Project_4 { public static void main(String[] args) { System.out.println("The following S-box will be referenced for the questions below: "); System.out.println("input | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111"); System.out.println("------------------------------------------------------"); System.out.println("output | 110 | 101 | 001 | 000 | 011 | 010 | 111 | 100\n"); System.out.println("In terms of hexadecimal notation, the S-box is given by: "); System.out.println("input | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7"); System.out.println("--------------------------------------"); System.out.println("output | 6 | 5 | 1 | 0 | 3 | 2 | 7 | 4"); int[][] input = {{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}}; int[][] output = {{1,1,0},{1,0,1},{0,0,1},{0,0,0},{0,1,1},{0,1,0},{1,1,1},{1,0,0}}; int[] sbox = {0x6, 0x5, 0x1, 0x0, 0x3, 0x2, 0x7, 0x4}; int[][] nlat = new int [8][8]; for(int i = 0; i < 8; i++) { for(int j = 0; j < 8; j++) { nlat[i][j] = lat(input,output,sbox, i, j) ; System.out.println(nlat[i][j]); } } } public static int lat() { } } make. my program print this
fb1bcd8227065a2695ce6ee2ca9d90c4
{ "intermediate": 0.2922404110431671, "beginner": 0.35054194927215576, "expert": 0.3572176396846771 }
1,982
write a unity script that can calculate an object's position, rotation and scale as if it were parented to some other object
408939d9040c003b3cd337567bc6ea4e
{ "intermediate": 0.35426127910614014, "beginner": 0.08695176243782043, "expert": 0.558786928653717 }
1,983
import socket import threading import tkinter as tk from tkinter import filedialog import logging import time logging.basicConfig(filename='TCPClient.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s') packet_file_path = '' # 读取文件中的16进制报文 def read_hex_packets(file_path): packets = [] try: with open(file_path, "r") as f: lines = f.readlines() for line in lines: # 缩进块要注意缩进的空格数,通常为四个空格 line = line.strip() if not line: continue try: packet = bytes.fromhex(line) except ValueError: logging.error("无效的报文格式: %s", line) continue packets.append(packet) except IOError as e: logging.error("读取文件 %s 失败: %s", file_path, str(e)) return packets # 发送报文并打印发送和接收的报文 def send_packets(): # 获取输入的服务器ip和端口号 server_ip = server_ip_entry.get() server_port = int(server_port_entry.get()) # 获取是否开启"发送每一帧报文之后都等待服务器回传数据"功能的勾选状态 wait_for_response = wait_for_response_var.get() # 获取报文发送间隔 send_interval = int(send_interval_entry.get()) # 读取16进制报文 packets = read_hex_packets(packet_file_path) # 创建TCP客户端socket try: client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error as e: logging.error("创建socket失败: %s", str(e)) return try: # 连接服务器 client_socket.connect((server_ip, server_port)) # 清空发送和接收框 text.delete(1.0,tk.END) response_text.delete(1.0,tk.END) for i, packet in enumerate(packets): # 发送报文 try: client_socket.sendall(packet) except socket.error as e: logging.error("发送第%d帧报文失败: %s", i+1, str(e)) text.insert(tk.END, "发送第%d帧报文失败: %s\n" % (i+1, str(e))) continue logging.info("发送第%d帧报文: %s", i+1, packet.hex()) text.insert(tk.END, "发送第%d帧报文: %s\n" % (i+1, packet.hex())) # 等待服务器回传 if wait_for_response: try: response_packet = client_socket.recv(1024) logging.info("收到第%d帧回传报文: %s", i+1, response_packet.hex()) response_text.insert(tk.END, response_packet.hex() + "\n") except socket.error as e: logging.error("接收第%d帧回传报文失败: %s", i+1, str(e)) response_text.insert(tk.END, "接收第%d帧回传报文失败: %s\n" % (i+1, str(e))) # 等待一定时间再发送下一帧 if i != len(packets)-1: time.sleep((send_interval + 500) / 1000) # 加上500ms的传输延迟 except socket.error as e: logging.error(str(e)) finally: # 关闭socket连接 client_socket.close() # 打开文件对话框 def open_file_dialog(): global packet_file_path packet_file_path = filedialog.askopenfilename(filetypes=(("Text files", "*.txt"),)) file_path_label.config(text=packet_file_path) # 创建GUI界面 root = tk.Tk() root.title("TCP客户端") # 服务器ip和端口号输入框 server_frame = tk.Frame() server_frame.pack(side=tk.TOP, padx=10, pady=10) server_ip_label = tk.Label(server_frame, text="服务器IP: ") server_ip_label.pack(side=tk.LEFT) server_ip_entry = tk.Entry(server_frame, width=15) server_ip_entry.pack(side=tk.LEFT) server_port_label = tk.Label(server_frame, text="服务器端口号: ") server_port_label.pack(side=tk.LEFT) server_port_entry = tk.Entry(server_frame, width=5) server_port_entry.pack(side=tk.LEFT) # 选择报文文件和发送间隔输入框 file_frame = tk.Frame() file_frame.pack(side=tk.TOP, padx=10, pady=10) open_file_button = tk.Button(file_frame, text="选择报文文件", command=open_file_dialog) open_file_button.pack(side=tk.LEFT) file_path_label = tk.Label(file_frame, text="尚未选择文件") file_path_label.pack(side=tk.LEFT, padx=10) send_interval_label = tk.Label(file_frame, text="发送间隔(ms): ") send_interval_label.pack(side=tk.LEFT) send_interval_entry = tk.Entry(file_frame, width=5) send_interval_entry.pack(side=tk.LEFT) # "发送每一帧报文之后都等待服务器回传数据"勾选框 wait_for_response_var = tk.BooleanVar() wait_for_response_checkbox = tk.Checkbutton(root, text="发送每一帧报文之后都等待服务器回传数据", variable=wait_for_response_var) wait_for_response_checkbox.pack(side=tk.TOP) # 发送和接收框 text_frame = tk.Frame() text_frame.pack(side=tk.TOP, padx=10, pady=10) text = tk.Text(text_frame, height=10, width=50) text.pack(side=tk.LEFT) response_text = tk.Text(text_frame, height=10, width=50) response_text.pack(side=tk.RIGHT) # 发送按钮 send_button = tk.Button(root, text="发送", command=send_packets) send_button.pack(side=tk.BOTTOM, pady=10) root.mainloop()
186a6a745a727dec867c7a4e70b67fb5
{ "intermediate": 0.4018629193305969, "beginner": 0.40898072719573975, "expert": 0.18915638327598572 }
1,984
fivem scripting how can i draw an 'A' symbol and also a 'B' symbol
73a70f8d8ae76ab6c6408b69ff47504b
{ "intermediate": 0.36391180753707886, "beginner": 0.3409894108772278, "expert": 0.29509884119033813 }
1,985
fivem scripting how can i draw an ‘A’ marker and also a ‘B’ marker
94d789cd7befa5389d97350c5e3aff64
{ "intermediate": 0.3175974190235138, "beginner": 0.3933362662792206, "expert": 0.2890664041042328 }
1,986
can you write me the code for my own custom gas zone at these coordinates x=8146.12 y=9137.89 and x=8193.26 y=9047.49 using this code as a reference { "Areas": [ { "AreaName": "Ship-SW", "Type": "ContaminatedArea_Static", "TriggerType": "ContaminatedTrigger", "Data": { "Pos": [ 13684, 0, 11073 ], "Radius": 100, "PosHeight": 22, "NegHeight": 10, "InnerRingCount": 1, "InnerPartDist": 50, "OuterRingToggle": 1, "OuterPartDist": 50, "OuterOffset": 0, "VerticalLayers": 0, "VerticalOffset": 0, "ParticleName": "graphics/particles/contaminated_area_gas_bigass" }, "PlayerData": { "AroundPartName": "graphics/particles/contaminated_area_gas_around", "TinyPartName": "graphics/particles/contaminated_area_gas_around_tiny", "PPERequesterType": "PPERequester_ContaminatedAreaTint" } }, { "AreaName": "Ship-NE", "Type": "ContaminatedArea_Static", "TriggerType": "ContaminatedTrigger", "Data": { "Pos": [ 13881, 0, 11172 ], "Radius": 100, "PosHeight": 26, "NegHeight": 10, "InnerRingCount": 1, "InnerPartDist": 50, "OuterRingToggle": 1, "OuterPartDist": 50, "OuterOffset": 0, "VerticalLayers": 0, "VerticalOffset": 0, "ParticleName": "graphics/particles/contaminated_area_gas_bigass" }, "PlayerData": { "AroundPartName": "graphics/particles/contaminated_area_gas_around", "TinyPartName": "graphics/particles/contaminated_area_gas_around_tiny", "PPERequesterType": "PPERequester_ContaminatedAreaTint" } }, { "AreaName": "Ship-Central", "Type": "ContaminatedArea_Static", "TriggerType": "ContaminatedTrigger", "Data": { "Pos": [ 13752, 0, 11164 ], "Radius": 100, "PosHeight": 22, "NegHeight": 2, "InnerRingCount": 1, "InnerPartDist": 50, "OuterRingToggle": 1, "OuterPartDist": 60, "OuterOffset": 0, "VerticalLayers": 0, "VerticalOffset": 0, "ParticleName": "graphics/particles/contaminated_area_gas_bigass" }, "PlayerData": { "AroundPartName": "graphics/particles/contaminated_area_gas_around", "TinyPartName": "graphics/particles/contaminated_area_gas_around_tiny", "PPERequesterType": "PPERequester_ContaminatedAreaTint" } }, { "AreaName": "Pavlovo-North", "Type": "ContaminatedArea_Static", "TriggerType": "ContaminatedTrigger", "Data": { "Pos": [ 2043, 0, 3485 ], "Radius": 150, "PosHeight": 25, "NegHeight": 20, "InnerRingCount": 2, "InnerPartDist": 50, "OuterRingToggle": 1, "OuterPartDist": 40, "OuterOffset": 0, "VerticalLayers": 0, "VerticalOffset": 0, "ParticleName": "graphics/particles/contaminated_area_gas_bigass" }, "PlayerData": { "AroundPartName": "graphics/particles/contaminated_area_gas_around", "TinyPartName": "graphics/particles/contaminated_area_gas_around_tiny", "PPERequesterType": "PPERequester_ContaminatedAreaTint" } }, { "AreaName": "Pavlovo-South", "Type": "ContaminatedArea_Static", "TriggerType": "ContaminatedTrigger", "Data": { "Pos": [ 2164, 0, 3335 ], "Radius": 150, "PosHeight": 11, "NegHeight": 10, "InnerRingCount": 2, "InnerPartDist": 50, "OuterRingToggle": 1, "OuterPartDist": 40, "OuterOffset": 0, "VerticalLayers": 0, "VerticalOffset": 0, "ParticleName": "graphics/particles/contaminated_area_gas_bigass" }, "PlayerData": { "AroundPartName": "graphics/particles/contaminated_area_gas_around", "TinyPartName": "graphics/particles/contaminated_area_gas_around_tiny", "PPERequesterType": "PPERequester_ContaminatedAreaTint" } } ], "SafePositions":[ [434, 13624], [360, 10986], [1412, 13505], [1290, 11773], [5742, 8568], [4191, 4620], [4949, 6569], [1018, 7138], [5041, 2640], [6895, 7915], [6128, 8120], [4422, 8117], [2811, 10209], [1954, 2417], [3633, 8708], [5222, 5737], [3546, 2630], [2373, 5516], [2462, 6879], [1653, 3600], [11774, 14570], [8228, 9345], [11100, 13400], [9333, 8697], [11513, 12203], [4955, 10603], [5090, 15054], [6513, 14579], [3483, 14941], [4016, 11194], [7607, 12384], [4307, 9528], [3266, 12352], [4432, 13285], [5473, 12455], [9731, 13685], [2745, 7784], [8492, 14128], [3501, 13292], [7912, 10943], [4165, 10134], [10536, 7871], [1467, 14288], [5479, 9709], [9453, 11963], [319, 9212], [8009, 14843], [7206, 7158], [12303, 13598], [3435, 5959], [4060, 12050], [6633, 2988], [870, 2095], [10286, 9071], [10371, 5690] ] }
9cff0893e1aa91357f87a9e1b3e719bc
{ "intermediate": 0.2649122178554535, "beginner": 0.46671062707901, "expert": 0.2683771550655365 }
1,987
fivem scripting how to create a marker
cf4468cbe195688b994ff03658c18796
{ "intermediate": 0.26754826307296753, "beginner": 0.40186816453933716, "expert": 0.33058351278305054 }
1,988
Can you help me create website?
f919ccc012de1344a6e37bdaeeecbfb4
{ "intermediate": 0.3873770236968994, "beginner": 0.2661164402961731, "expert": 0.3465065360069275 }
1,989
java code to record and replay mouse movements in a thread with shif + p as start and shift + L as stop commands. detect screen size first and write every recording to file as hashmap, at app start load hashmap as table entries and show all recordings in a gui table list ready to be replayed by click on it.
8136fda6374b8b7211623a16dabf0ac4
{ "intermediate": 0.6522871255874634, "beginner": 0.09821394830942154, "expert": 0.24949891865253448 }
1,990
in python, make a machine learning script that predcits a gcrash game based on the past 35 games. Make a safe number to bet on and a risky number. Data is: [2.2, 1.47, 10.49, 5.41, 3.95, 3.44, 2.15, 5.26, 1.0, 3.11, 14.39, 1.7, 1.1, 3.67, 3.91, 3.78, 1.03, 4.86, 2.67, 1.23, 2.49, 1.01, 4.25, 4.21, 1.35, 2.53, 8.61, 1.06, 1.03, 1.82, 2.85, 5.29, 1.01, 1.22, 6.97]
2ba77f704330e22c80ad9c2dc1d48857
{ "intermediate": 0.1547577977180481, "beginner": 0.14253561198711395, "expert": 0.7027065753936768 }
1,991
На python сделать менеджер слушателей, которые получают и отдают данные через rabbitmq
9e4f9a4ef3fb6e575aa456d4a52ed473
{ "intermediate": 0.37239202857017517, "beginner": 0.2577328681945801, "expert": 0.36987507343292236 }
1,992
Make a script that when you hold down click, a hat spins around where the mouse is, when its not spinning, it is underneath the player.
12e4e63e7607aee6b748b5b8fc054381
{ "intermediate": 0.3050489127635956, "beginner": 0.09849227964878082, "expert": 0.5964588522911072 }
1,993
In an oncology clinical trial, how to predict additional survival time for remaining patients who have been observed for some time and still alive based on data observed up to date? Taking into below considerations of baseline characteristics of the patients who are still alive, like age and gender, and the death hazard varies over time, so piecewise hazard by time interval should be used. Please provide the R software code with explanation step by step. In the R code, please never use $ character, and replace it with "[[" and "]]"
bd12999c747d8723c7bb3d9be27d0650
{ "intermediate": 0.35998237133026123, "beginner": 0.25705283880233765, "expert": 0.3829648494720459 }
1,994
Error CS1061 "PrintRange" does not contain a definition for "EndPage" nor an accessible extension method "EndPage" that accepts a first argument of type "PrintRange" (missing using directive or assembly reference?).
9f7efe799b2abcb0ffc4dec2cf9c89b9
{ "intermediate": 0.36757487058639526, "beginner": 0.4631487727165222, "expert": 0.16927635669708252 }
1,995
rest/insight/1.0/iql resultPerPage all record
08bee083f82370257c13ee4e534b4a03
{ "intermediate": 0.32389649748802185, "beginner": 0.3345015347003937, "expert": 0.34160202741622925 }
1,996
write me a simple pymavlink and pymavswarm code which does the following i have one master drone and one follower which is connected to the telemetry which is connected to the gcs. i want to send on coordinate set to the master drone and tthe master drone should go to that coordinate and the follower drone should follow irt. i only want one telemetry connection and in the telemetry connection, i have my 2 drones connected already through unique sysid .
7eff7a881e2a14d2a69711ce1408e1b5
{ "intermediate": 0.5034584999084473, "beginner": 0.18976330757141113, "expert": 0.3067781925201416 }
1,997
chatGPT, I need you to produce the code necessary in Python that will take a .eml file and extract it's contents to simple text.
096a8da28067d6342bf61bfdc648b7f5
{ "intermediate": 0.5804681777954102, "beginner": 0.1907549351453781, "expert": 0.22877688705921173 }
1,998
Write an HTML Programming code of e-shop page
9353f351f194c861c037ee895fd1b371
{ "intermediate": 0.3300081491470337, "beginner": 0.33968019485473633, "expert": 0.33031165599823 }
1,999
public delegate void OnPrintEndEventHandler(); public delegate void OnPrintCorrectlyEventHandler(); public static void PrintString(string s, string font = "Times New Roman", int fontSize = 12, int xMargin = 0, int yMargin = 0, OnPrintEndEventHandler OnPrintEnd = null, OnPrintCorrectlyEventHandler OnPrintCorrectly = null) { int linesPrinted = 0; int pagesPrinted = 1; bool multiPage = false; string[] str = s.Split('\n'); PrintDocument p = new PrintDocument(); float y2Margin = p.DefaultPageSettings.PrintableArea.Height - yMargin; float x2Margin = p.DefaultPageSettings.PrintableArea.Width - xMargin; int lastPrintedPage = -1; p.PrintPage += delegate (object sender1, PrintPageEventArgs e1) { Font myFont = new Font( font, fontSize, System.Drawing.FontStyle.Bold); float lineHeight = myFont.GetHeight(e1.Graphics) + 4; float yLineTop = yMargin; int numLines = s.Count(c => c.Equals('\n')) + 1; e1.HasMorePages = false; while (linesPrinted < numLines) { if (yLineTop + lineHeight > y2Margin) { e1.HasMorePages = true; multiPage = true; pagesPrinted = PrintPageLine(font, yMargin, x2Margin, e1, pagesPrinted, y2Margin); return; } e1.Graphics.DrawString( str[linesPrinted], myFont, new SolidBrush(Color.Black), new PointF(xMargin, yLineTop)); linesPrinted++; yLineTop += lineHeight; } if (multiPage) { PrintPageLine(font, yMargin, x2Margin, e1, pagesPrinted, y2Margin); } lastPrintedPage = e1.PageSettings.PrinterSettings.ToPage - 1; }; if (OnPrintEnd != null || OnPrintCorrectly != null) { p.EndPrint += (o, e) => { OnPrintEnd?.Invoke(); if (lastPrintedPage == p.PrinterSettings.MaximumPage - 1) { OnPrintCorrectly?.Invoke(); } }; } try { p.Print(); } catch (Exception ex) { Log.Error(ex); } }
29e9813b2c5248782bedc031e3e4d60e
{ "intermediate": 0.35445159673690796, "beginner": 0.5078478455543518, "expert": 0.13770058751106262 }
2,000
write an programing code of Javascript. code is about when users input a word, the programing can inquiry whether the word is exist in the content of a excel.
c4211409c6955b7702aa01732ef7c69e
{ "intermediate": 0.48769837617874146, "beginner": 0.30295470356941223, "expert": 0.2093469798564911 }
2,001
import { useCallback, useMemo } from 'react'; import { useAppDispatch } from '@/shared/hooks'; import { popupsActions } from '../../model'; import { POPUPS } from '../../config'; export function useAddCustomer() { const dispatch = useAppDispatch(); const addCustomerPopup = useMemo( () => ({ name: POPUPS.addCustomer, onClose: () => dispatch(popupsActions.close(addCustomerPopup)), }), [dispatch] ); return useCallback( () => dispatch(popupsActions.open(addCustomerPopup)), [dispatch, addCustomerPopup] ); } ient.js:1 A non-serializable value was detected in an action, in the path: `payload.onClose`. Value: ()=>dispatch(_model__WEBPACK_IMPORTED_MODULE_2__.popupsActions.close(addCustomerPopup)) Take a look at the logic that dispatched this action: {type: 'popups/close', payload: {…}}payload: {name: 'addCustomer', onClose: ƒ}type: "popups/close"[[Prototype]]: Object (See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants) (To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data) c
95a75a2beae679e8545aab78d4095be5
{ "intermediate": 0.71177077293396, "beginner": 0.17357943952083588, "expert": 0.11464983969926834 }
2,002
in ssms (sql), how do I delete records across multiple joined tables? please give an example
1982286da8867a19833ac5120d8a2ffa
{ "intermediate": 0.5427967309951782, "beginner": 0.26109081506729126, "expert": 0.19611237943172455 }
2,003
What element does gradle.textbox create
ae0997973b65811dd820976134dc122e
{ "intermediate": 0.39545848965644836, "beginner": 0.184601292014122, "expert": 0.41994017362594604 }
2,004
import socket import tkinter as tk from tkinter import messagebox class TcpClientApp(tk.Frame): def init(self, master=None): super().__init__(master) self.master = master self.master.title("TCP Client Application") self.master.geometry("600x600") self.create_widgets() self.client_socket = None def create_widgets(self): # create message label and textbox self.message_label = tk.Label(self.master, text="Message") self.message_label.pack(pady=5) self.message_box = tk.Entry(self.master) self.message_box.pack(pady=5) # create send button self.send_button = tk.Button(self.master, text="Send", command=self.send_message) self.send_button.pack(pady=5) # create response label and textbox self.response_label = tk.Label(self.master, text="Response") self.response_label.pack(pady=5) self.response_box = tk.Text(self.master, width=50, height=10) self.response_box.pack(pady=5) # create connect and disconnect buttons self.connect_button = tk.Button(self.master, text="Connect", command=self.connect_to_server) self.connect_button.pack(pady=5) self.disconnect_button = tk.Button(self.master, text="Disconnect", command=self.disconnect_from_server, state=tk.DISABLED) self.disconnect_button.pack(pady=5) def connect_to_server(self): # Create a TCP/IP socket self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the server's IP address and port server_address = ('localhost', 10000) # REPLACE 'localhost' with the server's IP address try: self.client_socket.connect(server_address) except ConnectionRefusedError: messagebox.showwarning("Connection Error", "Could not connect to the server. " "Make sure the server is running and try again.") return # Inform the user self.response_box.insert(tk.END, f'Connected to {server_address[0]} on port {server_address[1]}\n') self.connect_button.config(state=tk.DISABLED) self.disconnect_button.config(state=tk.NORMAL) def disconnect_from_server(self): if not self.client_socket: return # Close the socket self.client_socket.close() self.client_socket = None # Inform the user self.response_box.insert(tk.END, 'Disconnected from the server\n') self.connect_button.config(state=tk.NORMAL) self.disconnect_button.config(state=tk.DISABLED) def send_message(self): if not self.client_socket: messagebox.showwarning("Connection Error", "You must connect to the server first.") return # Send data message = self.message_box.get() try: message_bytes = bytes.fromhex(message) except ValueError: messagebox.showwarning("Invalid Message", "The message is not valid hexadecimal. " "Please enter a valid hexadecimal string.") return self.client_socket.sendall(message_bytes) # Receive response response = self.client_socket.recv(4096) response_hex = response.hex() self.response_box.insert(tk.END, f'Sent: {message.upper()}\n') self.response_box.insert(tk.END, f'Received: {response_hex.upper()}\n') self.message_box.delete(0, tk.END) # Run the application if __name__ =='__main__': root = tk.Tk() app = TcpClientApp(root) app.pack() root.mainloop()
5cc90f2179b65760e3775d7cee1f3b73
{ "intermediate": 0.3023354709148407, "beginner": 0.5515502691268921, "expert": 0.1461142599582672 }
2,005
Hi
027c30199254e555e8b37f9be73ac6db
{ "intermediate": 0.33010533452033997, "beginner": 0.26984941959381104, "expert": 0.400045245885849 }