row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
17,482 | import { GridLayout } from 'react-grid-layout';
const MyGrid = () => {
return (
<GridLayout
className="layout"
cols={12}
rowHeight={30}
width={1200}
>
{/* Здесь добавьте ваши элементы */}
</GridLayout>
);
};
как мне сделать, чтобы высота полностью GridLayout была равна экрану, то есть 100%, а rowHeight на высоту так, чтобы во всей высоте помещалось 40 rowHeight | c22ed30c78ce30606c816aeb33a16e82 | {
"intermediate": 0.3774605989456177,
"beginner": 0.4354996979236603,
"expert": 0.18703973293304443
} |
17,483 | Traceback (most recent call last):
File "e:\桌面\spider\chongxin.py", line 138, in <module>
spider.exportToExcel(news)
File "e:\桌面\spider\chongxin.py", line 114, in exportToExcel
data["title"].append(article['title'])
KeyError: 'title'
import requests
import json
import re
from bs4 import BeautifulSoup
from datetime import datetime,timedelta
from typing import Union
import pandas as pd
class Main():
def init(self) -> None:
pass
def fetch(self, url) -> str:
headers = {
'accept':
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8',
'user-agent': 'application/json, text/javascript, /; q=0.01',
}
r = requests.get(url, headers=headers)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
def getDailyNews(self) -> list[dict[str, Union[str, list[dict[str, str]]]]]:
current_date = datetime.now()
news = []
for i in range(1):
new_date = current_date - timedelta(days=i)
formatted_date = new_date.strftime("%Y-%m-%d")
naviUrl = f'https://www.shobserver.com/staticsg/data/journal/{formatted_date}/navi.json'
try:
naviData = json.loads(self.fetch(naviUrl))
newsPages = naviData["pages"]
print(f'「解放日报」正在处理 {formatted_date} 的 {len(newsPages)} 版新闻…')
for newsPage in newsPages:
pageName = newsPage["pname"]
pageNo = newsPage["pnumber"]
articleList = newsPage["articleList"]
print(
f'「解放日报」{pageNo} 版 - {pageName} 共有 {len(articleList)} 条新闻')
for article in articleList:
title = article["title"]
subtitle = article["subtitle"]
aid = article["id"]
# 使用正则丢弃 title 含有广告的文章
if re.search(r'广告', title):
continue
articleContent, articlePictures = self.getArticle(
formatted_date, pageNo, aid)
news.append({
"id": f'{formatted_date}_{pageNo}-{aid}',
"title": title,
"subtitle": subtitle,
"content": articleContent,
"pictures": articlePictures
})
except Exception as e:
print(f'「解放日报」新闻列表获取失败!\n{e}')
return news
def getArticle(self, date, pageNo, aid) -> tuple[str, list[object]]:
articleUrl = f'https://www.shobserver.com/staticsg/data/journal/{date}/{pageNo}/article/{aid}.json'
articleData = json.loads(self.fetch(articleUrl))["article"]
articleContent = BeautifulSoup(articleData["content"], 'html.parser')
# 转换 <br> 为 \n
for br in articleContent.find_all("br"):
br.replace_with(" ")
articlePictures = []
articlePictureJson = json.loads(articleData["pincurls"])
for articlePicture in articlePictureJson:
url = articlePicture["url"]
name = articlePicture["name"]
author = articlePicture["author"]
ttile = articlePicture["ttile"]
articlePictures.append({
"url": url,
"alt": ttile,
"title": ttile,
"source": name,
"author": author
})
print(
f'「解放日报」已解析 {pageNo} 版 - {articleData["title"]} | 字数 {len(articleContent)} | 图片 {len(articlePictures)} 张'
)
return articleContent.get_text(), articlePictures
def exportToExcel(self, news):
data = {
# "date": getDailyNews().formatted_date,
"ID": [],
"标题": [],
# "副标题": [],
"内容": [],
# "图片 URL": [],
# "图片来源": [],
# "图片作者": []
}
for article in news:
data["ID"].append(article['id'])
data["title"].append(article['title'])
# data["副标题"].append(article["subtitle"])
data["input_content"].append(article['content'])
# pictures = article["pictures”]
# if pictures:
# picture = pictures[0]
# data[“图片 URL”].append(picture[“url”])
# data[“图片来源”].append(picture[“source”])
# data[“图片作者”].append(picture[“author”])
# else:
# data[“图片 URL”].append(“”)
# data[“图片来源”].append(“”)
# data[“图片作者”].append(“”)
df = pd.DataFrame(data)
df.to_excel("news_data.xlsx", index=False)
jfdaily_spider = Main()
if __name__ == '__main__':
spider = Main()
news = spider.getDailyNews()
spider.exportToExcel(news)
print(news)
怎么解决 | 113d64fb5f30b07404cda0364d3c2d55 | {
"intermediate": 0.3870784342288971,
"beginner": 0.48799118399620056,
"expert": 0.12493034452199936
} |
17,484 | I have a py file named test.py, in which I wrote a function called my_function(). the function returns a pandas dataframe. Now I open a xlsm file and want to use macro to call the test.py and run my_function(). Could you help write the vba code for me, thanks. | 52f97cc2de003ab2bb7fa4b6db822d5c | {
"intermediate": 0.4764171838760376,
"beginner": 0.39339762926101685,
"expert": 0.13018514215946198
} |
17,485 | please help to write a sql statement , joining 2 tables, with name 1 and 2, using left join | d392fbb09e707bd9c1da3a50749d2bc4 | {
"intermediate": 0.3626960515975952,
"beginner": 0.28266629576683044,
"expert": 0.35463762283325195
} |
17,486 | I have this code: def signal_generator(df):
if df is None or len(df) < 2:
return ''
signals = []
# Retrieve depth data
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
mark_price_data = client.ticker_price(symbol=symbol)
mark_price = float(mark_price_data['price']) if 'price' in mark_price_data else 0.0
buy_qty = sum(float(bid[1]) for bid in bid_depth)
sell_qty = sum(float(ask[1]) for ask in ask_depth)
Can you add in my code trading strategy which will give m esignal to buy and sell based on this algorithm : if buy_ qty > sell qty signals = bullish ,if sel qty > buy qty signals = bearish1
If signals == bullish and buy price < mark price return buy if signals == bearish and sell price > marl price return sell else return '' | cd95666eaa60bc3f9eff6b434a9d2092 | {
"intermediate": 0.2730695307254791,
"beginner": 0.25408580899238586,
"expert": 0.472844660282135
} |
17,487 | create a dockerfile based on this scriptimport os
import json
import undetected_chromedriver as uc
from selectorlib import Extractor
import csv
import urllib.parse
import logging
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
def setup_directories_and_files():
# Define the directories and files
config_dir = './data/config'
urls_dir = './data/urls'
templates_dir = './data/templates'
results_dir = './data/results'
uc_settings_file = os.path.join(config_dir, 'uc_settings.txt')
script_settings_file = os.path.join(config_dir, 'script_settings.txt')
urls_list_file = os.path.join(urls_dir, 'urls_list.txt')
urls_completed_file = os.path.join(urls_dir, 'urls_completed.txt')
urls_failed_file = os.path.join(urls_dir, 'urls_failed.txt')
# Create the directories if they do not exist
os.makedirs(config_dir, exist_ok=True)
os.makedirs(urls_dir, exist_ok=True)
os.makedirs(templates_dir, exist_ok=True)
os.makedirs(results_dir, exist_ok=True)
return config_dir, urls_dir, templates_dir, results_dir, uc_settings_file, script_settings_file, urls_list_file, urls_completed_file, urls_failed_file
config_dir, urls_dir, templates_dir, results_dir, uc_settings_file, script_settings_file, urls_list_file, urls_completed_file, urls_failed_file = setup_directories_and_files()
# Set up logging
logging.basicConfig(filename='scraping.log', level=logging.INFO, format='%(asctime)s %(levelname)s:%(message)s')
console = logging.StreamHandler()
console.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s %(levelname)s:%(message)s')
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
error_logger = logging.getLogger('error_logger')
error_handler = logging.FileHandler('errors.log')
error_formatter = logging.Formatter('%(asctime)s %(levelname)s:%(message)s')
error_handler.setFormatter(error_formatter)
error_logger.addHandler(error_handler)
error_logger.setLevel(logging.ERROR)
# Create the files if they do not exist
for file in [uc_settings_file, script_settings_file, urls_list_file, urls_completed_file, urls_failed_file]:
if not os.path.exists(file):
open(file, 'w').close()
# Read the settings from the uc_settings.txt and script_settings.txt files
with open(uc_settings_file, 'r') as file:
uc_settings = file.read().splitlines()
with open(script_settings_file, 'r') as file:
script_settings = file.read().splitlines()
# Read the list of URLs from the urls_list.txt file
with open(urls_list_file, 'r', encoding='utf-8') as file:
urls_list = file.read().splitlines()
def initialize_driver():
# Initialize undetected-chromedriver
options = uc.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--window-size=800,600')
options.add_argument('--window-position=0,0')
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--disable-plugins-discovery")
options.add_argument('--no-first-run')
options.add_argument('--no-service-autorun')
options.add_argument('--no-default-browser-check')
options.add_argument('--window-position=0,0')
options.add_argument("--disable-extensions")
options.add_argument("--disable-notifications")
options.add_argument('--no-sandbox')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--disable-dev-shm-usage')
options.add_experimental_option(
"prefs",
{
"credentials_enable_service": False,
"profile.password_manager_enabled": False,
"autofill.profile_enabled": False,
},
)
for setting in uc_settings:
options.add_argument(setting)
import shutil
driver = uc.Chrome(options=options)
return driver
def load_template(domain):
# Initialize selectorlib
template_file = os.path.join(templates_dir, f'{domain}.yml')
if os.path.exists(template_file):
logging.info(f'Template exists for domain: {domain}')
e = Extractor.from_yaml_file(template_file)
return e
else:
logging.warning(f'Template does not exist for domain: {domain}. Skipping URL: {url}')
return None
def scrape_data(driver, e, url):
driver.get(url)
data = e.extract(driver.page_source)
logging.info(f'Extracted data: {data}')
# Close the driver
driver.quit()
return data
def save_data(data, domain):
# Save the extracted data to {domain}_results.txt
with open(os.path.join(results_dir, f'{domain}_results.txt'), 'a') as file:
file.write(json.dumps(data) + '\n')
def scrape_url(url):
logging.info(f'Starting to scrape URL: {url}')
domain = urllib.parse.urlparse(url).netloc.split('.')[-2:-1][0]
driver = initialize_driver()
e = load_template(domain)
if e is not None:
try:
data = scrape_data(driver, e, url)
if data is not None:
save_data(data, domain)
logging.info(f'Successfully scraped URL: {url}')
return data
except Exception as e:
error_logger.error(f'Error occurred while scraping URL {url}: {e}')
return None
# Scrape the URLs sequentially
logging.info('Starting to scrape URLs sequentially')
for url in urls_list:
result = scrape_url(url)
if result:
with open(urls_completed_file, 'a', encoding='utf-8') as file:
if url.isascii():
file.write(url + '\n')
logging.info(f'Moved URL to urls_completed.txt: {url}')
else:
logging.warning(f'Skipped non-ASCII URL: {url}')
urls_list.remove(url)
else:
with open(urls_failed_file, 'a', encoding='utf-8') as file:
if url.isascii():
file.write(url + '\n')
logging.info(f'Moved URL to urls_failed.txt: {url}')
else:
logging.warning(f'Skipped non-ASCII URL: {url}')
urls_list.remove(url)
logging.info('Finished scraping URLs sequentially')
# Handle errors gracefully and continue with the next URL if an error occurs
import time
import random
for url in urls_list:
result = scrape_url(url)
# Add a delay between each request to avoid being blocked by the server
try:
min_delay, max_delay = map(int, script_settings)
time.sleep(random.uniform(min_delay, max_delay))
except ValueError:
error_logger.error("Error: script_settings contains invalid values")
except Exception as e:
error_logger.error(f'Error occurred: {e}') | 1f8fe6ef3715d40ae2db9b2ba6be3ef4 | {
"intermediate": 0.3500675559043884,
"beginner": 0.4597592055797577,
"expert": 0.19017328321933746
} |
17,488 | import requests
from datetime import datetime
from bs4 import BeautifulSoup
import pandas as pd
class NatureBrief:
def __init__(self) -> None:
self.start_date = datetime.now() # datetime.strptime('2023-06-06', '%Y-%m-%d')
pass
def fetch(self, url) -> str:
headers = {
'accept':
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'user-agent': 'application/json, text/javascript, */*; q=0.01',
}
r = requests.get(url, headers=headers)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
def get_today_articles(self, count: int = 3):
# 通过日期计算获取的文章数
current_date = datetime.now()
elapsed_time = current_date - self.start_date
article_count = (elapsed_time.days + 1) * count
# 获取对应数量的文章
total_page = self.get_total_page()
article_list = []
page_i = 1
while page_i < total_page and len(article_list) < article_count:
if page_i + 1 > total_page:
print('「NATURE BRIEF」历史文章已全部获取。无法获取更多...')
break
article_list += self.get_page(page_i)
page_i += 1
if len(article_list) >= article_count:
break
print(f'「NATURE BRIEF」共计获取 {len(article_list)} 篇文章')
# 抽取对应的文章
article_list = article_list[:article_count]
# 倒着获取 3 篇
article_list.reverse()
articles = []
count = 1
for article in article_list:
if count > count:
break
print(f'「NATURE BRIEF」正在获取第 {count} 篇文章: {article["title"]}')
article['text'] = self.get_article(article['link'])
articles.append(article)
count += 1
# 反转
articles.reverse()
return articles
def get_total_page(self):
print('「NATURE BRIEF」正在获取总页数...')
url = 'https://www.nature.com/nature/articles?type=news-in-brief'
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
pagination_items = soup.find_all('li', class_='c-pagination__item')
total_page = None
for item in pagination_items:
data_page = item.get('data-page')
if data_page and data_page.isdigit():
total_page = data_page
print(f'「NATURE BRIEF」共计 {total_page} 页')
return int(total_page)
def get_page(self, page: int = 1):
url = f'https://www.nature.com/nature/articles?type=news-in-brief&page={page}'
print('「NATURE BRIEF」正在获取网页...')
html = self.fetch(url)
print('「NATURE BRIEF」正在解析...')
# 使用 bs4 解析
soup = BeautifulSoup(html, 'html.parser')
# 获取文章列表
articles = soup.find_all('article')
articles_arr = []
for article in articles:
title = article.find('h3', class_='c-card__title').text.strip()
# 提取链接
link = article.find('a', class_='c-card__link')['href']
description_element = article.find('div', class_='c-card__summary')
description = description_element.text.strip() if description_element else None
author_element = article.find('span', itemprop='name')
author = author_element.text.strip() if author_element else None
date_published = article.find('time', itemprop='datePublished')['datetime']
articles_arr.append({
'id': link.split('/')[-1],
'title': title,
'description': description,
'author': author,
'link': f"https://www.nature.com{link}",
'date_published': date_published
})
print(f'「NATURE BRIEF」解析完成!第 {page} 页,共计 {len(articles_arr)} 篇文章')
return articles_arr
def get_article(self, url: str):
print('「NATURE BRIEF」正在获取文章...')
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
main_content = soup.find('div', class_='main-content')
text = main_content.get_text(strip=True)
return text
def exportToExcel(self, news):
data = {
# "date": getDailyNews().formatted_date,
"ID": [],
"title": [],
# "副标题": [],
"input_content": [],
# "图片 URL": [],
# "图片来源": [],
# "图片作者": []
}
for article in news:
data["ID"].append(article['id'])
data["title"].append(article['title'])
# data["副标题"].append(article["subtitle"])
data["input_content"].append(article['description'])
# pictures = article["pictures”]
# if pictures:
# picture = pictures[0]
# data[“图片 URL”].append(picture[“url”])
# data[“图片来源”].append(picture[“source”])
# data[“图片作者”].append(picture[“author”])
# else:
# data[“图片 URL”].append(“”)
# data[“图片来源”].append(“”)
# data[“图片作者”].append(“”)
df = pd.DataFrame(data)
df.to_excel("c.xlsx", index=False)
naturebrief_spider = NatureBrief()
if __name__ == '__main__':
article = naturebrief_spider.get_today_articles()
spider.exportToExcel(article)
print('「NATURE BRIEF」获取成功')
print(article)
Traceback (most recent call last):
File "e:\桌面\spider\nature.py", line 166, in <module>
spider.exportToExcel(article)
NameError: name 'spider' is not define怎么解决 | d0a13e7d3d6ed332047e5ddd20295c56 | {
"intermediate": 0.36343127489089966,
"beginner": 0.4961327016353607,
"expert": 0.14043603837490082
} |
17,489 | Im making a cli app and all my branding aka the ui printed on screen is stored in a folder as ans (ansi) files, please write a program to read every file from that folder and print it out to the console so i can make sure all my escape codes and stuff work fine. | b2c5791982e897a661315deb583de461 | {
"intermediate": 0.5364207625389099,
"beginner": 0.23603937029838562,
"expert": 0.2275397777557373
} |
17,490 | Произведи улучшение дизайна : <?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cardview="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_marginStart="6dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="8dp"
cardview:cardCornerRadius="8dp"
cardview:cardElevation="2dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="300dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
/>
</RelativeLayout>
<LinearLayout
android:layout_marginTop="300dp"
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="vertical"
android:background="@color/transparent">
<TextView
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Title"
android:textAppearance="?android:textAppearanceLarge" />
<TextView
android:id="@+id/descriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Description"
android:textAppearance="?android:textAppearanceMedium" />
</LinearLayout>
</androidx.cardview.widget.CardView> | 135e1d601903191a0d84680e3381bc4d | {
"intermediate": 0.3516457676887512,
"beginner": 0.3869851231575012,
"expert": 0.26136916875839233
} |
17,491 | import requests
from datetime import datetime,timedelta
from bs4 import BeautifulSoup
import pandas as pd
class NatureBrief:
def __init__(self) -> None:
self.start_date = datetime.now() # datetime.strptime('2023-06-06', '%Y-%m-%d')
pass
def fetch(self, url) -> str:
headers = {
'accept':
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'user-agent': 'application/json, text/javascript, */*; q=0.01',
}
r = requests.get(url, headers=headers)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
def get_today_articles(self, count: int = 3):
# 通过日期计算获取的文章数
current_date = datetime.now()
for i in range(300):
elapsed_time = current_date - timedelta(days=i)
article_count = elapsed_time
# elapsed_time = current_date - self.start_date
# article_count = (elapsed_time.days + 1) * count
# 获取对应数量的文章
total_page = self.get_total_page()
article_list = []
page_i = 1
while page_i < total_page and len(article_list) < article_count:
if page_i + 1 > total_page:
print('「NATURE BRIEF」历史文章已全部获取。无法获取更多...')
break
article_list += self.get_page(page_i)
page_i += 1
if len(article_list) >= article_count:
break
print(f'「NATURE BRIEF」共计获取 {len(article_list)} 篇文章')
# 抽取对应的文章
article_list = article_list[:article_count]
# 倒着获取 3 篇
article_list.reverse()
articles = []
count = 1
for article in article_list:
if count > count:
break
print(f'「NATURE BRIEF」正在获取第 {count} 篇文章: {article["title"]}')
article['text'] = self.get_article(article['link'])
articles.append(article)
count += 1
# 反转
articles.reverse()
return articles
def get_total_page(self):
print('「NATURE BRIEF」正在获取总页数...')
url = 'https://www.nature.com/nature/articles?type=news-in-brief'
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
pagination_items = soup.find_all('li', class_='c-pagination__item')
total_page = None
for item in pagination_items:
data_page = item.get('data-page')
if data_page and data_page.isdigit():
total_page = data_page
print(f'「NATURE BRIEF」共计 {total_page} 页')
return int(total_page)
def get_page(self, page: int = 1):
url = f'https://www.nature.com/nature/articles?type=news-in-brief&page={page}'
print('「NATURE BRIEF」正在获取网页...')
html = self.fetch(url)
print('「NATURE BRIEF」正在解析...')
# 使用 bs4 解析
soup = BeautifulSoup(html, 'html.parser')
# 获取文章列表
articles = soup.find_all('article')
articles_arr = []
for article in articles:
title = article.find('h3', class_='c-card__title').text.strip()
# 提取链接
link = article.find('a', class_='c-card__link')['href']
description_element = article.find('div', class_='c-card__summary')
description = description_element.text.strip() if description_element else None
author_element = article.find('span', itemprop='name')
author = author_element.text.strip() if author_element else None
date_published = article.find('time', itemprop='datePublished')['datetime']
articles_arr.append({
'id': link.split('/')[-1],
'title': title,
'description': description,
'author': author,
'link': f"https://www.nature.com{link}",
'date_published': date_published
})
print(f'「NATURE BRIEF」解析完成!第 {page} 页,共计 {len(articles_arr)} 篇文章')
return articles_arr
def get_article(self, url: str):
print('「NATURE BRIEF」正在获取文章...')
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
main_content = soup.find('div', class_='main-content')
text = main_content.get_text(strip=True)
return text
def exportToExcel(self, news):
data = {
# "date": getDailyNews().formatted_date,
"ID": [],
"title": [],
# "副标题": [],
"input_content": [],
# "图片 URL": [],
# "图片来源": [],
# "图片作者": []
}
for article in news:
data["ID"].append(article['id'])
data["title"].append(article['title'])
# data["副标题"].append(article["subtitle"])
data["input_content"].append(article['text'])
# pictures = article["pictures”]
# if pictures:
# picture = pictures[0]
# data[“图片 URL”].append(picture[“url”])
# data[“图片来源”].append(picture[“source”])
# data[“图片作者”].append(picture[“author”])
# else:
# data[“图片 URL”].append(“”)
# data[“图片来源”].append(“”)
# data[“图片作者”].append(“”)
df = pd.DataFrame(data)
df.to_excel("c.xlsx", index=False)
naturebrief_spider = NatureBrief()
if __name__ == '__main__':
spider = NatureBrief()
article = naturebrief_spider.get_today_articles()
spider.exportToExcel(article)
print('「NATURE BRIEF」获取成功')
print(article)
如何获取每天对应的文章 | 7869088f04048cb13d42a31b2a4f27f8 | {
"intermediate": 0.330889493227005,
"beginner": 0.5357164740562439,
"expert": 0.1333940625190735
} |
17,492 | class lala:
n=int(input("enter the num: "))
z=[]
def factor (self):
for i in range(n):
if i%2==0:
w=z.append(i)
print(slef.w)
counter=0
def sum (self):
for i in range(n):
counter+=i
print(self.counter)
p=lala()
p.factor()
p.sum() اين الخطأ | 1f4a03dacb633605253f404b64eee84f | {
"intermediate": 0.16281603276729584,
"beginner": 0.7195823192596436,
"expert": 0.117601677775383
} |
17,493 | import requests
from datetime import datetime,timedelta
from bs4 import BeautifulSoup
import pandas as pd
class NatureBrief:
def __init__(self) -> None:
self.start_date = datetime.now() # datetime.strptime('2023-06-06', '%Y-%m-%d')
pass
def fetch(self, url) -> str:
headers = {
'accept':
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'user-agent': 'application/json, text/javascript, */*; q=0.01',
}
r = requests.get(url, headers=headers)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
def get_today_articles(self, count: int = 3):
# 通过日期计算获取的文章数
current_date = datetime.now()
for i in range(300):
elapsed_time = current_date - timedelta(days=i)
article_count = elapsed_time
# elapsed_time = current_date - self.start_date
# article_count = (elapsed_time.days + 1) * count
# 获取对应数量的文章
total_page = self.get_total_page()
article_list = []
page_i = 1
while page_i < total_page and len(article_list) < article_count:
if page_i + 1 > total_page:
print('「NATURE BRIEF」历史文章已全部获取。无法获取更多...')
break
article_list += self.get_page(page_i)
page_i += 1
if len(article_list) >= article_count:
break
print(f'「NATURE BRIEF」共计获取 {len(article_list)} 篇文章')
# 抽取对应的文章
article_list = article_list[:article_count]
# 倒着获取 3 篇
article_list.reverse()
articles = []
count = 1
for article in article_list:
if count > count:
break
print(f'「NATURE BRIEF」正在获取第 {count} 篇文章: {article["title"]}')
article['text'] = self.get_article(article['link'])
articles.append(article)
count += 1
# 反转
articles.reverse()
return articles
def get_total_page(self):
print('「NATURE BRIEF」正在获取总页数...')
url = 'https://www.nature.com/nature/articles?type=news-in-brief'
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
pagination_items = soup.find_all('li', class_='c-pagination__item')
total_page = None
for item in pagination_items:
data_page = item.get('data-page')
if data_page and data_page.isdigit():
total_page = data_page
print(f'「NATURE BRIEF」共计 {total_page} 页')
return int(total_page)
def get_page(self, page: int = 1):
url = f'https://www.nature.com/nature/articles?type=news-in-brief&page={page}'
print('「NATURE BRIEF」正在获取网页...')
html = self.fetch(url)
print('「NATURE BRIEF」正在解析...')
# 使用 bs4 解析
soup = BeautifulSoup(html, 'html.parser')
# 获取文章列表
articles = soup.find_all('article')
articles_arr = []
for article in articles:
title = article.find('h3', class_='c-card__title').text.strip()
# 提取链接
link = article.find('a', class_='c-card__link')['href']
description_element = article.find('div', class_='c-card__summary')
description = description_element.text.strip() if description_element else None
author_element = article.find('span', itemprop='name')
author = author_element.text.strip() if author_element else None
date_published = article.find('time', itemprop='datePublished')['datetime']
articles_arr.append({
'id': link.split('/')[-1],
'title': title,
'description': description,
'author': author,
'link': f"https://www.nature.com{link}",
'date_published': date_published
})
print(f'「NATURE BRIEF」解析完成!第 {page} 页,共计 {len(articles_arr)} 篇文章')
return articles_arr
def get_article(self, url: str):
print('「NATURE BRIEF」正在获取文章...')
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
main_content = soup.find('div', class_='main-content')
text = main_content.get_text(strip=True)
return text
def exportToExcel(self, news):
data = {
# "date": getDailyNews().formatted_date,
"ID": [],
"title": [],
# "副标题": [],
"input_content": [],
# "图片 URL": [],
# "图片来源": [],
# "图片作者": []
}
for article in news:
data["ID"].append(article['id'])
data["title"].append(article['title'])
# data["副标题"].append(article["subtitle"])
data["input_content"].append(article['text'])
# pictures = article["pictures”]
# if pictures:
# picture = pictures[0]
# data[“图片 URL”].append(picture[“url”])
# data[“图片来源”].append(picture[“source”])
# data[“图片作者”].append(picture[“author”])
# else:
# data[“图片 URL”].append(“”)
# data[“图片来源”].append(“”)
# data[“图片作者”].append(“”)
df = pd.DataFrame(data)
df.to_excel("c.xlsx", index=False)
naturebrief_spider = NatureBrief()
if __name__ == '__main__':
spider = NatureBrief()
article = naturebrief_spider.get_today_articles()
spider.exportToExcel(article)
print('「NATURE BRIEF」获取成功')
print(article)
将上述代码修改为获取之前每天的文章并解析文章,之后转换成excel | f3ce00c5e616faa683afe37ea56359fb | {
"intermediate": 0.330889493227005,
"beginner": 0.5357164740562439,
"expert": 0.1333940625190735
} |
17,494 | Hi. I want to create an AI that can apply style of a logo to another logo. Can you help me | 4f425225d69773f31d798dccf48e0500 | {
"intermediate": 0.08454214036464691,
"beginner": 0.11622034013271332,
"expert": 0.7992374897003174
} |
17,495 | Напиши функцию на Kotlin которая будет постепенно растворять нижнюю часть картинки , функция принимает картинку и возвращает картинку , функция должна работать фо фрагменте , я хочу чтобы низ картинки постепенно становился прозрачным | 869bca4428339c0dc7a51858f402389b | {
"intermediate": 0.39174172282218933,
"beginner": 0.2772355377674103,
"expert": 0.3310227692127228
} |
17,496 | Перепиши код , без ошибок package com.example.cinema_provider_app.main_Fragments.Home_Fragment.Adapters
import android.annotation.SuppressLint
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.lifecycle.Transformations
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.example.cinema_provider_app.R
import com.example.cinema_provider_app.main_Fragments.Home_Fragment.Data_Classes.SlideItem
import com.google.android.material.imageview.ShapeableImageView
import jp.wasabeef.glide.transformations.BlurTransformation
import jp.wasabeef.glide.transformations.ColorFilterTransformation
class SliderAdapter(private val itemList: List<SlideItem>) :
RecyclerView.Adapter<SliderAdapter.ViewHolder>() {
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val title: TextView = itemView.findViewById(R.id.titleTextView)
val description: TextView = itemView.findViewById(R.id.descriptionTextView)
val image: ShapeableImageView = itemView.findViewById(R.id.imageView)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.slide_item, parent, false)
return ViewHolder(view)
}
@SuppressLint("CheckResult")
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = itemList[position]
holder.title.text = item.title
holder.description.text = item.description
Glide.with(holder.image)
.load(item.image)
.apply(RequestOptions().apply {
transform(
Transformations().apply {
add(ColorFilterTransformation(Color.parseColor("#80000000")))
}
)
centerCrop()
})
.into(holder.image)
}
override fun getItemCount(): Int {
return itemList.size
}
} | aa93634e480350301bb51bf3933256ff | {
"intermediate": 0.32295018434524536,
"beginner": 0.45148834586143494,
"expert": 0.22556143999099731
} |
17,497 | give me a query or a script with a query that will help me display the status of an industrial furnace. It should show if its on or off and and the percentage of time is on or off. the boolean value for on or off is in a column named event_value. The timestamp values is in the column event_timestamp. | 8dac231322b3b4fb4758917a0c548b9b | {
"intermediate": 0.6538216471672058,
"beginner": 0.10134527087211609,
"expert": 0.2448331117630005
} |
17,498 | simple streamlit app | 7655c2f9f2924165c4fc900f061be782 | {
"intermediate": 0.3954979479312897,
"beginner": 0.40939298272132874,
"expert": 0.19510908424854279
} |
17,499 | import requests
from datetime import datetime,timedelta
from bs4 import BeautifulSoup
import pandas as pd
class NatureBrief:
def __init__(self) -> None:
self.start_date = datetime.now() # datetime.strptime('2023-06-06', '%Y-%m-%d')
pass
def fetch(self, url) -> str:
headers = {
'accept':
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'user-agent': 'application/json, text/javascript, */*; q=0.01',
}
r = requests.get(url, headers=headers)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
def get_today_articles(self, count: int = 3000):
# 通过日期计算获取的文章数
current_date = datetime.now()
# for i in range(300):
# elapsed_time = current_date - timedelta(days=i)
# print(elapsed_time)
# article_count = elapsed_time
elapsed_time = current_date - self.start_date
article_count = (elapsed_time.days + 1) * count
print(article_count)
# 获取对应数量的文章
total_page = self.get_total_page()
article_list = []
page_i = 1
while page_i < total_page and len(article_list) < article_count:
if page_i + 1 > total_page:
print('「NATURE BRIEF」历史文章已全部获取。无法获取更多...')
break
article_list += self.get_page(page_i)
page_i += 1
if len(article_list) >= article_count:
break
print(f'「NATURE BRIEF」共计获取 {len(article_list)} 篇文章')
# 抽取对应的文章
article_list = article_list[:article_count]
# 倒着获取 3 篇
article_list.reverse()
articles = []
count = 1
for article in article_list:
if count > count:
break
print(f'「NATURE BRIEF」正在获取第 {count} 篇文章: {article["title"]}')
article['text'] = self.get_article(article['link'])
articles.append(article)
count += 1
# 反转
articles.reverse()
return articles
def get_total_page(self):
print('「NATURE BRIEF」正在获取总页数...')
url = 'https://www.nature.com/nature/articles?type=news-in-brief'
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
pagination_items = soup.find_all('li', class_='c-pagination__item')
total_page = None
for item in pagination_items:
data_page = item.get('data-page')
if data_page and data_page.isdigit():
total_page = data_page
print(f'「NATURE BRIEF」共计 {total_page} 页')
return int(total_page)
def get_page(self, page: int = 1):
url = f'https://www.nature.com/nature/articles?type=news-in-brief&page={page}'
print('「NATURE BRIEF」正在获取网页...')
html = self.fetch(url)
print('「NATURE BRIEF」正在解析...')
# 使用 bs4 解析
soup = BeautifulSoup(html, 'html.parser')
# 获取文章列表
articles = soup.find_all('article')
articles_arr = []
for article in articles:
title = article.find('h3', class_='c-card__title').text.strip()
# 提取链接
link = article.find('a', class_='c-card__link')['href']
description_element = article.find('div', class_='c-card__summary')
description = description_element.text.strip() if description_element else None
author_element = article.find('span', itemprop='name')
author = author_element.text.strip() if author_element else None
date_published = article.find('time', itemprop='datePublished')['datetime']
articles_arr.append({
'id': link.split('/')[-1],
'title': title,
'description': description,
'author': author,
'link': f"https://www.nature.com{link}",
'date_published': date_published
})
print(f'「NATURE BRIEF」解析完成!第 {page} 页,共计 {len(articles_arr)} 篇文章')
return articles_arr
def get_article(self, url: str):
print('「NATURE BRIEF」正在获取文章...')
html = self.fetch(url)
soup = BeautifulSoup(html, 'html.parser')
main_content = soup.find('div', class_='main-content')
text = main_content.get_text(strip=True)
return text
def exportToExcel(self, news):
data = {
# "date": getDailyNews().formatted_date,
"ID": [],
"title": [],
# "副标题": [],
"input_content": [],
# "图片 URL": [],
# "图片来源": [],
# "图片作者": []
}
for article in news:
data["ID"].append(article['id'])
data["title"].append(article['title'])
# data["副标题"].append(article["subtitle"])
data["input_content"].append(article['text'])
# pictures = article["pictures”]
# if pictures:
# picture = pictures[0]
# data[“图片 URL”].append(picture[“url”])
# data[“图片来源”].append(picture[“source”])
# data[“图片作者”].append(picture[“author”])
# else:
# data[“图片 URL”].append(“”)
# data[“图片来源”].append(“”)
# data[“图片作者”].append(“”)
df = pd.DataFrame(data)
df.to_excel("c.xlsx", index=False)
naturebrief_spider = NatureBrief()
if __name__ == '__main__':
spider = NatureBrief()
article = naturebrief_spider.get_today_articles()
spider.exportToExcel(article)
print('「NATURE BRIEF」获取成功')
print(article)
NATURE BRIEF」解析完成!第 79 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 80 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 81 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 82 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 83 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 84 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 85 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 86 页,共计 20 篇文章
「NATURE BRIEF」正在获取网页...
「NATURE BRIEF」正在解析...
「NATURE BRIEF」解析完成!第 87 页,共计 20 篇文章
「NATURE BRIEF」共计获取 1740 篇文章
「NATURE BRIEF」正在获取第 1 篇文章: News in Brief
「NATURE BRIEF」正在获取文章...
「NATURE BRIEF」正在获取第 2 篇文章: A refuge for scientists' writings
「NATURE BRIEF」正在获取文章...
「NATURE BRIEF」正在获取第 3 篇文章: Environmental research in Northern Finland
「NATURE BRIEF」正在获取文章...
Traceback (most recent call last):
File "e:\桌面\spider\nature.py", line 172, in <module>
article = naturebrief_spider.get_today_articles()
File "e:\桌面\spider\nature.py", line 64, in get_today_articles
article['text'] = self.get_article(article['link'])
File "e:\桌面\spider\nature.py", line 132, in get_article
text = main_content.get_text()
AttributeError: 'NoneType' object has no attribute 'get_text'
怎么解决问题 | e731db7f6a3d6f4fe814bc02e716ed03 | {
"intermediate": 0.35707199573516846,
"beginner": 0.518695056438446,
"expert": 0.1242329329252243
} |
17,500 | squish.tapObject(elementMenu)
else:
test.warning(f'Пункт меню {itemName} не найден')
returnreturn
def checkItemMenuDisable(self, itemName):
squish.tapObject(elementMenu)
else:
test.warning(f'Пункт меню {itemName} не найден')
returnreturn
def checkItemMenuDisable(self, itemName): | 33c0ec9750a031ae3f2987d73b3c7efd | {
"intermediate": 0.3435862064361572,
"beginner": 0.30149155855178833,
"expert": 0.35492220520973206
} |
17,501 | Give me custom implementation of detached threads in c++, windows platform | 859b530cb9f774c3612e857b355de09f | {
"intermediate": 0.5137251615524292,
"beginner": 0.16956087946891785,
"expert": 0.31671395897865295
} |
17,502 | CreateThread with 6 args c++ windows | f93d70b4e777dc8d63be907c316f85d4 | {
"intermediate": 0.31427377462387085,
"beginner": 0.40962907671928406,
"expert": 0.27609720826148987
} |
17,503 | CreateThread detached thread c++ windows | 7ab449a197fe2c1c49bf2bed62a78f8d | {
"intermediate": 0.3393211364746094,
"beginner": 0.35065048933029175,
"expert": 0.3100283741950989
} |
17,504 | 1 2023-01-14
1 2023-02-07
1 2023-05-11
2 2023-02-19
2 2023-04-17
2 2023-06-28
3 2023-01-01
3 2023-02-22
3 2023-07-10 from these tables get me expected result using case --payerid, payment_date, payment_status
--1 2023-01-14 Open
--1 2023-02-07 InProgress
--1 2023-05-11 Closed
--2 2023-02-19 Open
--2 2023-04-17 InProgress
--2 2023-06-28 Closed
--3 2023-01-01 Open
--3 2023-02-22 InProgress
--3 2023-07-10 Closed | b70b58b10ce2782d7cdc0226093360cb | {
"intermediate": 0.4067784249782562,
"beginner": 0.34871408343315125,
"expert": 0.24450752139091492
} |
17,505 | hi | b6025526afeb86344f45d2d4333966ab | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
17,506 | _surfaceDistance(start, end) {
let geodesic = new Cesium.EllipsoidGeodesic();
let startGeodesic = Cesium.Cartographic.fromCartesian(start)//笛卡尔系转经纬度
let endGeodesic = Cesium.Cartographic.fromCartesian(end)
geodesic.setEndPoints(startGeodesic, endGeodesic)
let lengthInMeters = (geodesic.surfaceDistance) / 1000;
return parseFloat(lengthInMeters)
}
将这段代码改为测量高度 | 01421dd59706c1cdb5376059f9d8f745 | {
"intermediate": 0.28996676206588745,
"beginner": 0.4410073459148407,
"expert": 0.26902586221694946
} |
17,507 | you are a deep learning engineer. you have a training data “sign_mnist_train.csv”. the first column is “label”. the following columns are “pixel1”,“pixel2”,…“pixel784”, you need to build data loader for further deep learning training. plz give the code. you can only use Keras rather than pytorch | 1d623970eae5ffabeff56042b6eb34b9 | {
"intermediate": 0.12720073759555817,
"beginner": 0.049709878861904144,
"expert": 0.8230893611907959
} |
17,508 | import pandas as pd
input_files = []
while True:
file = input("Enter the name of an input file (or ‘done’ to finish): ")
if file.lower() == ‘done’:
break
input_files.append(file)
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df[‘Date’] = file
merged_df = pd.concat([merged_df, df])
# Write the merged dataframe to an output Excel file
output_file = ‘merged_data.xlsx’
merged_df.to_excel(output_file, index=False)
print(“Merged dataframe has been written to”, output_file) | 627dcac2af158ec06cc786659e0cbb5d | {
"intermediate": 0.591357409954071,
"beginner": 0.2352336049079895,
"expert": 0.17340897023677826
} |
17,509 | you are a deep learning engineer. you have a training data “sign_mnist_train.csv” and test data “sign_mnist_test.csv”. the first column is “label”. the following columns are “pixel1”,“pixel2”,…“pixel784”, you need to build train validation test data for further deep learning training. plz give the code. you can only use Keras rather than pytorch. make sure that both label are one-hot. make sure that training label and test label have the same one-hot mapping rule! | 30425f0853f15190d7f59b3433cbd435 | {
"intermediate": 0.07973054051399231,
"beginner": 0.04770369082689285,
"expert": 0.872565746307373
} |
17,510 | current_number = 1
while current_number < 10:
if current_number % 2 == 0:
continue
print(current_number)
current_number += 1
This is my python program, it's supposed to print out all numbers from 1 - 10 that are odd. It only prints the number 1, why?\ | 2bbe4af1ab867c451d14a60f648e2b0e | {
"intermediate": 0.38706469535827637,
"beginner": 0.44999635219573975,
"expert": 0.16293898224830627
} |
17,511 | from keras.models import Model
from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout, Add, Input
# Define the model with ResNet module
input_tensor = Input(shape=(28, 28, 1))
x = Conv2D(32, kernel_size=(3, 3), activation="relu")(input_tensor)
x = MaxPooling2D(pool_size=(2, 2))(x)
# Residual connection
residual = Conv2D(32, kernel_size=(1, 1))(x)
x = Conv2D(32, kernel_size=(3, 3), activation="relu", padding="same")(x)
x = Add()([x, residual])
x = Flatten()(x)
x = Dense(128, activation="relu")(x)
x = Dropout(0.5)(x) # Dropout layer with a rate of 0.5
output_tensor = Dense(26, activation="softmax")(x) # 26 classes for sign language mnist
# Create the model
model = Model(inputs=input_tensor, outputs=output_tensor)
# Compile the model
model.compile(loss="categorical_crossentropy",
optimizer="adam",
metrics=["accuracy"])
# Train the model
history = model.fit(train_X, train_y,
batch_size=128,
epochs=50,
verbose=1,
validation_data=(val_X, val_y))
# Evaluate the model on the test data
test_loss, test_acc = model.evaluate(test_X, test_y, verbose=0)
print("Test accuracy:", test_acc)
# Predict labels for test data
test_predictions = model.predict(test_X)
test_predictions = np.argmax(test_predictions, axis=1) add code below to draw train and validation loss curve | 216705e5701262b4436c1c42f2cef68b | {
"intermediate": 0.2896668314933777,
"beginner": 0.2492649257183075,
"expert": 0.4610682427883148
} |
17,512 | How can i set up zmap to scan for dns servers? | 3808f2909875aba4b031f48f9ee2cdb6 | {
"intermediate": 0.47719720005989075,
"beginner": 0.12744256854057312,
"expert": 0.39536023139953613
} |
17,513 | numberofGuests = input("Welcome to the Cinema! How many guests are attending today?: ")
numberofGuests = int(numberofGuests)
How can I loop this by the number of guests entered? For example, if there are only 3 guests, how should I write the while loop in python | 8bd7f914c149b576286e8df101ae26d1 | {
"intermediate": 0.22496464848518372,
"beginner": 0.697979748249054,
"expert": 0.0770556703209877
} |
17,514 | Wo are you | 9166e471db3e08bd01110099243118ac | {
"intermediate": 0.4165560305118561,
"beginner": 0.27073222398757935,
"expert": 0.3127116858959198
} |
17,515 | //高度测量类
import * as Cesium from 'cesium'
export default class MeasureHeight {
constructor(viewer) {
this.viewer = viewer;
this.initEvents();
this.positions = [];
this.vertexEntities = [];
this.labelEntity = undefined;
this.measureHeight = 0; //测量结果
}
//初始化事件
initEvents() {
this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
this.MeasureStartEvent = new Cesium.Event(); //开始事件
this.MeasureEndEvent = new Cesium.Event(); //结束事件
}
//激活
activate() {
this.deactivate();
this.registerEvents(); //注册鼠标事件
//设置鼠标状态
this.viewer.enableCursorStyle = false;
this.viewer._element.style.cursor = 'default';
this.isMeasure = true;
this.circleRadius = 0.1;
this.measureHeight = 0;
this.positions = [];
}
//禁用
deactivate() {
if (!this.isMeasure) return;
this.unRegisterEvents();
this.viewer._element.style.cursor = 'pointer';
this.viewer.enableCursorStyle = true;
this.isMeasure = false;
}
//清空绘制
clear() {
//清除线对象
this.viewer.entities.remove(this.lineEntity);
this.lineEntity = undefined;
//清除文本
this.viewer.entities.remove(this.labelEntity);
this.labelEntity = undefined;
//移除圆
this.removeCircleEntity();
//清除节点
this.vertexEntities.forEach(item => {
this.viewer.entities.remove(item);
});
this.vertexEntities = [];
}
//创建线对象
createLineEntity() {
this.lineEntity = this.viewer.entities.add({
polyline: {
positions: new Cesium.CallbackProperty(e => {
return this.positions;
}, false),
width: 2,
material: Cesium.Color.YELLOW,
depthFailMaterial: new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.RED,
}),
}
})
}
//创建结果文本标签
createLabel() {
this.labelEntity = this.viewer.entities.add({
position: new Cesium.CallbackProperty(e => {
return this.positions[this.positions.length - 1]; //返回最后一个点
}, false),
label: {
text: "",
scale: 0.5,
font: 'normal 40px MicroSoft YaHei',
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000),
scaleByDistance: new Cesium.NearFarScalar(500, 1, 1500, 0.4),
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
pixelOffset: new Cesium.Cartesian2(0, -30),
outlineWidth: 9,
outlineColor: Cesium.Color.WHITE
}
})
}
//创建线节点
createVertex(index) {
let vertexEntity = this.viewer.entities.add({
position: new Cesium.CallbackProperty(e => {
return this.positions[index];
}, false),
type: "MeasureHeightVertex",
point: {
color: Cesium.Color.FUCHSIA,
pixelSize: 6,
// disableDepthTestDistance: 2000,
},
});
this.vertexEntities.push(vertexEntity);
}
//创建圆 这样方便看出水平面的高低
createCircleEntitiy() {
this.circleEntity = this.viewer.entities.add({
position: new Cesium.CallbackProperty(e => {
return this.positions[this.positions.length - 1]; //返回最后一个点
}, false),
ellipse: {
height: new Cesium.CallbackProperty(e => {
return positionHeight(this.positions[this.positions.length - 1]);
}, false),
semiMinorAxis: new Cesium.CallbackProperty(e => {
return this.circleRadius;
}, false),
semiMajorAxis: new Cesium.CallbackProperty(e => {
return this.circleRadius;
}, false),
material: Cesium.Color.YELLOW.withAlpha(0.5),
},
});
}
//删除圆
removeCircleEntity() {
this.viewer.entities.remove(this.circleEntity);
this.circleEntity = undefined;
}
//注册鼠标事件
registerEvents() {
this.leftClickEvent();
this.rightClickEvent();
this.mouseMoveEvent();
}
//左键点击事件
leftClickEvent() {
//单击鼠标左键画点点击事件
this.handler.setInputAction(e => {
this.viewer._element.style.cursor = 'default';
let position = this.viewer.scene.pickPosition(e.position);
if (!position) {
const ellipsoid = this.viewer.scene.globe.ellipsoid;
position = this.viewer.scene.camera.pickEllipsoid(e.position, ellipsoid);
}
if (!position) return;
if (this.positions.length == 0) { //首次点击
this.positions.push(position);
this.createVertex(0);
this.createLineEntity();
this.createCircleEntitiy();
this.createLabel();
} else { //第二次点击结束测量
this.measureEnd();
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}
//鼠标移动事件
mouseMoveEvent() {
this.handler.setInputAction(e => {
if (!this.isMeasure) return;
this.viewer._element.style.cursor = 'default';
let position = this.viewer.scene.pickPosition(e.endPosition);
if (!position) {
position = this.viewer.scene.camera.pickEllipsoid(e.startPosition, this.viewer.scene.globe.ellipsoid);
}
if (!position) return;
this.handleMoveEvent(position);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
//处理鼠标移动
handleMoveEvent(position) {
if (this.positions.length < 1) return;
let firstPoint = cartesian3Point3(this.positions[0]); //第一个点
let movePoint = cartesian3Point3(position); //鼠标移动点
const h = movePoint[2] - firstPoint[2];
firstPoint[2] = movePoint[2];
const twoPosition = Cesium.Cartesian3.fromDegrees(firstPoint[0], firstPoint[1], movePoint[2]);
if (this.positions.length < 2) {
this.positions.push(twoPosition);
this.createVertex(1);
} else {
this.positions[1] = twoPosition;
this.measureHeight = h.toFixed(3);
this.labelEntity.label.text = "高度:" + this.measureHeight + " 米"
}
//计算圆的半径
this.circleRadius = getDistanceH(this.positions[0], position);
}
//右键事件
rightClickEvent() {
this.handler.setInputAction(e => {
if (this.isMeasure) {
this.deactivate();
this.clear();
}
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
}
//测量结束
measureEnd() {
this.deactivate();
this.MeasureEndEvent.raiseEvent(this.measureHeight); //触发结束事件 传入结果
}
//解除鼠标事件
unRegisterEvents() {
this.handler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK);
this.handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
this.handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
}
前端使用vue3并采用<el-button>组件来实现引用上面js代码实现测量高度 | 647413c21c94ab92b50cfe33a0c086ec | {
"intermediate": 0.376383513212204,
"beginner": 0.39988934993743896,
"expert": 0.22372709214687347
} |
17,516 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Convert the “Worker” and “Personal Number” columns to numeric data type
employees_df["Personal Number"] = pd.to_numeric(employees_df["Personal Number"], errors="coerce")
for col in ["Worker"]:
for file in input_files:
df = pd.read_excel(file)
df[col] = pd.to_numeric(df[col], errors="coerce")
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
#merged_df = pd.concat([merged_df, df])
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
df = pd.merge(df, employees_df[["Worker", "Personal Number", "Position", "Description_4"]],
left_on=["Worker"], right_on=["Personal Number"].astype(str), how="left")
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | 7ea1b6b75d18f53932ab6c61166a38d3 | {
"intermediate": 0.3912053108215332,
"beginner": 0.45968344807624817,
"expert": 0.14911119639873505
} |
17,517 | export default class MeasureHeight {
constructor(viewer) {
this.viewer = viewer;
this.initEvents();
this.positions = [];
this.vertexEntities = [];
this.labelEntity = undefined;
this.measureHeight = 0; //测量结果
}
//初始化事件
initEvents() {
this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
this.MeasureStartEvent = new Cesium.Event(); //开始事件
this.MeasureEndEvent = new Cesium.Event(); //结束事件
}
//激活
activate() {
this.deactivate();
this.registerEvents(); //注册鼠标事件
//设置鼠标状态
this.viewer.enableCursorStyle = false;
this.viewer._element.style.cursor = 'default';
this.isMeasure = true;
this.circleRadius = 0.1;
this.measureHeight = 0;
this.positions = [];
}
//禁用
deactivate() {
if (!this.isMeasure) return;
this.unRegisterEvents();
this.viewer._element.style.cursor = 'pointer';
this.viewer.enableCursorStyle = true;
this.isMeasure = false;
}
//清空绘制
clear() {
//清除线对象
this.viewer.entities.remove(this.lineEntity);
this.lineEntity = undefined;
//清除文本
this.viewer.entities.remove(this.labelEntity);
this.labelEntity = undefined;
//移除圆
this.removeCircleEntity();
//清除节点
this.vertexEntities.forEach(item => {
this.viewer.entities.remove(item);
});
this.vertexEntities = [];
}
//创建线对象
createLineEntity() {
this.lineEntity = this.viewer.entities.add({
polyline: {
positions: new Cesium.CallbackProperty(e => {
return this.positions;
}, false),
width: 2,
material: Cesium.Color.YELLOW,
depthFailMaterial: new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.RED,
}),
}
})
}
//创建结果文本标签
createLabel() {
this.labelEntity = this.viewer.entities.add({
position: new Cesium.CallbackProperty(e => {
return this.positions[this.positions.length - 1]; //返回最后一个点
}, false),
label: {
text: "",
scale: 0.5,
font: 'normal 40px MicroSoft YaHei',
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000),
scaleByDistance: new Cesium.NearFarScalar(500, 1, 1500, 0.4),
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
pixelOffset: new Cesium.Cartesian2(0, -30),
outlineWidth: 9,
outlineColor: Cesium.Color.WHITE
}
})
}
//创建线节点
createVertex(index) {
let vertexEntity = this.viewer.entities.add({
position: new Cesium.CallbackProperty(e => {
return this.positions[index];
}, false),
type: "MeasureHeightVertex",
point: {
color: Cesium.Color.FUCHSIA,
pixelSize: 6,
// disableDepthTestDistance: 2000,
},
});
this.vertexEntities.push(vertexEntity);
}
//创建圆 这样方便看出水平面的高低
createCircleEntitiy() {
this.circleEntity = this.viewer.entities.add({
position: new Cesium.CallbackProperty(e => {
return this.positions[this.positions.length - 1]; //返回最后一个点
}, false),
ellipse: {
height: new Cesium.CallbackProperty(e => {
return positionHeight(this.positions[this.positions.length - 1]);
}, false),
semiMinorAxis: new Cesium.CallbackProperty(e => {
return this.circleRadius;
}, false),
semiMajorAxis: new Cesium.CallbackProperty(e => {
return this.circleRadius;
}, false),
material: Cesium.Color.YELLOW.withAlpha(0.5),
},
});
}
//删除圆
removeCircleEntity() {
this.viewer.entities.remove(this.circleEntity);
this.circleEntity = undefined;
}
//注册鼠标事件
registerEvents() {
this.leftClickEvent();
this.rightClickEvent();
this.mouseMoveEvent();
}
//左键点击事件
leftClickEvent() {
//单击鼠标左键画点点击事件
this.handler.setInputAction(e => {
this.viewer._element.style.cursor = 'default';
let position = this.viewer.scene.pickPosition(e.position);
if (!position) {
const ellipsoid = this.viewer.scene.globe.ellipsoid;
position = this.viewer.scene.camera.pickEllipsoid(e.position, ellipsoid);
}
if (!position) return;
if (this.positions.length == 0) { //首次点击
this.positions.push(position);
this.createVertex(0);
this.createLineEntity();
this.createCircleEntitiy();
this.createLabel();
} else { //第二次点击结束测量
this.measureEnd();
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}
//鼠标移动事件
mouseMoveEvent() {
this.handler.setInputAction(e => {
if (!this.isMeasure) return;
this.viewer._element.style.cursor = 'default';
let position = this.viewer.scene.pickPosition(e.endPosition);
if (!position) {
position = this.viewer.scene.camera.pickEllipsoid(e.startPosition, this.viewer.scene.globe.ellipsoid);
}
if (!position) return;
this.handleMoveEvent(position);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
//处理鼠标移动
handleMoveEvent(position) {
if (this.positions.length < 1) return;
let firstPoint = cartesian3Point3(this.positions[0]); //第一个点
let movePoint = cartesian3Point3(position); //鼠标移动点
const h = movePoint[2] - firstPoint[2];
firstPoint[2] = movePoint[2];
const twoPosition = Cesium.Cartesian3.fromDegrees(firstPoint[0], firstPoint[1], movePoint[2]);
if (this.positions.length < 2) {
this.positions.push(twoPosition);
this.createVertex(1);
} else {
this.positions[1] = twoPosition;
this.measureHeight = h.toFixed(3);
this.labelEntity.label.text = "高度:" + this.measureHeight + " 米"
}
//计算圆的半径
this.circleRadius = getDistanceH(this.positions[0], position);
}
//右键事件
rightClickEvent() {
this.handler.setInputAction(e => {
if (this.isMeasure) {
this.deactivate();
this.clear();
}
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
}
//测量结束
measureEnd() {
this.deactivate();
this.MeasureEndEvent.raiseEvent(this.measureHeight); //触发结束事件 传入结果
}
//解除鼠标事件
unRegisterEvents() {
this.handler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK);
this.handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
this.handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
}
以上文件的文件名为MeasureHeight.js,前端使用Vue3并用MeasureHeight.js的文件里的代码实现Cesium测量高度 | 3867e25addae762b8f1688f8de626b4d | {
"intermediate": 0.30843254923820496,
"beginner": 0.4347105920314789,
"expert": 0.25685688853263855
} |
17,518 | df = pd.merge(df, employees_df[["English Name", "Position"]],
left_on=["Worker Name"], right_on=["English Name"], how="left")
merged_df = pd.concat([merged_df, df]) | ab721f5a6c4d9dd1f97cacbb51657dfe | {
"intermediate": 0.39182886481285095,
"beginner": 0.31863000988960266,
"expert": 0.289541095495224
} |
17,519 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
import numpy as np
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Convert the “Worker” and “Personal Number” columns to numeric data type
#employees_df["Personal Number"] = pd.to_numeric(employees_df["Personal Number"], errors="coerce")
#for col in ["Worker"]:
#for file in input_files:
#df = pd.read_excel(file)
#df[col] = pd.to_numeric(df[col], errors="coerce")
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
#merged_df = pd.concat([merged_df, df])
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Convert the “Personal Number” column in the employees dataframe to string type
#employees_df["Personal Number"] = employees_df["Personal Number"].astype(str)
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
df = pd.merge(df, employees_df[["English Name", "Position"]],
left_on=["Worker Name"], right_on=["English Name"], how="left")
merged_df = pd.concat([merged_df, df])
# Fill in the missing Position values in merged_df with the values from df
# Fill in the missing Position values in merged_df with the values from df
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | 4c0488b103d71e3050c9547f0eae3da7 | {
"intermediate": 0.4125337600708008,
"beginner": 0.3965854048728943,
"expert": 0.1908809095621109
} |
17,520 | I used your code: def signal_generator(df):
if df is None or len(df) < 2:
return ''
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = sum(float(bid[1]) for bid in bid_depth)
sell_qty = sum(float(ask[1]) for ask in ask_depth)
mark_price_data = client.ticker_price(symbol=symbol)
mark_price = float(mark_price_data['price']) if 'price' in mark_price_data else 0.0
if buy_qty > sell_qty:
signals = 'Bullish'
elif sell_qty > buy_qty:
signals = 'Bearish'
else:
return ''
if signals == 'Bullish' and buy_price < mark_price:
return 'sell'
elif signals == 'Bearish' and sell_price > mark_price:
return 'buy'
else:
return ''
But it giving me only sell signal | cbb96f01315db1d714e4aaebb24cf337 | {
"intermediate": 0.3503328263759613,
"beginner": 0.37567731738090515,
"expert": 0.27398982644081116
} |
17,521 | hello | fa8262c9d7eca1375dc82b3d3e4d1058 | {
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
} |
17,522 | write me after effects script that edits the layer text | 91dbf8100f84926321a9deb64ef1ddcc | {
"intermediate": 0.3094855844974518,
"beginner": 0.24259307980537415,
"expert": 0.44792136549949646
} |
17,523 | How to introduce the difference of AC power cycling and DC power cycling and OS reboot | dd50db8ed4349f085c62eac98912a2e7 | {
"intermediate": 0.2859383523464203,
"beginner": 0.28113821148872375,
"expert": 0.43292343616485596
} |
17,524 | what is :root in css | 7c9d7e031534c37c1d5253b32b9b7cb5 | {
"intermediate": 0.32371872663497925,
"beginner": 0.423805832862854,
"expert": 0.25247544050216675
} |
17,525 | const [draggable, setDraggable] = useState(false);
<Box key={widget.id} data-grid={widget} sx={{borderRadius: "26px", background: theme => theme.palette.background.paper, backgroundImage: "none", color: theme => theme.palette.text.primary}}>
<WidgetWrapper
widget={widget}
removeWidget={removeWidget}
fetchWidgets={fetchWidgets}
privateMode={privateMode}
draggable={draggable}
/>
</Box>
@keyframes tilt-shaking {
0% { transform: rotate(0deg); }
25% { transform: rotate(5deg); }
50% { transform: rotate(0eg); }
75% { transform: rotate(-5deg); }
100% { transform: rotate(0deg); }
}
нужно, чтобы при срабатывании draggable на тру, происходила передергивание на секунду | 5df5264baecb4b1d9a13220beb2ca334 | {
"intermediate": 0.48894813656806946,
"beginner": 0.3289318084716797,
"expert": 0.18212005496025085
} |
17,526 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
#merged_df = pd.concat([merged_df, df])
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
df = pd.merge(df, employees_df[["English Name","Position","Description_4"]],
left_on=["Worker Name"], right_on=["English Name"], how="left")
merged_df = pd.concat([merged_df, df])
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Name", "Opening balance", "Main account","English Name"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Rename the columns
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name y": "Name",
"Description_4": "Project"
})
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative", "Position", "Project"]
merged_df = merged_df[new_order]
# Fill in the missing Position and Project values with the values from Worker Name
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | 6ec139a1166be98d5fec564cf990ca1a | {
"intermediate": 0.36173444986343384,
"beginner": 0.4183584153652191,
"expert": 0.21990713477134705
} |
17,527 | Traceback (most recent call last):
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 466, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 461, in _make_request
httplib_response = conn.getresponse()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\http\client.py", line 1371, in getresponse
response.begin()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\http\client.py", line 319, in begin
version, status, reason = self._read_status()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\http\client.py", line 288, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 798, in urlopen
retries = retries.increment(
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\util\retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\packages\six.py", line 769, in reraise
raise value.with_traceback(tb)
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 466, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\urllib3\connectionpool.py", line 461, in _make_request
httplib_response = conn.getresponse()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\http\client.py", line 1371, in getresponse
response.begin()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\http\client.py", line 319, in begin
version, status, reason = self._read_status()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\http\client.py", line 288, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "e:\桌面\spider\nature.py", line 175, in <module>
article = naturebrief_spider.get_today_articles()
File "e:\桌面\spider\nature.py", line 64, in get_today_articles
article['text'] = self.get_article(article['link'])
File "e:\桌面\spider\nature.py", line 127, in get_article
html = self.fetch(url)
File "e:\桌面\spider\nature.py", line 19, in fetch
r = requests.get(url, headers=headers)
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Users\HXH\AppData\Roaming\Python\Python39\site-packages\requests\adapters.py", line 501, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
怎么解决 | 44e8c6296d1166897a961f1c04bc6a45 | {
"intermediate": 0.3750511109828949,
"beginner": 0.3630203306674957,
"expert": 0.2619285583496094
} |
17,528 | hey chat gpt what's the diffrence between try get pawn owner and get player pawn in ue4 | f9944d378c744e20002ea93f5b0be81e | {
"intermediate": 0.31530287861824036,
"beginner": 0.27911946177482605,
"expert": 0.4055776298046112
} |
17,529 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
#merged_df = pd.concat([merged_df, df])
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
df = pd.merge(df, employees_df[["English Name","Position","Description_4"]],
left_on=["Worker Name"], right_on=["English Name"], how="left")
merged_df = pd.concat([merged_df, df])
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Name", "Opening balance", "Main account","English Name"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Rename the columns
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name y": "Name",
"Description_4": "Project"
})
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative", "Position", "Project"]
merged_df = merged_df[new_order]
# Fill in the missing Position and Project values with the respective matching values for each Worker Name
worker_name_mapping = dict(merged_df[["Worker Name", "Position"]].values)
merged_df["Position"].fillna(merged_df["Worker Name"].map(worker_name_mapping), inplace=True)
project_mapping = dict(merged_df[["Worker Name", "Project"]].values)
merged_df["Project"].fillna(merged_df["Worker Name"].map(project_mapping), inplace=True)
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | 28c20fe49d2fa39e2f095fe7dd153d71 | {
"intermediate": 0.3081717789173126,
"beginner": 0.38470616936683655,
"expert": 0.3071220815181732
} |
17,530 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
#merged_df = pd.concat([merged_df, df])
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
merged_df = pd.merge(merged_df, employees_df[["English Name", "Position", "Description_4"]], left_on=["Worker Name"], right_on=["English Name"], how="inner")
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Name", "Opening balance", "Main account"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Rename the columns
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name y": "Name",
"Description_4": "Project"
})
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative"] #, "Position", "Project"]
merged_df = merged_df[new_order]
# Fill in the missing Position and Project values with the respective matching values for each Worker Name
#worker_name_mapping = dict(merged_df[["Worker Name", "Position"]].values)
#merged_df["Position"].fillna(merged_df["Worker Name"].map(worker_name_mapping), inplace=True)
#project_mapping = dict(merged_df[["Worker Name", "Project"]].values)
#merged_df["Project"].fillna(merged_df["Worker Name"].map(project_mapping), inplace=True)
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | 193f05756234c577073f356757b73bd7 | {
"intermediate": 0.3308880925178528,
"beginner": 0.41946300864219666,
"expert": 0.24964889883995056
} |
17,531 | search products between 2 ranges of price in two fields angular , show result when just finish typing | 2c83e125d92302f1e386de1ce2079da3 | {
"intermediate": 0.4511021077632904,
"beginner": 0.19164225459098816,
"expert": 0.3572556674480438
} |
17,532 | hi | 18722c68f545c5b15a6f4bb6a41f9e75 | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
17,533 | Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'scene')解决这个报错 | b9c5d238b28d1cf797799fa466130744 | {
"intermediate": 0.3603043258190155,
"beginner": 0.34666091203689575,
"expert": 0.29303479194641113
} |
17,534 | <ResponsiveContainer
minHeight={"100%"}
height="100%"
width="100%"
>
<LineChart margin={{
top: 20,
right: 0,
left: 3,
bottom: -5,
}} width={500} data={profitData}>
<CartesianGrid strokeDasharray="3 3" stroke={darkTheme ? "#5c5a57" : "#ccc"} />
<XAxis
dataKey="date"
axisLine={false}
tickLine={false}
tick={({x, y, payload}) => {
const date = dayjs(payload.value);
const weekday = date.locale("ru").format("dd");
const day = date.format("DD");
return (
<text
x={x}
y={y + 10}
textAnchor="middle"
fill="#9E9B98"
fontSize={13}
>
{`${weekday}, ${day}`}
</text>
);
}}
/>
<YAxis
orientation="right"
axisLine={false}
tickLine={false}
tick={({x, y, payload}) => {
return (
<text
x={x + 15}
y={y}
textAnchor="middle"
fill="#9E9B98"
fontSize={13}
>
{
+payload.value >= 0 ? `$${Math.abs(+payload.value)}` : `-$${Math.abs(+payload.value)}`
}
</text>
);
}}
/>
<Tooltip content={<CustomTooltip />} />
<Line
type="linear"
dataKey="profit"
stroke="#006943"
strokeWidth={3}
dot={false}
/>
</LineChart>
</ResponsiveContainer>
нужно XAxis сделать, чтобы была плотность меньше, ширина меньше, чаще были отображены | 9bb4c03b33201fe236404110b22ce36a | {
"intermediate": 0.2549154758453369,
"beginner": 0.5146927833557129,
"expert": 0.23039166629314423
} |
17,535 | How can one set up Tor in Debian GNU/Linux so that the Tor traffic is seen to websites being connected to, etc. as not being Tor traffic? Make step-by-step instructions, and then make MCQs with answers and concise explanations that collectively cover the entirety of the aforementioned instructions. | c24dc6b9f232898f669873c23788eb68 | {
"intermediate": 0.48644906282424927,
"beginner": 0.29596102237701416,
"expert": 0.21758992969989777
} |
17,536 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
#merged_df = pd.concat([merged_df, df])
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
merged_df = pd.merge(merged_df, employees_df[["Worker Name", "Position", "Description_4"]], on=["Worker Name"], how="left")
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Name", "Opening balance", "Main account"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Rename the columns
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name y": "Name",
"Description_4": "Project"
})
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative"] #, "Position", "Project"]
merged_df = merged_df[new_order]
# Fill in the missing Position and Project values with the respective matching values for each Worker Name
#worker_name_mapping = dict(merged_df[["Worker Name", "Position"]].values)
#merged_df["Position"].fillna(merged_df["Worker Name"].map(worker_name_mapping), inplace=True)
#project_mapping = dict(merged_df[["Worker Name", "Project"]].values)
#merged_df["Project"].fillna(merged_df["Worker Name"].map(project_mapping), inplace=True)
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | f04936330293cf4e19d75c263a5582e3 | {
"intermediate": 0.2909824550151825,
"beginner": 0.4427809417247772,
"expert": 0.2662366032600403
} |
17,537 | Нужно устранить ошибку, нужно listbox2 получить список цветов public static List<Color> FindPixelsInAngle(Bitmap image, double angle, int startX, int startY, int length)
{
List<Color> pixels = new List<Color>();
// Преобразуем угол в радианы
double radians = angle * Math.PI / 180.0;
// Вычисляем значения смещения по x и y на основе длины и угла
int offsetX = (int)(length * Math.Cos(radians));
int offsetY = (int)(length * Math.Sin(radians));
// Находим пиксели по заданному углу
for (int i = 0; i < length; i++)
{
int x = startX + (int)(i * Math.Cos(radians));
int y = startY + (int)(i * Math.Sin(radians));
if (x >= 0 && x < image.Width && y >= 0 && y < image.Height)
{
pixels.Add(image.GetPixel(x, y));
}
}
return pixels;
}
private void button6_Click(object sender, EventArgs e)
{
List<Color> my = new List<Color>();
my = FindPixelsInAngle((Bitmap)pictureBox1.Image, 45, 0, 0, 15);
for (int i = 0; i<my.Count; i++)
{
listBox2.Items.Add(my);
}
} | 8e89c9c332aef2330ea635faf2c5c8f4 | {
"intermediate": 0.30501464009284973,
"beginner": 0.49375176429748535,
"expert": 0.20123356580734253
} |
17,538 | Traceback (most recent call last):
File "c:\Users\Dell\Desktop\Desktop Files\ERP\Merge Files Task\mergefiles_interactive.py", line 59, in <module>
merged_df = merged_df[new_order]
~~~~~~~~~^^^^^^^^^^^
File "C:\Users\Dell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\frame.py", line 3767, in __getitem__
indexer = self.columns._get_indexer_strict(key, "columns")[1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\indexes\base.py", line 5876, in _get_indexer_strict
self._raise_if_missing(keyarr, indexer, axis_name)
File "C:\Users\Dell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\indexes\base.py", line 5938, in _raise_if_missing
raise KeyError(f"{not_found} not in index")
KeyError: "['Position', 'Project'] not in index" | 24862f21a30bcbc77e093be4ac3967fd | {
"intermediate": 0.3950362205505371,
"beginner": 0.2721989154815674,
"expert": 0.3327648341655731
} |
17,539 | Your task is to write a program which allows teachers to create a multiple choice test in a class called Testpaper and also be able to assign a minimum pass mark. The Testpaper class should implement the ITestpaper interface given in the code template which has the following properties:
string Subject
string[] MarkScheme
string PassMark
Interfaces do not define constructors for classes which implement them so you will need to add a constructor method which takes the parameters (string subject, string[] markScheme, string passMark). As well as that, we need to create student objects to take the test itself! Create another class called Student which implements the given IStudent interface which has the following members:
string[] TestsTaken
void TakeTest(ITestpaper paper, string[] answers)
Examples:
paper1 = new Testpaper("Maths", new string[] { "1A", "2C", "3D", "4A", "5A" }, "60%")
paper2 = new Testpaper("Chemistry", new string[] { "1C", "2C", "3D", "4A" }, "75%")
paper3 = new Testpaper("Computing", new string[] { "1D", "2C", "3C", "4B", "5D", "6C", "7A" }, "75%")
student1 = new Student()
student2 = new Student()
student1.TestsTaken ➞ { "No tests taken" }
student1.TakeTest(paper1, new string[] { "1A", "2D", "3D", "4A", "5A" })
student1.TestsTaken ➞ { "Maths: Passed! (80%)" }
student2.TakeTest(paper2, { "1C", "2D", "3A", "4C" })
student2.TakeTest(paper3, { "1A", "2C", "3A", "4C", "5D", "6C", "7B" })
student2.TestsTaken ➞ { "Chemistry: Failed! (25%)", "Computing: Failed! (43%)" } ... Please solve with C# code. | 0a50dd46817b62bc2e29413d0f6aba5e | {
"intermediate": 0.4930214583873749,
"beginner": 0.2955242693424225,
"expert": 0.21145421266555786
} |
17,540 | napraw funkcjoanlanosc kopiowania do schowka w tym kodzie javascript let copyText = document.querySelector('.copy-text')
let passLength = document.getElementById('length')
let passLengthDisplay = document.getElementById('pass-length')
let decrementBtn = document.getElementById('decrement-btn')
let incrementBtn = document.getElementById('increment-btn')
let refreshBtn = document.getElementById('refresh-btn')
passLengthDisplay.textContent = passLength.value
passLength.addEventListener('input', function () {
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
})
decrementBtn.addEventListener('click', function () {
if (passLength.value > 5) {
passLength.value--
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
}
})
incrementBtn.addEventListener('click', function () {
if (passLength.value < 25) {
passLength.value++
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
}
})
refreshBtn.addEventListener('click', function () {
generatePassword(passLength.value)
})
document.getElementById('copy-btn').addEventListener('click', function () {
let input = copyText.querySelector('input.input-copy-text')
input.select()
document.execCommand('copy')
copyText.classList.add('active')
window.getSelection().removeAllRanges()
setTimeout(() => {
copyText.classList.remove('active')
}, 2000)
})
const generatePassword = (lengthOfPassword) => {
const chars =
'0123456789abcdefghijklmnopqrstuvwxyz!@#$%^_±&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ'
let password = ''
const array = new Uint32Array(lengthOfPassword)
window.crypto.getRandomValues(array)
for (let i = 0; i < lengthOfPassword; i++) {
password += chars[array[i] % chars.length]
}
let input = copyText.querySelector('input.input-copy-text')
input.value = password
}
document.addEventListener('DOMContentLoaded', generatePassword(8))
. w tym momencie nie jest nic kopiowane do schiowka uzytkownika po przycvisnieciu przycisku | fe82ad811ee40088daf08f3f8c631b69 | {
"intermediate": 0.36944547295570374,
"beginner": 0.3155336380004883,
"expert": 0.31502091884613037
} |
17,541 | napraw funkcjoanlanosc kopiowania do schowka w tym kodzie javascript let copyText = document.querySelector(‘.copy-text’)
let passLength = document.getElementById(‘length’)
let passLengthDisplay = document.getElementById(‘pass-length’)
let decrementBtn = document.getElementById(‘decrement-btn’)
let incrementBtn = document.getElementById(‘increment-btn’)
let refreshBtn = document.getElementById(‘refresh-btn’)
passLengthDisplay.textContent = passLength.value
passLength.addEventListener(‘input’, function () {
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
})
decrementBtn.addEventListener(‘click’, function () {
if (passLength.value > 5) {
passLength.value–
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
}
})
incrementBtn.addEventListener(‘click’, function () {
if (passLength.value < 25) {
passLength.value++
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
}
})
refreshBtn.addEventListener(‘click’, function () {
generatePassword(passLength.value)
})
document.getElementById(‘copy-btn’).addEventListener(‘click’, function () {
let input = copyText.querySelector(‘input.input-copy-text’)
input.select()
document.execCommand(‘copy’)
copyText.classList.add(‘active’)
window.getSelection().removeAllRanges()
setTimeout(() => {
copyText.classList.remove(‘active’)
}, 2000)
})
const generatePassword = (lengthOfPassword) => {
const chars =
‘0123456789abcdefghijklmnopqrstuvwxyz!@#$%^_±&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ’
let password = ‘’
const array = new Uint32Array(lengthOfPassword)
window.crypto.getRandomValues(array)
for (let i = 0; i < lengthOfPassword; i++) {
password += chars[array[i] % chars.length]
}
let input = copyText.querySelector(‘input.input-copy-text’)
input.value = password
}
document.addEventListener(‘DOMContentLoaded’, generatePassword(8))
. w tym momencie nie jest nic kopiowane do schiowka uzytkownika po przycvisnieciu przycisku | 8ae3289d5b2cca096b71501ab63aadfd | {
"intermediate": 0.40753740072250366,
"beginner": 0.3526316285133362,
"expert": 0.23983095586299896
} |
17,542 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
# Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
print(mapping_df.columns)
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
merged_df = pd.merge(merged_df, employees_df[["Worker Name", "Position", "Description_4"]], on=["Worker Name"], how="left")
#merged_df = merged_df.drop_duplicates(subset=["Worker Name"])
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Name", "Opening balance","Main account"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Rename the columns
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name y": "Name",
"Description_4": "Project",
"Position_y": "Position"
})
print(merged_df.columns)
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative", "Position", "Project"]
merged_df = merged_df[new_order]
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file)
# Merge with the mapping file based on “Main account” column
df = pd.merge(df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
merged_df = pd.concat([merged_df, df])
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
merged_df = pd.merge(merged_df, employees_df[["Worker Name", "Position", "Description_4"]], on=["Worker Name"], how="left")
#merged_df = merged_df.drop_duplicates(subset=["Worker Name"])
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Name", "Opening balance", "Main account"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Rename the columns
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name y": "Name",
"Description_4": "Project",
"Position_y": "Position"
})
print(merged_df.columns)
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative", "Position", "Project"]
merged_df = merged_df[new_order]
# Concatenate the “Position” values for each “Worker Name”
#merged_df = merged_df.groupby("Worker Name").agg({"Position": ", ".join}).reset_index()
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | 20211ac1b6e6bee5746e19b3333b6d5f | {
"intermediate": 0.3045109510421753,
"beginner": 0.5196741223335266,
"expert": 0.17581497132778168
} |
17,543 | import pandas as pd
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
import os
# Open a Tk window
Tk().withdraw()
# Prompt the user to select input files
input_files = askopenfilenames(title="Select input files", filetypes=[("Excel Files", "*.xlsx")])
# Prompt the user to select the “Staff Gl Mapping.xlsx” file
mapping_file = askopenfilenames(title="Select Staff Gl Mapping file", filetypes=[("Excel Files", ".xlsx")])
# Prompt the user to select the “Employees Details Report old.xlsx” file
employees_file = askopenfilenames(title="Select Employees Details Report file", filetypes=[("Excel Files", ".xlsx")])
# Read the mapping file
mapping_df = pd.read_excel(mapping_file[0])
# Read the employees details file
employees_df = pd.read_excel(employees_file[0])
# Create an empty dataframe to store merged data
merged_df = pd.DataFrame()
#Read and merge the input files
for file in input_files:
df = pd.read_excel(file)
df["Project Description"] = df["Name"].str.split("|").str[2]
df["Worker Name"] = df["Name"].str.split("|").str[4]
df["Current"] = df["Debit"] - df["Credit"]
df = df.rename(columns={"Closing balance": "Cumulative"})
file_name, _ = os.path.splitext(os.path.basename(file))
df["Date"] = file_name
merged_df = pd.concat([merged_df, df])
# Merge with the mapping file based on “Main account” column
merged_df = pd.merge(merged_df, mapping_df[["Main account", "Name y"]], left_on="MainAccount", right_on="Main account", how="left")
#merged_df = pd.concat([merged_df, df])
merged_df = pd.concat([merged_df.reset_index(drop=True), df.reset_index(drop=True)], ignore_index=True)
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
merged_df = pd.merge(merged_df, employees_df[["Worker Name", "Position", "Description_4"]], on=["Worker Name"], how="left")
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Name", "Opening balance","Main account"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Rename the columns
print(merged_df.index)
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name y": "Name",
"Description_4": "Project",
"Position_y": "Position"
})
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative", "Position", "Project"]
merged_df = merged_df[new_order]
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
merged_df.to_excel(output_file, index=False)
print("Merged dataframe has been written to", output_file) | 253d142f3343ee5858bae04a5a749e63 | {
"intermediate": 0.3145454227924347,
"beginner": 0.45292937755584717,
"expert": 0.23252518475055695
} |
17,544 | do tego kodu html w show-btn dodaj funkcjonalnosc pokazywania i ukrywania hasla. ukrywanie hasla ma sie wykonywac za pomoca klasy css i ma byc domyslnie wlaczone. oto kod html i javascript <html lang="pl">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Random Pass</title>
<link rel="stylesheet" href="style.css" />
<script
src="https://kit.fontawesome.com/7d1bf8d33a.js"
crossorigin="anonymous"></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap"
rel="stylesheet" />
</head>
<body>
<div class="container">
<h1>Random password generator</h1>
<div class="text">
<p>
Create strong and secure passwords to keep your account safe online.
</p>
</div>
<div class="length-settings">
<label for="length">Password Length:</label>
<span id="pass-length"></span>
<div class="length-range">
<button id="decrement-btn">-</button>
<input
type="range"
id="length"
name="length"
min="5"
max="25"
value="8" />
<button id="increment-btn">+</button>
</div>
</div>
<div class="copy-text">
<div class="input-copy-text"></div>
<div class="pass-settings">
<button class="btn-copy" id="show-btn">
<i class="none fa-regular fa-eye-slash"></i>
<i class="fa-regular fa-eye"></i>
</button>
<button class="btn-copy" id="refresh-btn">
<i class="fas fa-solid fa-rotate-left"></i>
</button>
<button id="copy-btn" class="btn-copy">
<i class="far fa-clone"></i>
</button>
</div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
const copyText = document.querySelector('.copy-text')
const input = document.querySelector('.input-copy-text')
const passLength = document.querySelector('#length')
const passLengthDisplay = document.querySelector('#pass-length')
const decrementBtn = document.querySelector('#decrement-btn')
const incrementBtn = document.querySelector('#increment-btn')
const refreshBtn = document.querySelector('#refresh-btn')
const copyBtn = document.querySelector('#copy-btn')
passLengthDisplay.textContent = passLength.value
passLength.addEventListener('input', () => {
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
})
decrementBtn.addEventListener('click', () => {
if (passLength.value > 5) {
passLength.value--
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
}
})
incrementBtn.addEventListener('click', () => {
if (passLength.value < 25) {
passLength.value++
passLengthDisplay.textContent = passLength.value
generatePassword(passLength.value)
}
})
refreshBtn.addEventListener('click', () => {
generatePassword(passLength.value)
})
const copy = () => {
navigator.clipboard.writeText(input.textContent).then(function () {
copyText.classList.add('active')
window.getSelection().removeAllRanges()
setTimeout(() => {
copyText.classList.remove('active')
}, 2000)
})
}
copyBtn.addEventListener('click', copy)
input.addEventListener('click', copy)
const generatePassword = (lengthOfPassword) => {
const chars =
'0123456789abcdefghijklmnopqrstuvwxyz!@#$%^_±&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ'
let password = ''
const array = new Uint32Array(lengthOfPassword)
window.crypto.getRandomValues(array)
for (let i = 0; i < lengthOfPassword; i++) {
password += chars[array[i] % chars.length]
}
input.textContent = password
}
document.addEventListener('DOMContentLoaded', generatePassword(8)) | aeaa7266b2b4940ab7bf0a90d433107f | {
"intermediate": 0.2832607626914978,
"beginner": 0.5173048377037048,
"expert": 0.1994343400001526
} |
17,545 | private void button7_Click(object sender, EventArgs e)
{
Bitmap image = (Bitmap)pictureBox1.Image;
int cvb = 0; int y;
for (int i = 0; i < image.Width; i++)
{
for ( y = 0; y < image.Height; y++)
{
// Если не белый цвет значит есть писксель
Color color1 = image.GetPixel(i, y);
if ((color1.R == 255) && (color1.G == 255) && (color1.B == 255))
{
// Будем считать что цвет белый
}
else
{
cvb++;
}
}
//
if (cvb > 5) {
for (int n = 0; n < image.Width;n++) {
Color color1 = Color.FromArgb(0, 0, 0, 0);
image.SetPixel(n, y, color1);
}
}
// Count.Add(cvb);
cvb = 0;
}
//MessageBox.Show(Count.ToString());
} | 023244fc653ff0537e1005d33720d8f3 | {
"intermediate": 0.33533763885498047,
"beginner": 0.45850124955177307,
"expert": 0.20616114139556885
} |
17,546 | can you show me a gpc script which presses a combo of buttons ? | 94fefc60777a7d7043c31b9b55666d25 | {
"intermediate": 0.5470885634422302,
"beginner": 0.17139452695846558,
"expert": 0.2815169095993042
} |
17,547 | how can i customize on the event appearance in fullcalender component here is my code import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { CalendarOptions } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from "@fullcalendar/interaction";
import { FullCalendarComponent } from '@fullcalendar/angular';
@Component({
selector: 'app-bulkactioncalender',
templateUrl: './bulkactioncalender.component.html',
styleUrls: ['./bulkactioncalender.component.scss']
})
export class BulkactioncalenderComponent implements OnInit {
@ViewChild('eventContainer', { static: true }) eventContainer: ElementRef;
@ViewChild('fullcalendar', { static: false }) fullcalendar: FullCalendarComponent;
calendarOptions: CalendarOptions;
viewOptions: string[] = ['monthly', 'weekly', 'daily'];
selectedView: string = 'monthly';
value='dayGridMonth';
customTitleVisible=true;
constructor(){}
ngOnInit(): void {
this.calendarOptions = {
plugins: [dayGridPlugin, timeGridPlugin,
interactionPlugin,],
headerToolbar: {
left: 'prev',
center: 'title',
right: 'next',
},
initialView: this.value,
eventDidMount: this.eventDidMount.bind(this),
events: this.getEvents.bind(this)
// events: [
// // Add your events here
// { title: 'Event 1', date: '2023-08-10' },
// { title: 'Event 2', date: '2023-08-12' },
// { title: 'Event 3', date: '2023-08-12' },
// ]
};
}
onViewChange(): void {
this.getSelectedView();
}
getSelectedView() {
if (this.selectedView === 'monthly') {
this.value= 'dayGridMonth';
this.renderCalendar();
} else if (this.selectedView === 'weekly') {
this.value= 'dayGridWeek';
this.renderCalendar();
} else if (this.selectedView === 'daily') {
this.value ='timeGridDay';
this.renderCalendar();
}
}
renderCalendar(): void {
if (this.fullcalendar) {
this.fullcalendar.getApi().changeView(this.value);
}
}
eventDidMount(info: any) {
const eventEl = info.el;
eventEl.addEventListener('click', (e) => {
this.handleEventClick(e, info.event);
});
}
getEvents(info: any, successCallback: any, failureCallback: any) {
const events = [
{ title: 'Event 1', date: '2023-08-10' },
{ title: 'Event 2', date: '2023-08-12' },
{ title: 'Event 3', date: '2023-08-12' },
];
successCallback(events);
}
handleEventClick(event: Event, clickedEvent: any) {
// Access the clicked event and perform actions
console.log("Hello wolrd")
console.log(clickedEvent);
}
// customEventRender(info: any): void {
// console.log ("test");
// const eventDate = info.event.start;
// const weekNumber = Math.ceil((eventDate.getDate() + 6 - eventDate.getDay()) / 7);
// const monthName = eventDate.toLocaleString('default', { month: 'long' });
// const year = eventDate.getFullYear();
// const titleElement = document.createElement('div');
// titleElement.classList.add('fc-toolbar-title');
// titleElement.innerHTML = `Week${weekNumber}, ${monthName} ${year}`;
// info.el.querySelector('.fc-event-title-container').appendChild(titleElement);
// }
} | d8171f4d17e667d0b803a10d5ed04d08 | {
"intermediate": 0.3422960042953491,
"beginner": 0.45234453678131104,
"expert": 0.20535938441753387
} |
17,548 | how read Monitor,and Size with wmi in c# | ba959a548ea4339e0a48c460794c67c1 | {
"intermediate": 0.6453534364700317,
"beginner": 0.16772159934043884,
"expert": 0.18692494928836823
} |
17,549 | I have a table with columns date, gp, delivery, Disc. How to write Dax expression for calculated column if required to find (gp - delivery)/Disc for all transaction in month to which date belongs? | d093faeb4652e3fcf8b718fc41c6cb02 | {
"intermediate": 0.4607565104961395,
"beginner": 0.1753586232662201,
"expert": 0.36388492584228516
} |
17,550 | I have a table with columns date, gp, delivery, Disc, action. How to write Dax expression for calculated column if required to find (gp - delivery)/Disc for all transactions for each action? | 8d34d0d0a5ee9b988ff3a17ef9932b89 | {
"intermediate": 0.45349010825157166,
"beginner": 0.2063864916563034,
"expert": 0.34012341499328613
} |
17,551 | The game mode is REVERSE: You do not have access to the statement. You have to guess what to do by observing the following set of tests:
01 Test 1
Input
Expected output
13 5 1 20
1 5 13 20
02 Test 2
Input
Expected output
1 2 3 4 5 6 7 8 9 10
1 3 5 7 9 10 8 6 4 2
03 Test 3
Input
Expected output
1 2 3 2 5 2 5 4 6 3 8
1 3 5 8 6 4 2 Please solve with C# code. Seams to be need put odd numbers in ascending order, then put even numbers in decending order. | 13d16306b301ef62d86315f418107baf | {
"intermediate": 0.3282565474510193,
"beginner": 0.48303553462028503,
"expert": 0.18870799243450165
} |
17,552 | Your task is to write a program which allows teachers to create a multiple choice test in a class called Testpaper and also be able to assign a minimum pass mark. The Testpaper class should implement the ITestpaper interface given in the code template which has the following properties:
string Subject
string[] MarkScheme
string PassMark
Interfaces do not define constructors for classes which implement them so you will need to add a constructor method which takes the parameters (string subject, string[] markScheme, string passMark). As well as that, we need to create student objects to take the test itself! Create another class called Student which implements the given IStudent interface which has the following members:
string[] TestsTaken
void TakeTest(ITestpaper paper, string[] answers)
Examples:
paper1 = new Testpaper("Maths", new string[] { "1A", "2C", "3D", "4A", "5A" }, "60%")
paper2 = new Testpaper("Chemistry", new string[] { "1C", "2C", "3D", "4A" }, "75%")
paper3 = new Testpaper("Computing", new string[] { "1D", "2C", "3C", "4B", "5D", "6C", "7A" }, "75%")
student1 = new Student()
student2 = new Student()
student1.TestsTaken ➞ { "No tests taken" }
student1.TakeTest(paper1, new string[] { "1A", "2D", "3D", "4A", "5A" })
student1.TestsTaken ➞ { "Maths: Passed! (80%)" }
student2.TakeTest(paper2, { "1C", "2D", "3A", "4C" })
student2.TakeTest(paper3, { "1A", "2C", "3A", "4C", "5D", "6C", "7B" })
student2.TestsTaken ➞ { "Chemistry: Failed! (25%)", "Computing: Failed! (43%)" } ... Please solve with C# code. | ed692fd752c47276d0cd3f615e36aa14 | {
"intermediate": 0.4930214583873749,
"beginner": 0.2955242693424225,
"expert": 0.21145421266555786
} |
17,553 | Design a BankAccount class that stores a name and balance.Add the following method:
public string ShowUserNameAndBalance()
Your method should return a string that contains the account’s name and balance separated by a comma and space. For example, if an account object named benben has the name “Benson” and a balance of 17.25, the call of benben.ShowUserNameAndBalance() should return:
Benson, $17.25
There are some special cases you should handle. If the balance is negative, put the - sign before the dollar sign. Also, always display the cents as a two-digit number. For example, if the same object had a balance of -17.5, your method should return: Benson, -$17.50 Please solve it with C# code. | b48fe7a5f77fb925b1e8bbd34356cf60 | {
"intermediate": 0.3565962016582489,
"beginner": 0.4568658769130707,
"expert": 0.186537966132164
} |
17,554 | Design a BankAccount class that stores a name and balance.Add the following method:
public string ShowUserNameAndBalance()
Your method should return a string that contains the account’s name and balance separated by a comma and space. For example, if an account object named benben has the name “Benson” and a balance of 17.25, the call of benben.ShowUserNameAndBalance() should return:
Benson, $17.25
There are some special cases you should handle. If the balance is negative, put the - sign before the dollar sign. Also, always display the cents as a two-digit number. For example, if the same object had a balance of -17.5, your method should return: Benson, -$17.50 Please solve it with C# code. | c86cf7a119ba14dddee1e22c20ee72a4 | {
"intermediate": 0.3565962016582489,
"beginner": 0.4568658769130707,
"expert": 0.186537966132164
} |
17,555 | Given a string s, you choose some substring s[l...r] (1 ≤ l ≤ r ≤ |s|) exactly once and reverse it. For example, in the string geeks, select the substring s[2...4], after performing the mentioned operation, the new string will be gkees.
Count the number of unique strings that can be obtained by doing this operation exactly once. | c02d07d3e217628b8d3efa8296cd039c | {
"intermediate": 0.3321974575519562,
"beginner": 0.18345069885253906,
"expert": 0.48435187339782715
} |
17,556 | Give me detailed instructions on how to recreate a status chart in ingnition perspective module 8.1, using an XY chart as a gantt chart. give me step by step on what to do and how to bind data from a database. I will need the chart to display four machines and the status bar should show within the timeline when they were on and off. Give me all the instructions and step by step on how to do it. | 3b917af35048364d158261ef966e4d78 | {
"intermediate": 0.500104546546936,
"beginner": 0.22797544300556183,
"expert": 0.27191999554634094
} |
17,557 | whats an extremely fast, and customizable browser emulation library thats preferably lightweight for golang? | 9b8a2e6672d0a860a16e6cf52d004dae | {
"intermediate": 0.7417910695075989,
"beginner": 0.11476452648639679,
"expert": 0.14344437420368195
} |
17,558 | How to count sum of numbers from a to b? | 915feffd462857b4a5e463e4672b146a | {
"intermediate": 0.3158552944660187,
"beginner": 0.23872125148773193,
"expert": 0.44542351365089417
} |
17,559 | How to determine consist year 29 february or not in Python? | de4c72c9bf4613ab362ccfc6a5e22376 | {
"intermediate": 0.3008882403373718,
"beginner": 0.21639475226402283,
"expert": 0.48271700739860535
} |
17,560 | How to get list of files in directory in Python? | 307c4d42cd3b3951d2934398c2254296 | {
"intermediate": 0.5256773829460144,
"beginner": 0.18299201130867004,
"expert": 0.2913306653499603
} |
17,561 | How to find prime numbers in Python? | 0b7727b1ecfd6677f555c44b56d9f38c | {
"intermediate": 0.22711603343486786,
"beginner": 0.12968750298023224,
"expert": 0.6431964635848999
} |
17,562 | draw a 6 input stereo low noise hi fi schematics | ec77a5df25da436379ee13db4fa3a31d | {
"intermediate": 0.33802515268325806,
"beginner": 0.3008114993572235,
"expert": 0.36116331815719604
} |
17,563 | write the code in c for a 3 hidden layer feed forward backpropagation neural network | 8fcbc736831ce7e3555ed8154236168e | {
"intermediate": 0.08990582823753357,
"beginner": 0.05365388095378876,
"expert": 0.8564403057098389
} |
17,564 | write the code in c for a 3 hidden layer feed forward backpropagation neural network | 1487e12b1a69935582ed02fe94e83617 | {
"intermediate": 0.08990582823753357,
"beginner": 0.05365388095378876,
"expert": 0.8564403057098389
} |
17,565 | how can I make a variable that carry the current value of the current option in js I have an input from type select opthinn and I want to get the vaalue that is selected | bc67af96543673c03eb8acaa3ac0294c | {
"intermediate": 0.28993096947669983,
"beginner": 0.45095592737197876,
"expert": 0.2591131329536438
} |
17,566 | How to force Linux to return content of the swap to RAM? | 26800018b2d9248bb3abbb3797d72d5a | {
"intermediate": 0.301456481218338,
"beginner": 0.2274094671010971,
"expert": 0.4711340367794037
} |
17,567 | how to solve fractional delayed duffing equation matlab | a927425b4bb5ad8f72df52bd0a67a020 | {
"intermediate": 0.25268739461898804,
"beginner": 0.30579739809036255,
"expert": 0.4415152668952942
} |
17,568 | in my sql the query:
date(from_unixtime(event_timestamp)) AS theDate is giving me a wrong year can you fix it so it shows correctly | d9a0531478ca741522e3a85b6d482746 | {
"intermediate": 0.42316654324531555,
"beginner": 0.3180018663406372,
"expert": 0.25883162021636963
} |
17,569 | code to effectively switch off the debug information that would have been printed when running the program in rust | f920c6c0d3c3420a0ded62d93cf5714b | {
"intermediate": 0.5086596012115479,
"beginner": 0.15633679926395416,
"expert": 0.33500364422798157
} |
17,570 | add to the query to create columns that reflects the timestamp when the event value changes from 0 to 1 as start_time and when it changes from 1 to 0 as end_time:
SELECT
(from_unixtime(event_timestamp/1000))AS DATE,
CASE
WHEN event_value = 0 THEN 'OFF'
WHEN event_value = 1 THEN 'ON'
END AS Furnace_Status
FROM
database.table
WHERE
field_name = 'bV1_Status' AND p_id = '0000'
GROUP BY
DATE, event_value
ORDER BY DATE DESC
LIMIT 100
; | 2ef9f7ea178beb72cf43701a57f63c82 | {
"intermediate": 0.33704671263694763,
"beginner": 0.29807430505752563,
"expert": 0.3648790121078491
} |
17,571 | Can you please write an excel VBA event that will do the following;
Copy range B1:C21 in worksheet 'Today'
and paste values only into worksheet 'Notes' range A:B
starting from the first empty row | f68a66a9b4e968cca13c859ce4a85ae7 | {
"intermediate": 0.4020484983921051,
"beginner": 0.24924327433109283,
"expert": 0.34870827198028564
} |
17,572 | make a javascript script that has a list of endpoints and for each of them generates an invisible Iframe | f2353aa4850abb913783d767679d0bfb | {
"intermediate": 0.405556321144104,
"beginner": 0.25229549407958984,
"expert": 0.34214818477630615
} |
17,573 | element plus focus on input after open dialog | 049894145c959f4e6bde4b837d6e9ae3 | {
"intermediate": 0.354808509349823,
"beginner": 0.3604236841201782,
"expert": 0.2847678065299988
} |
17,574 | make a python script that sends a http syn request, do no reply or aknowlae any responces | a2931b44454c383b211cc169e7b812f5 | {
"intermediate": 0.3908108174800873,
"beginner": 0.22442714869976044,
"expert": 0.3847620189189911
} |
17,575 | can you install hpin3 on windows? | 83569df5e397d132d04382e2bd8782ca | {
"intermediate": 0.4488649070262909,
"beginner": 0.17470288276672363,
"expert": 0.37643224000930786
} |
17,576 | Lemme rety as youre not getting it, its a cli app you access via ssh, ot tuns automatically when you connect via ssh, the app has commands, two dummy test commands (help and whoami) and annother to escape the app which will check if you connected as root and close the app if you are, otherwise youre stuck in the app unable to escape into the os whatever you do. | af6787315f7b20ed7b7af7674833a075 | {
"intermediate": 0.37902000546455383,
"beginner": 0.2941285967826843,
"expert": 0.3268514573574066
} |
17,577 | study.optimize(lambda trial: objective(trial), n_trials=n_trials) also pass in criterion, optimizer, scheduler, | 24f3f7f2f4d702c0e44d1bc47ed8b6de | {
"intermediate": 0.13906417787075043,
"beginner": 0.09244052320718765,
"expert": 0.7684952616691589
} |
17,578 | Lets make a robloc ui library, lets start with the boilerplate | 54e12584bb1fc18c889e27b73911ab50 | {
"intermediate": 0.6094101071357727,
"beginner": 0.14452263712882996,
"expert": 0.24606730043888092
} |
17,579 | How can I write this VBA event so that when the new sheet is created 'newSheet.Name = "Task" & Format(Now(), "DDMMYY")'
it copies values and cell format but not formulas
Sub StartC()
Dim wbk1 As Workbook
Dim ws1 As Worksheet
Dim newSheet As Worksheet
Set wbk1 = ThisWorkbook
Set ws1 = ThisWorkbook.Worksheets("Today")
Application.ScreenUpdating = False
ws1.Activate
With ws1.Range("G22")
If Not IsDate(.Value) Then
MsgBox "No date"
ElseIf .Value <> Date Then
' Create new sheet without copying VBA code
ws1.Range("G22").Value = ws1.Range("A22").Value
Set newSheet = wbk1.Sheets.Add(After:=wbk1.Sheets(wbk1.Sheets.Count))
newSheet.Name = "Task" & Format(Now(), "DDMMYY")
newSheet.Visible = False
'ws1.Cells.Copy Destination:=newSheet.Cells
ws1.Range("A1:F22").Copy
newSheet.Range("A1").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.Wait (Now + TimeValue("0:00:01"))
ws1.Visible = True
newSheet.Visible = True
Debug.Print "Used range in new sheet: " & newSheet.UsedRange.Address
Call ClearC
Else
MsgBox "Date Is Today"
End If
End With
Application.ScreenUpdating = True
Application.Wait (Now + TimeValue("0:00:01"))
End
End Sub | 58711eab3b71a37a452bd1b2f3a29daf | {
"intermediate": 0.5902619361877441,
"beginner": 0.22188498079776764,
"expert": 0.18785302340984344
} |
17,580 | A for loop is effective for looping through a list, but you shouldn’t mod-ify a list inside a for loop because Python will have trouble keeping track of the items in the list. To modify a list as you work through it, use a while loop. Using while loops with lists and dictionaries allows you to collect, store, and organize lots of input to examine and report on later.
Can you explain this more? Why is it better to use a while loop to modify a list instead of a for loop? | 213e65e3c7ce0241f0f343fa7bacbd0d | {
"intermediate": 0.2591099441051483,
"beginner": 0.6311381459236145,
"expert": 0.1097518801689148
} |
17,581 | Glvnd libOpenGL.so workflow | 3908c66e4868604a962469bdbdd0e17f | {
"intermediate": 0.6087674498558044,
"beginner": 0.21656426787376404,
"expert": 0.1746682971715927
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.