row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
3,010
|
如何使用torch.jit多以下模型的编译优化,提高推理的速度
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("models")
model = T5ForConditionalGeneration.from_pretrained("models")
|
78e39c9598660d01f3dcd80804160fa7
|
{
"intermediate": 0.4091046154499054,
"beginner": 0.31091198325157166,
"expert": 0.27998337149620056
}
|
3,011
|
in python write API, how to locate some certain phrase and modify the following content
|
434e88929a98503d8d2d4e67fde6c1cb
|
{
"intermediate": 0.6712393760681152,
"beginner": 0.1423710435628891,
"expert": 0.18638963997364044
}
|
3,012
|
explain quantim
|
d4a4967ef92103ae248e6f16987e2cc6
|
{
"intermediate": 0.21327842772006989,
"beginner": 0.2525119185447693,
"expert": 0.5342096090316772
}
|
3,013
|
For this javascript p5.js code, I need the user to be alerted after they drag they words into the correct positions to make the full sentence. when the words match the sentence, the user wins: let words = [
{id: 1, text: “was”},
{id: 2, text: “dog”},
{id: 3, text: “the”},
{id: 4, text: “here”},
{id: 5, text: “this”},
{id: 6, text: “morning”}
];
let boxX = 10;
let boxY = 100;
let boxWidth = 380;
let boxHeight = 50;
function setup() {
createCanvas(400, 200);
textAlign(CENTER, CENTER);
textSize(18);
// Scatter words randomly on the canvas
for (let word of words) {
word.x = random(10, width - 110);
word.y = random(50, height - 50);
word.draggable = null;
}
}
function draw() {
background(220);
// Draw the box
fill(255);
rect(boxX, boxY, boxWidth, boxHeight);
for (let word of words) {
if (word.draggable) {
word.x = mouseX;
word.y = mouseY;
}
fill(255);
rect(word.x - 10, word.y - 10, textWidth(word.text) + 20, 30);
fill(0);
text(word.text, word.x + textWidth(word.text) / 2, word.y);
}
}
function mousePressed() {
for (let word of words) {
let wordWidth = textWidth(word.text);
if (mouseX > word.x - 10 && mouseX < word.x + wordWidth + 10 && mouseY > word.y - 10 && mouseY < word.y + 20) {
word.draggable = true;
}
}
}
function mouseReleased() {
for (let word of words) {
word.draggable = false;
}
}
function mouseClicked() {
let correctOrder = [3, 2, 1, 4, 6, 5];
let wordPositions = words
.filter(word => word.y > boxY && word.y < boxY + boxHeight)
.sort((a, b) => a.x - b.x)
.map(word => word.id);
if (wordPositions.toString() == correctOrder.toString()) {
alert(“Congratulations! The sentence is correct!”);
}
}
|
e75f48402d0773a346065b875061497d
|
{
"intermediate": 0.5193035006523132,
"beginner": 0.23667538166046143,
"expert": 0.24402117729187012
}
|
3,014
|
with applescript open finder window
|
996c8422c554e7170b3239f5e69a3262
|
{
"intermediate": 0.35462695360183716,
"beginner": 0.3333948254585266,
"expert": 0.311978280544281
}
|
3,015
|
be a translate util that can convert Chinese to English
|
ba219e279e8265160a26bc82f0a1ab3c
|
{
"intermediate": 0.3148229718208313,
"beginner": 0.3437651991844177,
"expert": 0.341411828994751
}
|
3,017
|
I need this kinda tool to auto fill all my data when I click the linked. Last name, firstname, passport number, email and phone number. On click i want it to autofill in each box.
|
34ac6089ca18b5e31cf3f7eb9015ca62
|
{
"intermediate": 0.34550878405570984,
"beginner": 0.2752108871936798,
"expert": 0.37928029894828796
}
|
3,018
|
write me a bootstrap code for table of 4 columns named semester,subject code,marks,result
|
7dccc5c016f76cf49034b808d33ffeef
|
{
"intermediate": 0.36662620306015015,
"beginner": 0.22408521175384521,
"expert": 0.40928858518600464
}
|
3,019
|
show me some examples in c++ with std function
|
18588421246c68d284afcfe62f8d2890
|
{
"intermediate": 0.26411136984825134,
"beginner": 0.6539275646209717,
"expert": 0.08196105062961578
}
|
3,020
|
I need a Unity function that will let me move camera smoothly between two positions with damping and fixed time of movement no matter the distance between those two points
|
e209fd030282aa03269eafc6aea1a4cc
|
{
"intermediate": 0.5462106466293335,
"beginner": 0.18143481016159058,
"expert": 0.2723546028137207
}
|
3,021
|
I need a Unity function that will let me move camera smoothly between two positions with damping. Additionaly to that there should be separate function with the same thing for rotation
|
90a3c4ce25f6bb6eeabfc28001cf74d8
|
{
"intermediate": 0.48635274171829224,
"beginner": 0.2820044755935669,
"expert": 0.23164275288581848
}
|
3,022
|
In batch: can you pause with a custom message?
|
38ba88d2befdaff1cbd9f500ac81d433
|
{
"intermediate": 0.4596818685531616,
"beginner": 0.24159029126167297,
"expert": 0.2987278699874878
}
|
3,023
|
#include <stdio.h> int main(void) { printf("\r\nHello World.\r\n"); return 0;}
|
56aca388d7979bd7a55a34eb861c70a3
|
{
"intermediate": 0.38849496841430664,
"beginner": 0.34634095430374146,
"expert": 0.2651641368865967
}
|
3,024
|
Есть две программы на языке Си с сокетами TCP, первая - client.c:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEF_PORT 8888
#define DEF_IP "127.0.0.1"
int main(int argc, char **argv)
{
char *addr;
int port;
char *readbuf;
printf("Using default port %d\n", DEF_PORT);
port = DEF_PORT;
printf("Using default addr %s\n", DEF_IP);
addr = DEF_IP;
// создаем сокет
struct sockaddr_in peer;
peer.sin_family = AF_INET;
peer.sin_port = htons(port);
peer.sin_addr.s_addr = inet_addr(addr);
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0)
{
perror("Can't create socket\n");
exit(1);
}
// присоединяемся к серверу
int res = connect(sock, (struct sockaddr *)&peer, sizeof(peer));
if (res)
{
perror("Can't connect to server:");
exit(1);
}
// основной цикл программы
char buf[100];
int first_msg = 1;
for (;;)
{
printf("Input request (empty to exit)\n");
if (first_msg == 0){
bzero(buf, 100);
fgets(buf, 100, stdin);
buf[strlen(buf) - 1] = '\0';
}
else{
strcpy(buf, argv[1]);
buf[strlen(buf)] = '\0';
first_msg = 0;
}
if (strlen(buf) == 0)
{
printf("Bye-bye\n");
return 0;
}
res = sendFix(sock, buf, 0);
if (res <= 0)
{
perror("Error while sending:");
exit(1);
}
bzero(buf, 100);
res = readFix(sock, buf, 100, 0);
if (res <= 0)
{
perror("Error while receiving:");
exit(1);
}
printf("Server's response: %s\n", buf);
}
return 0;
}
int readFix(int sock, char *buf, int bufSize, int flags)
{
// читаем "заголовок" - сколько байт составляет наше сообщение
unsigned msgLength = 0;
int res = recv(sock, &msgLength, sizeof(unsigned), flags | MSG_WAITALL);
if (res <= 0)
return res;
if (res > bufSize)
{
printf("Recieved more data, then we can store, exiting\n");
exit(1);
}
// читаем само сообщение
return recv(sock, buf, msgLength, flags | MSG_WAITALL);
}
int sendFix(int sock, char *buf, int flags)
{
// число байт в сообщении
unsigned msgLength = strlen(buf);
int res = send(sock, &msgLength, sizeof(unsigned), flags);
if (res <= 0)
return res;
send(sock, buf, msgLength, flags);
}
Вторая - server.c:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEF_PORT 8888
#define DEF_IP "127.0.0.1"
// обработка одного клиента
//
void *
clientHandler(void *args)
{
int sock = (int)args;
char buf[100];
int res = 0;
for (;;)
{
bzero(buf, 100);
res = readFix(sock, buf, 100, 0);
if (res <= 0)
{
perror("Can't recv data from client, ending thread\n");
pthread_exit(NULL);
}
printf("Some client sent: %s\n", buf);
res = sendFix(sock, buf, 0);
if (res <= 0)
{
perror("send call failed");
pthread_exit(NULL);
}
}
}
int main(int argc, char **argv)
{
int port = 0;
if (argc < 2)
{
printf("Using default port %d\n", DEF_PORT);
port = DEF_PORT;
}
else
port = atoi(argv[1]);
struct sockaddr_in listenerInfo;
listenerInfo.sin_family = AF_INET;
listenerInfo.sin_port = htons(port);
listenerInfo.sin_addr.s_addr = htonl(INADDR_ANY);
int listener = socket(AF_INET, SOCK_STREAM, 0);
if (listener < 0)
{
perror("Can't create socket to listen: ");
exit(1);
}
int res = bind(listener, (struct sockaddr *)&listenerInfo, sizeof(listenerInfo));
if (res < 0)
{
perror("Can't bind socket");
exit(1);
}
// слушаем входящие соединения
res = listen(listener, 5);
if (res)
{
perror("Error while listening:");
exit(1);
}
// основной цикл работы
for (;;)
{
int client = accept(listener, NULL, NULL);
pthread_t thrd;
res = pthread_create(&thrd, NULL, clientHandler, (void *)(client));
if (res)
{
printf("Error while creating new thread\n");
}
}
return 0;
}
int readFix(int sock, char *buf, int bufSize, int flags)
{
// читаем "заголовок" - сколько байт составляет наше сообщение
unsigned msgLength = 0;
int res = recv(sock, &msgLength, sizeof(unsigned), flags | MSG_WAITALL);
if (res <= 0)
return res;
if (res > bufSize)
{
printf("Recieved more data, then we can store, exiting\n");
exit(1);
}
// читаем само сообщение
return recv(sock, buf, msgLength, flags | MSG_WAITALL);
}
int sendFix(int sock, char *buf, int flags)
{
// шлем число байт в сообщении
unsigned msgLength = strlen(buf);
int res = send(sock, &msgLength, sizeof(unsigned), flags);
if (res <= 0)
return res;
send(sock, buf, msgLength, flags);
}
Модифицируй программы так, чтобы использовались сокеты UDP.
|
8cd41fe2c8efad142ccb46a08ac5ac54
|
{
"intermediate": 0.32729578018188477,
"beginner": 0.454765647649765,
"expert": 0.21793851256370544
}
|
3,025
|
java code to retrieve all available hardware IDs like CPU and Network device
|
d0713943b39963a73ee81a5f10ab2228
|
{
"intermediate": 0.5276175141334534,
"beginner": 0.2353266328573227,
"expert": 0.23705586791038513
}
|
3,026
|
CREATE SEQUENCE SEQ_USER
START WITH 1
INCREMENT BY 1;
CREATE TABLE QRY_QUEUE
(
ID NUMBER,
C_IN_TIME DATE,
C_EXEC_TIME DATE,
C_ST VARCHAR2 (1 BYTE),
C_QRY_TYPE NUMBER
);
CREATE TABLE ST_ABONENTS
(
ID NUMBER,
C_NAME VARCHAR2 (100 BYTE)
);
CREATE TABLE QRY_TYPE
(
ID NUMBER,
C_AB_REF NUMBER,
C_NAME VARCHAR2 (210 BYTE)
);
BEGIN
FOR i IN 1 .. 5
LOOP
INSERT INTO ST_ABONENTS
VALUES (SEQ_USER.NEXTVAL, 'Абонент№' || i);
END LOOP;
FOR i IN 6 .. 7
LOOP
INSERT INTO ST_ABONENTS
VALUES (SEQ_USER.NEXTVAL, 'Абонент№' || i);
END LOOP;
DECLARE
I NUMBER;
CNT NUMBER := 2;
CNT1 NUMBER := 0;
CURSOR c_obj
IS
SELECT a1.id
FROM ST_ABONENTS a1
ORDER BY a1.C_name;
BEGIN
FOR plp$c_obj IN c_obj
LOOP
I := plp$c_obj.id;
cnt := cnt + 2;
IF cnt > 5
THEN
cnt := 2;
END IF;
FOR j IN 1 .. cnt
LOOP
cnt1 := cnt1 + 1;
INSERT INTO QRY_TYPE
VALUES (
SEQ_USER.NEXTVAL,
I,
'Сообщение ВИД № ' || cnt1);
END LOOP;
NULL;
END LOOP;
END;
DECLARE
I NUMBER;
s INTEGER := 0;
s1 INTEGER := 0;
go_out INTEGER := 0;
go_out1 INTEGER := 0;
tempID NUMBER;
tempIDprev NUMBER;
CURSOR c_obj
IS
SELECT a1.id
FROM QRY_TYPE a1
ORDER BY a1.C_name;
BEGIN
FOR plp$c_obj IN c_obj
LOOP
I := plp$c_obj.id;
go_out1 := go_out1 + 1;
IF go_out1 = 22
THEN
EXIT;
END IF;
FOR j IN 1 .. 150
LOOP
s := s + 1;
IF s >= 55
THEN
s := 0;
END IF;
s1 := s + 4;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 23:40:' || s,
'DD/MM/YYYY HH24:MI:SS'),
TO_DATE ('01/01/2015 23:41:' || s1,
'DD/MM/YYYY HH24:MI:SS'),
1,
I);
END LOOP;
END LOOP;
FOR plp$c_obj IN c_obj
LOOP
I := plp$c_obj.id;
go_out := go_out + 1;
IF go_out <= 10
THEN
FOR j IN 1 .. 50
LOOP
s := s + 1;
IF s >= 40
THEN
s := 0;
END IF;
s1 := s + 6;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 23:45:' || s,
'DD/MM/YYYY HH24:MI:SS'),
TO_DATE ('01/01/2015 23:46:' || s1,
'DD/MM/YYYY HH24:MI:SS'),
1,
I);
END LOOP;
ELSIF go_out <= 13
THEN
FOR j IN 1 .. 13
LOOP
s := s + 1;
IF s >= 30
THEN
s := 0;
END IF;
s1 := s + 5;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 13:50:10',
'DD/MM/YYYY HH24:MI:SS'),
TO_DATE ('01/01/2015 13:50:15',
'DD/MM/YYYY HH24:MI:SS'),
0,
I);
END LOOP;
ELSIF go_out <= 15
THEN
FOR j IN 1 .. 3
LOOP
s := s + 1;
IF s >= 30
THEN
s := 0;
END IF;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 22:22:' || s,
'DD/MM/YYYY HH24:MI:SS'),
NULL,
NULL,
I);
END LOOP;
END IF;
END LOOP;
END;
COMMIT;
END;
|
22ee51ba32558886c8f4626ff5151692
|
{
"intermediate": 0.30933791399002075,
"beginner": 0.4521009624004364,
"expert": 0.23856109380722046
}
|
3,027
|
перепиши этот пример только на typescript с указанием всех типов
export class Singleton {
constructor() {
if (Singleton.instance) {
return Singleton.instance;
}
Singleton.instance = this;
}
showMassage() {
const massage = 'Massage';
return massage;
}
}
|
e9ab66cbc33e7f12ab390c6e52432a95
|
{
"intermediate": 0.2991143763065338,
"beginner": 0.48576852679252625,
"expert": 0.21511709690093994
}
|
3,028
|
use regex to block anystring after domain
|
da22897d5edebe0bb016b0bb3a690455
|
{
"intermediate": 0.3741151690483093,
"beginner": 0.327862024307251,
"expert": 0.2980228364467621
}
|
3,029
|
CREATE SEQUENCE SEQ_USER
START WITH 1
INCREMENT BY 1;
CREATE TABLE QRY_QUEUE
(
ID NUMBER,
C_IN_TIME DATE,
C_EXEC_TIME DATE,
C_ST VARCHAR2 (1 BYTE),
C_QRY_TYPE NUMBER
);
CREATE TABLE ST_ABONENTS
(
ID NUMBER,
C_NAME VARCHAR2 (100 BYTE)
);
CREATE TABLE QRY_TYPE
(
ID NUMBER,
C_AB_REF NUMBER,
C_NAME VARCHAR2 (210 BYTE)
);
BEGIN
FOR i IN 1 .. 5
LOOP
INSERT INTO ST_ABONENTS
VALUES (SEQ_USER.NEXTVAL, 'Абонент№' || i);
END LOOP;
FOR i IN 6 .. 7
LOOP
INSERT INTO ST_ABONENTS
VALUES (SEQ_USER.NEXTVAL, 'Абонент№' || i);
END LOOP;
DECLARE
I NUMBER;
CNT NUMBER := 2;
CNT1 NUMBER := 0;
CURSOR c_obj
IS
SELECT a1.id
FROM ST_ABONENTS a1
ORDER BY a1.C_name;
BEGIN
FOR plp$c_obj IN c_obj
LOOP
I := plp$c_obj.id;
cnt := cnt + 2;
IF cnt > 5
THEN
cnt := 2;
END IF;
FOR j IN 1 .. cnt
LOOP
cnt1 := cnt1 + 1;
INSERT INTO QRY_TYPE
VALUES (
SEQ_USER.NEXTVAL,
I,
'Сообщение ВИД № ' || cnt1);
END LOOP;
NULL;
END LOOP;
END;
DECLARE
I NUMBER;
s INTEGER := 0;
s1 INTEGER := 0;
go_out INTEGER := 0;
go_out1 INTEGER := 0;
tempID NUMBER;
tempIDprev NUMBER;
CURSOR c_obj
IS
SELECT a1.id
FROM QRY_TYPE a1
ORDER BY a1.C_name;
BEGIN
FOR plp$c_obj IN c_obj
LOOP
I := plp$c_obj.id;
go_out1 := go_out1 + 1;
IF go_out1 = 22
THEN
EXIT;
END IF;
FOR j IN 1 .. 150
LOOP
s := s + 1;
IF s >= 55
THEN
s := 0;
END IF;
s1 := s + 4;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 23:40:' || s,
'DD/MM/YYYY HH24:MI:SS'),
TO_DATE ('01/01/2015 23:41:' || s1,
'DD/MM/YYYY HH24:MI:SS'),
1,
I);
END LOOP;
END LOOP;
FOR plp$c_obj IN c_obj
LOOP
I := plp$c_obj.id;
go_out := go_out + 1;
IF go_out <= 10
THEN
FOR j IN 1 .. 50
LOOP
s := s + 1;
IF s >= 40
THEN
s := 0;
END IF;
s1 := s + 6;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 23:45:' || s,
'DD/MM/YYYY HH24:MI:SS'),
TO_DATE ('01/01/2015 23:46:' || s1,
'DD/MM/YYYY HH24:MI:SS'),
1,
I);
END LOOP;
ELSIF go_out <= 13
THEN
FOR j IN 1 .. 13
LOOP
s := s + 1;
IF s >= 30
THEN
s := 0;
END IF;
s1 := s + 5;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 13:50:10',
'DD/MM/YYYY HH24:MI:SS'),
TO_DATE ('01/01/2015 13:50:15',
'DD/MM/YYYY HH24:MI:SS'),
0,
I);
END LOOP;
ELSIF go_out <= 15
THEN
FOR j IN 1 .. 3
LOOP
s := s + 1;
IF s >= 30
THEN
s := 0;
END IF;
INSERT INTO QRY_QUEUE
VALUES (
SEQ_USER.NEXTVAL,
TO_DATE ('01/01/2015 22:22:' || s,
'DD/MM/YYYY HH24:MI:SS'),
NULL,
NULL,
I);
END LOOP;
END IF;
END LOOP;
END;
COMMIT;
END;
используя этот код напиши запрос который покажет Типы сообщений у которых процент ошибок при обработке более 5%
|
34618a021d55ff1f5119ee42a5b90572
|
{
"intermediate": 0.30933791399002075,
"beginner": 0.4521009624004364,
"expert": 0.23856109380722046
}
|
3,030
|
need to explain to the customer what does it mean by the garabage collection in elastic cloud storage
|
8a0ae2817aa40dd3e4f53ab1f742898d
|
{
"intermediate": 0.4008331298828125,
"beginner": 0.3080814480781555,
"expert": 0.29108548164367676
}
|
3,031
|
Есть две программы на языке Си, использующие TCP передачу данных:
server.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEF_PORT 8888
#define DEF_IP “127.0.0.1”
// обработка одного клиента
//
void *
clientHandler(void *args)
{
int sock = (int)args;
char buf[100];
int res = 0;
for (;;)
{
bzero(buf, 100);
res = readFix(sock, buf, 100, 0);
if (res <= 0)
{
perror(“Can’t recv data from client, ending thread\n”);
pthread_exit(NULL);
}
printf(“Some client sent: %s\n”, buf);
res = sendFix(sock, buf, 0);
if (res <= 0)
{
perror(“send call failed”);
pthread_exit(NULL);
}
}
}
int main(int argc, char **argv)
{
int port = 0;
if (argc < 2)
{
printf(“Using default port %d\n”, DEF_PORT);
port = DEF_PORT;
}
else
port = atoi(argv[1]);
struct sockaddr_in listenerInfo;
listenerInfo.sin_family = AF_INET;
listenerInfo.sin_port = htons(port);
listenerInfo.sin_addr.s_addr = htonl(INADDR_ANY);
int listener = socket(AF_INET, SOCK_STREAM, 0);
if (listener < 0)
{
perror("Can’t create socket to listen: ");
exit(1);
}
int res = bind(listener, (struct sockaddr *)&listenerInfo, sizeof(listenerInfo));
if (res < 0)
{
perror(“Can’t bind socket”);
exit(1);
}
// слушаем входящие соединения
res = listen(listener, 5);
if (res)
{
perror(“Error while listening:”);
exit(1);
}
// основной цикл работы
for (;;)
{
int client = accept(listener, NULL, NULL);
pthread_t thrd;
res = pthread_create(&thrd, NULL, clientHandler, (void *)(client));
if (res)
{
printf(“Error while creating new thread\n”);
}
}
return 0;
}
int readFix(int sock, char *buf, int bufSize, int flags)
{
// читаем “заголовок” - сколько байт составляет наше сообщение
unsigned msgLength = 0;
int res = recv(sock, &msgLength, sizeof(unsigned), flags | MSG_WAITALL);
if (res <= 0)
return res;
if (res > bufSize)
{
printf(“Recieved more data, then we can store, exiting\n”);
exit(1);
}
// читаем само сообщение
return recv(sock, buf, msgLength, flags | MSG_WAITALL);
}
int sendFix(int sock, char *buf, int flags)
{
// шлем число байт в сообщении
unsigned msgLength = strlen(buf);
int res = send(sock, &msgLength, sizeof(unsigned), flags);
if (res <= 0)
return res;
send(sock, buf, msgLength, flags);
}
И client.c:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEF_PORT 8888
#define DEF_IP “127.0.0.1”
int main(int argc, char **argv)
{
char *addr;
int port;
char *readbuf;
printf(“Using default port %d\n”, DEF_PORT);
port = DEF_PORT;
printf(“Using default addr %s\n”, DEF_IP);
addr = DEF_IP;
// создаем сокет
struct sockaddr_in peer;
peer.sin_family = AF_INET;
peer.sin_port = htons(port);
peer.sin_addr.s_addr = inet_addr(addr);
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0)
{
perror(“Can’t create socket\n”);
exit(1);
}
// присоединяемся к серверу
int res = connect(sock, (struct sockaddr *)&peer, sizeof(peer));
if (res)
{
perror(“Can’t connect to server:”);
exit(1);
}
// основной цикл программы
char buf[100];
int first_msg = 1;
for (;;)
{
printf(“Input request (empty to exit)\n”);
if (first_msg == 0){
bzero(buf, 100);
fgets(buf, 100, stdin);
buf[strlen(buf) - 1] = ‘\0’;
}
else{
strcpy(buf, argv[1]);
buf[strlen(buf)] = ‘\0’;
first_msg = 0;
}
if (strlen(buf) == 0)
{
printf(“Bye-bye\n”);
return 0;
}
res = sendFix(sock, buf, 0);
if (res <= 0)
{
perror(“Error while sending:”);
exit(1);
}
bzero(buf, 100);
res = readFix(sock, buf, 100, 0);
if (res <= 0)
{
perror(“Error while receiving:”);
exit(1);
}
printf(“Server’s response: %s\n”, buf);
}
return 0;
}
int readFix(int sock, char *buf, int bufSize, int flags)
{
// читаем “заголовок” - сколько байт составляет наше сообщение
unsigned msgLength = 0;
int res = recv(sock, &msgLength, sizeof(unsigned), flags | MSG_WAITALL);
if (res <= 0)
return res;
if (res > bufSize)
{
printf(“Recieved more data, then we can store, exiting\n”);
exit(1);
}
// читаем само сообщение
return recv(sock, buf, msgLength, flags | MSG_WAITALL);
}
int sendFix(int sock, char *buf, int flags)
{
// число байт в сообщении
unsigned msgLength = strlen(buf);
int res = send(sock, &msgLength, sizeof(unsigned), flags);
if (res <= 0)
return res;
send(sock, buf, msgLength, flags);
}
Прокоментируй код и напиши как работает программа.
|
36023f1c9592c9929ce86de963f80bc8
|
{
"intermediate": 0.3727639317512512,
"beginner": 0.36886417865753174,
"expert": 0.25837188959121704
}
|
3,032
|
Disk level encryption in Dell ECS CLI
|
450a8f1b58fdfe3350246f9b3fa982c5
|
{
"intermediate": 0.4077089726924896,
"beginner": 0.2673477828502655,
"expert": 0.32494327425956726
}
|
3,033
|
how to run this on docker "https://gitlab.com/adblockinc/ext/adblock/adblock"
|
3f185b688c7bfea95a37160afe4f0b39
|
{
"intermediate": 0.4274052083492279,
"beginner": 0.20055483281612396,
"expert": 0.3720399737358093
}
|
3,034
|
given that this is the a HTML and CSS of my website that is a retail camping company website, what do you recommend I add (I will not be using javascript file)
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cabin:wght@400;700&display=swap">
<link rel="stylesheet" href="style/style.css" />
<title>Camping Equipment - Retail Camping Company</title>
</head>
<body>
<header>
<div class="sticky-nav">
<div class="nav-container">
<img src="assets/images/logo.svg" alt="Logo" class="logo">
<h1>Retail Camping Company</h1>
<div class="search-container">
<form action="/search" method="get">
<img src="assets/images/search.png" alt="search-icon" class="search-icon">
<input type="text" name="search" />
<button type="submit">Search</button>
</form>
</div>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="camping-equipment.html">Camping Equipment</a></li>
<li><a href="furniture.html">Furniture</a></li>
<li><a href="reviews.html">Reviews</a></li>
<li><a href="basket.html">Basket</a></li>
<li><a href="offers-and-packages.html">Offers and Packages</a></li>
</ul>
</nav>
</div>
</div>
</header>
<!-- Home Page -->
<main>
<section class="slideshow-section">
<!-- Insert slide show here -->
<div class="slideshow-container">
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Tents" style="width:100%">
</div>
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Cookers" style="width:100%">
</div>
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Camping Gear" style="width:100%">
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<div style="text-align:center">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
</section>
<section class="about-section">
<p>Welcome to Retail Camping Company, your one-stop-shop for all your camping equipment needs. Discover our premium offers on tents, cookers, camping gear, and furniture.</p>
</section>
<section class="featured-section">
<h2>Featured Products</h2>
<div class="featured-container">
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
</div>
</section>
<section>
<!-- Display special offers and relevant images -->
<div class="special-offers-container">
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Tent Offer">
<p>20% off premium tents!</p>
</div>
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Cooker Offer">
<p>Buy a cooker, get a free utensil set!</p>
</div>
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Furniture Offer">
<p>Save on camping furniture bundles!</p>
</div>
</div>
</section>
<section class="buts">
<!-- Modal pop-up window content here -->
--
<button id="modalBtn">Special Offer!</button>
<div id="modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p>Sign up now and receive 10% off your first purchase!</p>
</div>
</div>
</section>
<script>
// Get modal element
var modal = document.getElementById('modal');
// Get open model button
var modalBtn = document.getElementById('modalBtn');
// Get close button
var closeBtn = document.getElementsByClassName('close')[0];
// Listen for open click
modalBtn.addEventListener('click', openModal);
// Listen for close click
closeBtn.addEventListener('click', closeModal);
// Listen for outside click
window.addEventListener('click', outsideClick);
// Function to open modal
function openModal() {
modal.style.display = 'block';
}
// Function to close modal
function closeModal() {
modal.style.display = 'none';
}
// Function to close modal if outside click
function outsideClick(e) {
if (e.target == modal) {
modal.style.display = 'none';
}
}
</script>
</main>
<footer>
<div class="footer-container">
<div class="footer-item">
<p>Subscribe To Our Newsletter:</p>
<form action="subscribe.php" method="post">
<input type="email" name="email" placeholder="Enter your email" required>
<button type="submit">Subscribe</button>
</form>
</div>
<div class="footer-item address-container">
<p> Get In Contact:</p>
<p>Email: info@retailcampingcompany.com</p>
<p>Phone: +35699382994</p>
<p>Triq Malta,<br>Sliema 12345</p>
</div>
<div class="footer-item google-maps-container">
<p>Where To Find Us:</p>
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d12928.30174160605!2d14.5091557!3d35.8961681!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x130e452d3081f035%3A0x61f492f43cae68e4!2sCity%20Gate!5e0!3m2!1sen!2smt!4v1682559564194!5m2!1sen!2smt" width="650" height="200" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
<div class="footer-item social-links-container">
<p>Follow Us On:</p>
<ul class="social-links">
<li><a href="https://www.facebook.com">Facebook</a></li>
<li><a href="https://www.instagram.com">Instagram</a></li>
<li><a href="https://www.twitter.com">Twitter</a></li>
</ul>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
</body>
</html>
CSS:
html, body, h1, h2, h3, h4, p, a, ul, li, div, main, header, section, footer, img {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
box-sizing: border-box;
}
body {
font-family: "Cabin", sans-serif;
line-height: 1.5;
color: #333;
width: 100%;
margin: 0;
padding: 0;
min-height: 100vh;
flex-direction: column;
display: flex;
background-image: url("../assets/images/cover.jpg");
background-size: cover;
}
header {
background: #00000000;
padding: 0.5rem 2rem;
text-align: center;
color: #32612D;
font-size: 1.2rem;
}
main{
flex-grow: 1;
}
.sticky-nav {
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 1000;
}
.nav-container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.search-container {
display: inline-block;
position: relative;
}
.search-container input[type="text"] {
padding: 0.8rem;
border: none;
border-bottom: 1.5px solid #32612D;
outline: none;
color: #32612D;
font-size: 1rem;
background-color: transparent;
margin-right: 30rem;
margin-bottom: 12px;
width: 65%;
}
.search-container input[type="text"]::placeholder {
color: #32612D;
opacity: 0.5;
}
.search-icon {
margin-right: 0.8rem;
width: 24px;
height: auto;
vertical-align: middle;
position: absolute;
top: 50%;
margin-top: -16px;
}
.search-container input[type="text"]:focus {
border-color: #ADC3AB;
}
.search-container button[type="submit"] {
display: none;
}
.logo {
width: 50px;
height: auto;
margin-right: 1rem;
}
h1 {
flex-grow: 1;
text-align: left;
}
nav ul {
display: inline
list-style: none;
}
nav ul li {
display: inline;
margin-left: 1rem;
}
nav ul li a {
text-decoration: none;
color: #32612D;
position: relative;
transition: color 0.3s ease;
}
@media screen and (max-width: 768px) {
.nav-container {
flex-direction: column;
}
h1 {
margin-bottom: 1rem;
}
}
nav ul li a {
text-decoration: none;
color: #32612D;
position: relative;
transition: color 0.3s ease;
}
nav ul li a::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
background-color: #000;
transform: scaleX(0);
transition: transform 0.3s;
}
nav ul li a:hover {
color: #000000;
}
nav ul li a:hover::after {
transform: scaleX(1);
}
.slideshow-container {
width: 100%;
position: relative;
margin: 1rem 0;
}
.mySlides {
display: none;
}
.mySlides img {
width: 100%;
height: auto;
}
/* Slideshow navigation */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
margin-top: -22px;
padding: 16px;
color: #32612D;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
.prev:hover, .next:hover {
background-color: rgba(255,255,255,0.8);
}
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.dot:hover {
background-color: #717171;
}
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 1.5s;
}
@-webkit-keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
@keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
.about-section {
padding: 1rem;
text-align: center;
margin: 1rem 0;
}
.featured-section {
padding: 1rem;
text-align: center;
margin: 1rem 0;
}
.featured-section h2 {
font-size: 1.5rem;
margin-bottom: 1rem;
}
.featured-container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
margin: 1rem 0;
}
.featured-product {
width: 150px;
padding: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
margin: 0.5rem;
}
.featured-product:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
transform: translateY(-5px);
}
.featured-product img {
width: 100%;
height: auto;
margin-bottom: 1rem;
border-radius: 5px;
}
.special-offers-container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
margin: 1rem 0;
}
.special-offer {
width: 200px;
padding: 1rem;
text-align: center;
margin: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.special-offer:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
transform: translateY(-5px);
}
.special-offer img {
width: 100%;
height: auto;
margin-bottom: 0.5rem;
border-radius: 5px;
}
.modal {
display: none;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1;
overflow: auto;
align-items: center;
}
.modal-content {
background-color: #fefefe;
padding: 2rem;
margin: 10% auto;
width: 30%;
min-width: 300px;
max-width: 80%;
text-align: center;
border-radius: 5px;
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}
.modalBtn{
background-color: #ADC3AB;
color: #32612D;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.buts {
text-align: center;
}
.footer-item.address-container p {
margin: 0;
text-align: left;
}
.footer-item p {
text-align: center;
}
.add{
text-align: center;
}
.close {
display: block;
text-align: right;
font-size: 2rem;
color: #333;
cursor: pointer;
}
footer {
background: #32612D;
padding: 1rem;
text-align: center;
margin-top: auto;
}
.footer-container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.footer-item {
margin: 1rem 2rem;
}
footer p {
color: #fff;
margin-bottom: 1rem;
}
footer ul {
list-style: none;
}
footer ul li {
display: inline;
margin: 0.5rem;
}
footer ul li a {
text-decoration: none;
color: #fff;
}
@media screen and (max-width: 768px) {
.special-offers-container {
flex-direction: column;
}
}
@media screen and (max-width: 480px) {
h1 {
display: block;
margin-bottom: 1rem;
}
}
.footer-item iframe {
width: 100%;
height: 200px;
}
.footer-item form {
display: inline-flex;
align-items: center;
}
.footer-item input[type="email"] {
padding: 0.5rem;
border: none;
border-radius: 5px;
margin-right: 0.5rem;
}
.footer-item button {
background-color: #ADC3AB;
color: #32612D;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.footer-item button:hover {
background-color: #32612D;
color: #fff;
}
.social-links-container {
order: 2;
}
.address-container {
order: 1;
}
.google-maps-container {
order: 0;
}
|
141625257d397e95516c818b3cbf408b
|
{
"intermediate": 0.4018304944038391,
"beginner": 0.4121977388858795,
"expert": 0.18597178161144257
}
|
3,035
|
customer issue : customer need to confirm the 3 ECS OID is accessible from ecs end
|
22578fc2dacdc45d6e97298da3a996c8
|
{
"intermediate": 0.32786068320274353,
"beginner": 0.2792535722255707,
"expert": 0.3928857743740082
}
|
3,036
|
kettle openQuery
|
139ecc6c0dde5bce7dd91a4ca7838821
|
{
"intermediate": 0.33096256852149963,
"beginner": 0.3282899856567383,
"expert": 0.3407474458217621
}
|
3,037
|
2 Theory Manual
Symbol Legend
N i – Node i
B i – Bar i
A – Cross-section area [250 mm2]
F direction – General Force in direction
P – Force Applied [6•104 N]
E – Young’s Modulus [2•104 N/mm2]
L – Length [150 mm]
Δ – ‘Gap’ [1.2 mm]
T – Tension
C – Compression
R location – Reaction at location
k i – stiffness matrix for B i
K – Global stiffness matrix
u i – displacements at N i
f i – forces at N i
Formula List
ΣF_x=0
k_i=(E_i A_i)/L_i [■(1&-1@-1&1)]
σ=Eε
σ=P/A
σ^((i) )=(u_(i+1)-u_i)/L
ε=Δu/L
|f_i |=|AE (u_i-u_(i-1))/L|
f^((i) )=k^((i) ) d^((i) )
To approach this problem, there are some very important things to consider. The initial condition of the system is statically determinate; nonetheless if we attempt to solve for the deflection of N3 by considering it a sum for the deflection of N2 and N1, there is a total deflection of 1.8mm, which is greater than the distance from N3 to the wall, 1.2mm:
ε=σ/E=P/AE=3/250
Δu_2=εL=3/250 150 mm=1.8 mm
It is immediately noticeable that the resulting deflection is significantly larger than the gap. Thus, when approaching this problem, we must account for the reaction forces of the right wall, which is at distance
1.2 mm. Therefore, our force-balance equation will need 2 reaction forces instead of one:
ΣF_x=0=P+R_(N_1 )-R_(N_3 )
P=R_(N_3 )-R_(N_1 )=6•10^4 N
Here we can note that we have two unknowns and only one equation, so in order to address this, we must use Compatibility Equations to derive an additional equation composed of pre-existing terms. This compatibility equation will be based on internal forces and preset properties of the beams. Upon doing this, we can use properties of linear systems to solve for R_(N_3 ) and R_(N_1 )
[■(f_1@f_2@f_3 )]=EA/L [■(1&-1&0@-1&2&-1@0&-1&1)][■(u_1@u_2@u_3 )]
The equation above is a linear combination of the forces at each node in terms of the behavior of the bars. Using that, we can solve for internal forces about nodes using displacements and the behavior of other nodes.
3 Programmer’s Manual
Refer to code comments.
4 Results and Analysis:
This section will be referring to equations from the Theory Manual section.
The theory manual grants insight into the process required to solve the problem statement manually, and this section will continue solving the problem and grant a solution. Observing eq.5 there are multiple variables, but truly, only one of them is unknown. u_1is known because the left-most node cannot be displaced, and u_3 can only be displaced by 1.2 mm before it collides against an unmovable wall. This information turns our equation into the following:
[■(f_1@f_2@f_3 )]=EA/L [■(1&-1&0@-1&2&-1@0&-1&1)][■(0@u_2@1.2 mm)]=EA/L [■(0&-u_2&0@0&2u_2&-1.2@0&-u_2&1.2)]
Additionally, we know the force acting on N2, 6•104 N, andEA/L=(2•10^4 N/mm^2 )(250mm^2 )/150mm=10^5/3 N/mm=H
[■(f_1@6•10^4@f_3 )]=10^5/3 [■(0&-u_2&0@0&2u_2&-1.2@0&-u_2&1.2)]=[■(0&-u_2 H&0@0&2u_2 H&-1.2H@0&-u_2 H&1.2H)]
Solving for u_2 yields:
u_2=1.5mm
f_1=5•10^5 N
f_3=-10^5 N
In this representation, f_1 and f_3are the reaction forces at both walls. Next, to find the internal forces at each element, we will use local stiffness matrices.
[■(f_i^((1) )@f_j^((1) ) )]=[■(H&-H@-H&H)][■(0@1.5)] ,[■(f_i^((2) )@f_j^((2) ) )]=[■(H&-H@-H&H)][■(1.5@-0.3)]
f^((1) )=5•10^5 N ,f^((2) )=10^5 N
And the final major component of the lab is the stress at each element.
σ^((1) )=(5•10^5)/(250 mm^2 ) ,σ^((2) )=10^5/(250 mm^2 )
σ^((1) )=2000MPa ,σ^((2) )=400MPa
write a matlab code that can solve a general problem of n bars and n+1 nodes between two walls and find
• The support reaction forces at the two ends of the bar
• Internal forces at each element
• Stresses at each element
• Draw the internal axial force diagram (axial force vs. x)- this can be done by hand not
necessarily with your program.
• Verify your code for the problem below and compare with FEM hand calculations
Verify your code with the problem shown below. It consists of 2 bars (elements) and 3 nodes. A
load P is applied to node 2. Material properties, lengths, load and displacements are given.
Given:
• A= 250 mm 2
• L=150 mm
• E=2.0 x 10 4 N/mm 2
• P=6.0 x 104 N
• Δ =1.2 mm
|
9f6cb057b8b022393666465a3a8ed2a2
|
{
"intermediate": 0.42763960361480713,
"beginner": 0.3904244005680084,
"expert": 0.18193596601486206
}
|
3,038
|
python mineflayer how to run mineflayer on a minecraft education edition serve
|
02108f71e3455f6a782f9def33ba9542
|
{
"intermediate": 0.49556392431259155,
"beginner": 0.28533825278282166,
"expert": 0.21909786760807037
}
|
3,039
|
Check file difference in git commit using python
|
bfbc738cccede35b155af2e71ea1c80c
|
{
"intermediate": 0.4631403088569641,
"beginner": 0.22386914491653442,
"expert": 0.3129905164241791
}
|
3,040
|
how to convert hex to string on python
|
abbe824c54deed190e83d61dde4772f2
|
{
"intermediate": 0.4240351915359497,
"beginner": 0.24033278226852417,
"expert": 0.33563199639320374
}
|
3,041
|
run pihole on docker for all devices in router
|
7f470ded051e74dea38a8b048ee14638
|
{
"intermediate": 0.4179496765136719,
"beginner": 0.20991192758083344,
"expert": 0.3721383810043335
}
|
3,042
|
Write me a script in Lua on a player exploding after reaching a certain checkpoint.
|
d65461547c6749915e347be410529d20
|
{
"intermediate": 0.29195636510849,
"beginner": 0.2866910696029663,
"expert": 0.4213525056838989
}
|
3,043
|
ok so there are 2 problems in the below code,
we went to testing today,
we found 2 problems
1) master is not going to the waypoints, but follower is moving
2) speed is not set to 3 meter per second, it is moving by default value
please tell why!
from pymavlink import mavutil
import math
import time
the_connection = mavutil.mavlink_connection('COM14', baud=57600)
the_connection.wait_heartbeat()
msg = the_connection.recv_match(type='GLOBAL_POSITION_INT', blocking=True)
master_waypoint = (msg.lat / 10 ** 7, msg.lon / 10 ** 7, 10)
waypoints = [
master_waypoint,
(28.5861327, 77.3420592, 10),
(28.5860912, 77.3420042, 10), # Repeat the first waypoint to make the drone return to its starting point
]
distance = 5 # Distance in meters
angle = 60 # Angle in degrees
kp = 0.1
ki = 0.01
kd = 0.05
pid_limit = 0.0001
class Drone:
def __init__(self, system_id, connection):
self.system_id = system_id
self.connection = connection
def set_mode(self, mode):
self.connection.mav.set_mode_send(
self.system_id,
mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
mode
)
def arm(self, arm=True):
self.connection.mav.command_long_send(self.system_id, self.connection.target_component,
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, int(arm), 0, 0, 0, 0, 0,
0)
def takeoff(self, altitude):
self.connection.mav.command_long_send(self.system_id, self.connection.target_component,
mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, altitude)
def send_waypoint(self, wp, next_wp, speed):
# Print wp and next_wp
print("Current waypoint: {} | Next waypoint: {}".format(wp, next_wp))
vx, vy, vz = calculate_velocity_components(wp, next_wp, speed)
# Print velocity components
print("Velocity components: vx={}, vy={}, vz={}".format(vx, vy, vz))
self.connection.mav.send(mavutil.mavlink.MAVLink_set_position_target_global_int_message(
10,
self.system_id,
self.connection.target_component,
mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT,
int(0b110111111000),
int(wp[0] * 10 ** 7),
int(wp[1] * 10 ** 7),
wp[2],
vx,
vy,
vz,
0,
0,
0,
0,
0 # Set vx, vy, and vz from calculated components
))
def get_position(self):
self.connection.mav.request_data_stream_send(
self.system_id, self.connection.target_component,
mavutil.mavlink.MAV_DATA_STREAM_POSITION, 1, 1)
while True:
msg = self.connection.recv_match(type='GLOBAL_POSITION_INT', blocking=True)
if msg.get_srcSystem() == self.system_id:
return (msg.lat / 10 ** 7, msg.lon / 10 ** 7, 10)
class PIDController:
def __init__(self, kp, ki, kd, limit):
self.kp = kp
self.ki = ki
self.kd = kd
self.limit = limit
self.prev_error = 0
self.integral = 0
def update(self, error, dt):
derivative = (error - self.prev_error) / dt
self.integral += error * dt
self.integral = max(min(self.integral, self.limit), -self.limit) # Clamp the integral term
output = self.kp * error + self.ki * self.integral + self.kd * derivative
self.prev_error = error
return output
pid_lat = PIDController(kp, ki, kd, pid_limit)
pid_lon = PIDController(kp, ki, kd, pid_limit)
master_drone = Drone(2, the_connection)
follower_drone = Drone(3, the_connection)
print("connection is done")
def calculate_follower_coordinates(wp, distance, angle):
earth_radius = 6371000.0 # in meters
latitude_change = (180 * distance * math.cos(math.radians(angle))) / (math.pi * earth_radius)
longitude_change = (180 * distance * math.sin(math.radians(angle))) / (
math.pi * earth_radius * math.cos(math.radians(wp[0])))
new_latitude = wp[0] + latitude_change
new_longitude = wp[1] + longitude_change
print("Calculated follower coordinates: lat={}, lon={}, alt={}".format(new_latitude, new_longitude, wp[2]))
return (new_latitude, new_longitude, wp[2])
def calculate_velocity_components(current_wp, next_wp, speed):
dx = next_wp[0] - current_wp[0]
dy = next_wp[1] - current_wp[1]
dz = next_wp[2] - current_wp[2]
dx2 = dx ** 2
dy2 = dy ** 2
dz2 = dz ** 2
distance = math.sqrt(dx2 + dy2 + dz2)
vx = (dx / distance) * speed
vy = (dy / distance) * speed
vz = (dz / distance) * speed
return vx, vy, vz
def abort():
print("Type 'abort' to return to Launch and disarm motors.")
start_time = time.monotonic()
while time.monotonic() - start_time < 7:
user_input = input("Time left: {} seconds \n".format(int(7 - (time.monotonic() - start_time))))
if user_input.lower() == "abort":
print("Returning to Launch and disarming motors…")
for drone in [master_drone, follower_drone]:
drone.set_mode(6) # RTL mode
drone.arm(False) # Disarm motors
return True
print("7 seconds have passed. Proceeding with waypoint task...")
return False
for drone in [master_drone, follower_drone]:
drone.set_mode(4)
drone.arm()
drone.takeoff(10)
print("arming and takeoff is done")
# Initialize the previous_mode variable to None
previous_mode = {2: None, 3: None} # initialize the previous_mode dictionary
while True:
msg = the_connection.recv_match(type='HEARTBEAT', blocking=False)
if msg:
sysid = msg.get_srcSystem()
if sysid in [2, 3]:
mode = mavutil.mode_string_v10(msg)
if mode != previous_mode[sysid]: # check if the mode has changed
previous_mode[sysid] = mode # update the previous_mode variable
print(f"System ID: {sysid}, Mode: {mode}")
# save the mode for sysid 2 and 3 in separate variables
if sysid == 2:
mode_sysid_2 = mode
elif sysid == 3:
mode_sysid_3 = mode
# Run the following code only when mode_sysid_3 is set to "GUIDED"
time_start = time.time()
if mode_sysid_3 == "GUIDED":
mode_sysid_2 = 4
while mode_sysid_2 == 4:
if abort():
exit()
# main loop
if time.time() - time_start >= 1:
for index, master_wp in enumerate(waypoints[:-1]):
if mode_sysid_2 != 4:
for drone in [master_drone, follower_drone]:
drone.set_mode(6)
drone.arm(False)
next_wp = waypoints[index + 1]
master_drone.send_waypoint(master_wp, next_wp, speed=3)
follower_position = master_drone.get_position()
# Print follower position
print("Follower position: {}".format(follower_position))
if follower_position is None:
for drone in [master_drone, follower_drone]:
drone.set_mode(6)
drone.arm(False)
break
follower_wp = calculate_follower_coordinates(follower_position, distance, angle)
dt = time.time() - time_start
pid_lat_output = pid_lat.update(follower_wp[0] - follower_position[0], dt)
pid_lon_output = pid_lon.update(follower_wp[1] - follower_position[1], dt)
# Print PID output adjustments
print("PID adjustments: lat={}, lon={}".format(pid_lat_output, pid_lon_output))
adjusted_follower_wp = (
follower_wp[0] + pid_lat_output, follower_wp[1] + pid_lon_output, follower_wp[2])
# Print adjusted follower waypoint
print("Adjusted follower waypoint: {}".format(adjusted_follower_wp))
follower_drone.send_waypoint(adjusted_follower_wp, next_wp, speed=3)
if abort():
exit()
if mode_sysid_2 != 4:
for drone in [master_drone, follower_drone]:
drone.set_mode(6)
drone.arm(False)
time.sleep(30)
# set the mode to rtl and disarms the drone
for drone in [master_drone, follower_drone]:
drone.set_mode(6)
drone.arm(False)
# set mode to rtl
master_drone.set_mode(6)
follower_drone.set_mode(6)
exit()
the_connection.close()
|
e3c139d77898949d97152e2a37129522
|
{
"intermediate": 0.3212167024612427,
"beginner": 0.5205156207084656,
"expert": 0.15826769173145294
}
|
3,044
|
How do i integrate astrojs with qwikjs
|
2b08af6c32f33a8680bb818b5281bc29
|
{
"intermediate": 0.5598435997962952,
"beginner": 0.14549200236797333,
"expert": 0.2946643829345703
}
|
3,045
|
ab = ab.replace(" ", "")
AttributeError: 'list' object has no attribute 'replace'
|
6dc3f4e8c7ec50bd378e391d2a8382ca
|
{
"intermediate": 0.4061451554298401,
"beginner": 0.2909667491912842,
"expert": 0.3028881847858429
}
|
3,046
|
не пишет никаких ошибок, но не отображает картинку ../img/stars.jpg. Отображается белый фон.
почему?
код:
import * as THREE from 'three';
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js';
import * as dat from 'dat.gui';
import stars from '../img/stars.jpg';
console.log(stars);
const renderer = new THREE.WebGL1Renderer();
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
let width = window.innerWidth;
let height = window.innerHeight;
document.body.appendChild(renderer.domElement);
const scene = new THREE.Scene();
let camera = new THREE.PerspectiveCamera(
75,
width/ height,
0.1,
1000
);
const orbit = new OrbitControls(camera, renderer.domElement);
const axesHalper = new THREE.AxesHelper(4);
scene.add(axesHalper);
camera.position.set(0,1,5);
orbit.update();
const boxGeometry = new THREE.BoxGeometry();
const boxMaterial = new THREE.MeshStandardMaterial({color: 0xF0F100});
const box = new THREE.Mesh(boxGeometry, boxMaterial);
scene.add(box);
box.castShadow = true;
const planeGeometry = new THREE.PlaneGeometry(10,10,10);
const planeMaterial = new THREE.MeshStandardMaterial({
color: 0xFDDFF0,
side: THREE.DoubleSide
});
const plane = new THREE.Mesh(planeGeometry, planeMaterial);
scene.add(plane);
plane.rotation.x = -Math.PI/2;
plane.position.y = -1;
plane.receiveShadow = true;
const sphereGeometry = new THREE.SphereGeometry(0.9, 100.8, 100);
const sphereMaterial = new THREE.MeshStandardMaterial({
color: 0x000fff,
wireframe: false
});
const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
scene.add(sphere);
sphere.position.set(1, 1, 0);
sphere.castShadow = true;
const ambientLight = new THREE.AmbientLight(0x333333);
scene.add(ambientLight);
// const directionalLight = new THREE.DirectionalLight(0xFFFFFF, 0.5);
// scene.add(directionalLight);
// directionalLight.position.set(3,3,3);
// directionalLight.castShadow = true;
// //directionalLight.shadow.camera.bottom = -1;
// const dLightHalper = new THREE.DirectionalLightHelper(directionalLight, 1);
// scene.add(dLightHalper);
// const dLightShadowHalper = new THREE.CameraHelper(directionalLight.shadow.camera);
// scene.add(dLightShadowHalper);
const spotLight = new THREE.SpotLight(0xFFFFFF);
scene.add(spotLight);
spotLight.position.set(5,5,0);
spotLight.castShadow = true;
const sLightHalper = new THREE.SpotLightHelper(spotLight);
scene.add(sLightHalper);
const gridHalper = new THREE.GridHelper();
scene.add(gridHalper);
// scene.fog = new THREE.Fog(0xFFFFFF, 0, 20);
scene.fog = new THREE.FogExp2(0x000000, 0.1);
// renderer.setClearColor(0xFFAE00);
// const textureLoader = new THREE.TextureLoader();
// scene.background = textureLoader.load(stars);
const cubeTextureLoader = new THREE.CubeTextureLoader();
scene.background = cubeTextureLoader.load(stars);
console.log(scene.background );
const gui = new dat.GUI();
const options = {
spotLightHight: 2,
sphereColor: '#ffee00',
wireframe: false,
speed: 0.2,
angleLight: 0.5,
penumbra: 0.5,
intensity: 1
};
gui.addColor(options, 'sphereColor').onChange(function(e){
sphere.material.color.set(e);
});
gui.add(options, 'wireframe').onChange(function(e){
sphere.material.wireframe = e;
});
gui.add(options, 'speed', 0, 0.2);
gui.add(options, 'spotLightHight', 0, 10);
gui.add(options, 'angleLight', 0, 1.5);
gui.add(options, 'penumbra', 0, 1);
gui.add(options, 'intensity', 0, 2);
let step = 0;
function animate(time) {
box.rotation.y = time / 1000;
box.rotation.x = time / 1000;
step += options.speed;
sphere.position.y = 0.4 * Math.abs(Math.sin(step));
spotLight.position.y = options.spotLightHight;
spotLight.angle = options.angleLight;
spotLight.penumbra = options.penumbra;
spotLight.intensity = options.intensity;
sLightHalper.update();
width = window.innerWidth;
renderer.setSize(width, height);
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
|
302a7e63ddeda1de059fb5d6f8bb1e0d
|
{
"intermediate": 0.3496765196323395,
"beginner": 0.3907988667488098,
"expert": 0.2595246434211731
}
|
3,047
|
customer having performance issue with the VPlex how to isolate the issue
|
5ca590dcc845db2d6ebc8338d3ed79fb
|
{
"intermediate": 0.36136937141418457,
"beginner": 0.30329450964927673,
"expert": 0.3353360891342163
}
|
3,048
|
Hi. You are creating a mobile android app. In next messages I'll give you a files, that you already wrote. You have to end development of this app by completing my task.
Untill a stop-phrase "That is all" I'll give you a files. Answer "Yes" if you understood.
|
f9faf8994bf158ab88844ef5d08f5987
|
{
"intermediate": 0.3463379740715027,
"beginner": 0.3742487132549286,
"expert": 0.2794133424758911
}
|
3,049
|
how to use docker inspect command to check ip address
|
24dfbda4e8e39ed42273251412ed2ea9
|
{
"intermediate": 0.5315864682197571,
"beginner": 0.2617117762565613,
"expert": 0.20670175552368164
}
|
3,050
| ERROR: type should be string, got "https://drive.google.com/drive/folders/1D-rE_cQwsIBvG8bgHK-mcpgmhZEd0bat?usp=share_link\nThis link consist of java ide files and csv files required for testing the codes for the following requirements:\n\"The UoWSIM graduate school offers coursework and research program.\nCourswork:\nThe coursework student takes one Unit in each term and the assessment components are:\nAssignment 1 (20%)\nAssignment 2 (30%)\nExam (50%)\nEach assessment is upon 100 marks.\nThe student will be awarded a grade based on the following:\nGrade\nScore\nHD (High Distinction)\n(85%-100%)\nD (Distinction)\n(75%-84%)\nC (Credit)\n(65%-74%)\nP (Pass)\n(50%-64%)\nF (Fail)\n(0%-49%)\nResearch:\nThe coursework student takes one Unit in each term and the assessment components are:\n\nProposal (30%)\n\nFinal Dissertation (70%)\nEach assessment is upon 100 marks.\nThe student will be awarded a grade based on the following:\nGrade\nScore\nP (Pass)\n(50%-100%)\nF (Fail)\n(0%-49%)\nThe Result Processing System (RPS) is used to process the student results.\nRPS will read in students and units result from two csv files: students.csv and units_result.csv.\nstudents.csv\no This file stores the student’s information.\nunits_result.csv\no This file stores the student’s unit result.\n(See appendix for sample students.csv and units_result.csv)\nRPS will generate two csv files: result_releases.csv and unmatch_units_result.csv.\nresult_releases.csv\no This file contains the student id and grade for each student.\no If the student unit result is not found, it will be reported as either “No unit attempt” or “Research incomplete”.\nunmatch_units_result.csv\no Some unit result in units_result.csv cannot be matched to any student id in students.csv. Such unmatched units will be stored in this file.\n(See appendix for sample result_releases.csv and unmatch_units_result.csv)\n2\nTask:\nA partial completed Result Processing System (RPS) has been given.\nLook through the codes and complete the missing codes.\nHints are given in the codes as comments.\nAssumption:\nAll csv file data formats are correct.\nAll csv file data scores are correct.\nAutomated Testing\nRPSTest.java is the testing program for the Result Processing System.\nYou need to enable Assertion to enable the testing.\nYou need to follow strictly to the given csv file format else the Automate testing will fail.\nYou should get the following result from RPSTest.java if you have completed the lab.\nSort by Student ID test passed\nResult Release test passed\nUnmatch units test passed\""
|
955b640b8050f38358cbc9b1891e242d
|
{
"intermediate": 0.2658711373806,
"beginner": 0.42654529213905334,
"expert": 0.30758360028266907
}
|
3,051
|
in html and css provided below add more products to the camping equipment page below and add some sort of either filter or categories element that would make the page more professional:
Assingment;
Introduction
You have been asked to help develop a new website for a new camping equipment retailer
that is moving to online sales (RCC – Retail Camping Company). The company has been
trading from premises but now wants an online presence. The website currently doesn’t take
payments and orders online although the management hopes to do this in the future. The
website should be visual and should be viewable on different devices.
Scenario
The Retail Camping Company has the following basic requirements for the contents of the
website:
• Home Page:
o This page will introduce visitors to the special offers that are available and it
should include relevant images of camping equipment such as tents, cookers
and camping gear such as furniture and cookware.
o The text should be minimal, visuals should be used to break up the written
content.
o This page should include a navigation bar (with links inside the bar and hover
over tabs), slide show, header, sections, footer.
o Modal pop-up window that is displayed on top of the current page.
• Camping Equipment: This page will provide a catalogue of products that are on sale
such as tents, camping equipment and cookware.
• Furniture: This page should give customers a catalogue of camping furniture that is
on sale.
• Reviews: This page should include a forum where the registered members can
review the products they have purchased.
• Basket: This page should allow the customers to add camping equipment to their
basket which is saved and checked out later.
• Offers and Packages: This page provides a catalogue of the most popular
equipment that is sold
• Ensure you embed at least THREE (3) different plug ins such as java applets, display
maps and scan for viruses.
At the initial stage of the development process, you are required to make an HTML/CSS
prototype of the website that will clearly show the retail camping company how the final
website could work.
Content hasn’t been provided. Familiarise yourself with possible types of content by
choosing an appropriate organisation (by using web resources) to help you understand the
context in which the company operates. However, do not limit yourself to web-based sources
of information. You should also use academic, industry and other sources. Suitable content
for your prototype can be found on the web e.g. images. Use creative commons
(http://search.creativecommons.org/) or Wikimedia Commons
(http://commons.wikimedia.org/wiki/Main_Page) as a starting point to find content.
Remember the content you include in your site must be licensed for re-use. Do not spend
excessive amounts of time researching and gathering content. The purpose is to provide a
clear indication of how the final website could look and function. The client would provide
the actual content at a later point if they are happy with the website you have proposed.
Students must not use templates that they have not designed or created in the website
assessment. This includes website building applications, free HTML5 website templates,
or any software that is available to help with the assessment. You must create your own
HTML pages including CSS files and ideally you will do this through using notepad or
similar text editor.
Aim
The aim is to create a website for the Retail Camping Company (RCC).
Task 1– 25 Marks
HTML
The website must be developed using HTML 5 and feature a minimum of SIX (6) interlinked
pages which can also be viewed on a mobile device. The website must feature the content
described above and meet the following criteria:
• Researched relevant content to inform the design of the website.
• Be usable in at least TWO (2) different web browsers including being optimised for
mobile devices and responsive design. You should consult your tutor for guidance on
the specific browsers and versions you should use.
• Include relevant images of camping equipment you have selected from your research
including use of headers, sections and footers.
• Home Page:
o Minimal text with visuals to break up the written content.
o Navigation bar (with links inside the bar and hover over tabs)
o Responsive design and at least one plugin
o Header
o Sections
o Footer (including social media links)
• Reviews page: with responsive contact section including first name, last name, and
submit button (through email)
• Camping Equipment, Furniture Page and Offers and Package page with responsive
resize design and including TWO (2) different plug ins, catalogue style and animated
text search for products.
• Basket – Page created which allows the customers to add products to their basket.
Task 2 – 25 Marks
CSS
Create an external CSS file that specifies the design for the website. Each of the HTML
pages must link to this CSS file. There should be no use of the style attribute or the <style>
element in the website.
The boxes on the home page should include relevant elements such as border radius, boxshadow, hover etc.
Include on-page animated text search to allow customers to search for different products.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cabin:wght@400;700&display=swap">
<link rel="stylesheet" href="style/style.css" />
<title>Camping Equipment - Retail Camping Company</title>
</head>
<body>
<header>
<div class="sticky-nav">
<div class="nav-container">
<img src="assets/images/logo.svg" alt="Logo" class="logo">
<h1>Retail Camping Company</h1>
<div class="search-container">
<form action="/search" method="get">
<img src="assets/images/search.png" alt="search-icon" class="search-icon">
<input type="text" name="search" />
<button type="submit">Search</button>
</form>
</div>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="camping-equipment.html">Camping Equipment</a></li>
<li><a href="furniture.html">Furniture</a></li>
<li><a href="reviews.html">Reviews</a></li>
<li><a href="basket.html">Basket</a></li>
<li><a href="offers-and-packages.html">Offers and Packages</a></li>
</ul>
</nav>
</div>
</div>
</header>
<!-- Home Page -->
<main>
<section class="slideshow-section">
<!-- Insert slide show here -->
<div class="slideshow-container">
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Tents" style="width:100%">
</div>
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Cookers" style="width:100%">
</div>
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Camping Gear" style="width:100%">
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<div style="text-align:center">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
</section>
<section class="about-section">
<p>Welcome to Retail Camping Company, your one-stop-shop for all your camping equipment needs. Discover our premium offers on tents, cookers, camping gear, and furniture.</p>
</section>
<section class="featured-section">
<h2>Featured Products</h2>
<div class="featured-container">
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
</div>
</section>
<section>
<!-- Display special offers and relevant images -->
<div class="special-offers-container">
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Tent Offer">
<p>20% off premium tents!</p>
</div>
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Cooker Offer">
<p>Buy a cooker, get a free utensil set!</p>
</div>
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Furniture Offer">
<p>Save on camping furniture bundles!</p>
</div>
</div>
</section>
<section class="buts">
<!-- Modal pop-up window content here -->
--
<button id="modalBtn">Special Offer!</button>
<div id="modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p>Sign up now and receive 10% off your first purchase!</p>
</div>
</div>
</section>
<script>
// Get modal element
var modal = document.getElementById('modal');
// Get open model button
var modalBtn = document.getElementById('modalBtn');
// Get close button
var closeBtn = document.getElementsByClassName('close')[0];
// Listen for open click
modalBtn.addEventListener('click', openModal);
// Listen for close click
closeBtn.addEventListener('click', closeModal);
// Listen for outside click
window.addEventListener('click', outsideClick);
// Function to open modal
function openModal() {
modal.style.display = 'block';
}
// Function to close modal
function closeModal() {
modal.style.display = 'none';
}
// Function to close modal if outside click
function outsideClick(e) {
if (e.target == modal) {
modal.style.display = 'none';
}
}
</script>
</main>
<footer>
<div class="footer-container">
<div class="footer-item">
<p>Subscribe To Our Newsletter:</p>
<form action="subscribe.php" method="post">
<input type="email" name="email" placeholder="Enter your email" required>
<button type="submit">Subscribe</button>
</form>
</div>
<div class="footer-item address-container">
<p> Get In Contact:</p>
<p>Email: info@retailcampingcompany.com</p>
<p>Phone: +35699382994</p>
<p>Triq Malta,<br>Sliema 12345</p>
</div>
<div class="footer-item google-maps-container">
<p>Where To Find Us:</p>
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d12928.30174160605!2d14.5091557!3d35.8961681!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x130e452d3081f035%3A0x61f492f43cae68e4!2sCity%20Gate!5e0!3m2!1sen!2smt!4v1682559564194!5m2!1sen!2smt" width="650" height="200" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
<div class="footer-item social-links-container">
<p>Follow Us On:</p>
<ul class="social-links">
<li><a href="https://www.facebook.com">Facebook</a></li>
<li><a href="https://www.instagram.com">Instagram</a></li>
<li><a href="https://www.twitter.com">Twitter</a></li>
</ul>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
</body>
</html>
CSS:
html, body, h1, h2, h3, h4, p, a, ul, li, div, main, header, section, footer, img {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
box-sizing: border-box;
}
body {
font-family: "Cabin", sans-serif;
line-height: 1.5;
color: #333;
width: 100%;
margin: 0;
padding: 0;
min-height: 100vh;
flex-direction: column;
display: flex;
background-image: url("../assets/images/cover.jpg");
background-size: cover;
}
header {
background: #00000000;
padding: 0.5rem 2rem;
text-align: center;
color: #32612D;
font-size: 1.2rem;
}
main{
flex-grow: 1;
}
.sticky-nav {
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 1000;
}
.nav-container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.search-container {
display: inline-block;
position: relative;
}
.search-container input[type="text"] {
padding: 0.8rem;
border: none;
border-bottom: 1.5px solid #32612D;
outline: none;
color: #32612D;
font-size: 1rem;
background-color: transparent;
margin-right: 30rem;
margin-bottom: 12px;
width: 65%;
}
.search-container input[type="text"]::placeholder {
color: #32612D;
opacity: 0.5;
}
.search-icon {
margin-right: 0.8rem;
width: 24px;
height: auto;
vertical-align: middle;
position: absolute;
top: 50%;
margin-top: -16px;
}
.search-container input[type="text"]:focus {
border-color: #ADC3AB;
}
.search-container button[type="submit"] {
display: none;
}
.logo {
width: 50px;
height: auto;
margin-right: 1rem;
}
h1 {
flex-grow: 1;
text-align: left;
}
nav ul {
display: inline
list-style: none;
}
nav ul li {
display: inline;
margin-left: 1rem;
}
nav ul li a {
text-decoration: none;
color: #32612D;
position: relative;
transition: color 0.3s ease;
}
@media screen and (max-width: 768px) {
.nav-container {
flex-direction: column;
}
h1 {
margin-bottom: 1rem;
}
}
nav ul li a {
text-decoration: none;
color: #32612D;
position: relative;
transition: color 0.3s ease;
}
nav ul li a::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
background-color: #000;
transform: scaleX(0);
transition: transform 0.3s;
}
nav ul li a:hover {
color: #000000;
}
nav ul li a:hover::after {
transform: scaleX(1);
}
.slideshow-container {
width: 100%;
position: relative;
margin: 1rem 0;
}
.mySlides {
display: none;
}
.mySlides img {
width: 100%;
height: auto;
}
/* Slideshow navigation */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
margin-top: -22px;
padding: 16px;
color: #32612D;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
.prev:hover, .next:hover {
background-color: rgba(255,255,255,0.8);
}
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.dot:hover {
background-color: #717171;
}
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 1.5s;
}
@-webkit-keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
@keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
.catalog {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: 2rem 0;
}
.catalog-item {
width: 200px;
padding: 1rem;
margin: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
text-align: center;
}
.catalog-item:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.catalog-item img {
width: 100%;
height: auto;
margin-bottom: 0.5rem;
border-radius: 5px;
}
.catalog-item h3 {
margin-bottom: 0.5rem;
}
.catalog-item p {
margin-bottom: 0.5rem;
}
.catalog-item button {
background-color: #32612D;
color: #fff;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.catalog-item button:hover {
background-color: #ADC3AB;
}
footer form {
display: inline-flex;
align-items: center;
}
.about-section {
padding: 1rem;
text-align: center;
margin: 1rem 0;
}
.featured-section {
padding: 1rem;
text-align: center;
margin: 1rem 0;
}
.featured-section h2 {
font-size: 1.5rem;
margin-bottom: 1rem;
}
.featured-container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
margin: 1rem 0;
}
.featured-product {
width: 150px;
padding: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
margin: 0.5rem;
}
.featured-product:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
transform: translateY(-5px);
}
.featured-product img {
width: 100%;
height: auto;
margin-bottom: 1rem;
border-radius: 5px;
}
.special-offers-container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
margin: 1rem 0;
}
.special-offer {
width: 200px;
padding: 1rem;
text-align: center;
margin: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.special-offer:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
transform: translateY(-5px);
}
.special-offer img {
width: 100%;
height: auto;
margin-bottom: 0.5rem;
border-radius: 5px;
}
.modal {
display: none;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1;
overflow: auto;
align-items: center;
}
.modal-content {
background-color: #fefefe;
padding: 2rem;
margin: 10% auto;
width: 30%;
min-width: 300px;
max-width: 80%;
text-align: center;
border-radius: 5px;
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}
.modalBtn{
background-color: #ADC3AB;
color: #32612D;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.buts {
text-align: center;
}
.footer-item.address-container p {
margin: 0;
text-align: left;
}
.footer-item p {
text-align: center;
}
.add{
text-align: center;
}
.close {
display: block;
text-align: right;
font-size: 2rem;
color: #333;
cursor: pointer;
}
footer {
background: #32612D;
padding: 1rem;
text-align: center;
margin-top: auto;
}
.footer-container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.footer-item {
margin: 1rem 2rem;
}
footer p {
color: #fff;
margin-bottom: 1rem;
}
footer ul {
list-style: none;
}
footer ul li {
display: inline;
margin: 0.5rem;
}
footer ul li a {
text-decoration: none;
color: #fff;
}
@media screen and (max-width: 768px) {
.special-offers-container {
flex-direction: column;
}
}
@media screen and (max-width: 480px) {
h1 {
display: block;
margin-bottom: 1rem;
}
}
.footer-item iframe {
width: 100%;
height: 200px;
}
.footer-item form {
display: inline-flex;
align-items: center;
}
.footer-item input[type="email"] {
padding: 0.5rem;
border: none;
border-radius: 5px;
margin-right: 0.5rem;
}
.footer-item button {
background-color: #ADC3AB;
color: #32612D;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.footer-item button:hover {
background-color: #32612D;
color: #fff;
}
.social-links-container {
order: 2;
}
.address-container {
order: 1;
}
.google-maps-container {
order: 0;
}
|
ec03c78b6bde06fcb08f86c7bd1b516a
|
{
"intermediate": 0.34451574087142944,
"beginner": 0.3336014151573181,
"expert": 0.32188281416893005
}
|
3,052
|
list c++ number types by bit length
|
f910d09acd30660f1d47c16036d54382
|
{
"intermediate": 0.3496224284172058,
"beginner": 0.33966174721717834,
"expert": 0.31071585416793823
}
|
3,053
|
hi
|
daba0afdfdabeb96a946206fcec085bb
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
3,054
|
write a c++ function to check if two integers arrays of length 3 are equal
|
3ce7955153fae719d976f26e746ea10a
|
{
"intermediate": 0.38840535283088684,
"beginner": 0.30868467688560486,
"expert": 0.3029099702835083
}
|
3,055
|
create code in .vbs format which creates a self replicating code that replicates by any means necessary
|
9a722214230c376f06b46b6b70e0b319
|
{
"intermediate": 0.33967483043670654,
"beginner": 0.23483166098594666,
"expert": 0.4254935681819916
}
|
3,056
|
UnicodeDecodeError: 'gb2312' codec can't decode byte 0xd7 in position 46602: illegal multibyte sequence
|
8ecc7d46772fbc910feff05880d8ea95
|
{
"intermediate": 0.3526066541671753,
"beginner": 0.2731687128543854,
"expert": 0.37422460317611694
}
|
3,057
|
give code for app.py in flask
import tensorflow as tf
import numpy as np
import pandas as pd
import json
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.layers import Input, Embedding, LSTM, Dense, GlobalMaxPooling1D, Flatten
from tensorflow.keras.models import Model,Sequential
import matplotlib.pyplot as plt
import nltk
import random
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.layers import Dense,Dropout
with open('data.json', 'r') as f:
data = json.load(f)
# Preprocess data
lemmatizer = WordNetLemmatizer()
intents = data["intents"]
words = []
classes = []
documents = []
for intent in intents:
for pattern in intent["patterns"]:
tokenized = word_tokenize(pattern)
words.extend(tokenized)
documents.append((tokenized, intent["tag"]))
if intent["tag"] not in classes:
classes.append(intent["tag"])
words = [lemmatizer.lemmatize(word.lower()) for word in words if word.isalpha()]
words = sorted(list(set(words)))
classes = sorted(list(set(classes)))
# Create training data
training = []
output_empty = [0] * len(classes)
for document in documents:
bag = []
pattern_words = document[0]
pattern_words = [lemmatizer.lemmatize(word.lower()) for word in pattern_words]
for word in words:
bag.append(1) if word in pattern_words else bag.append(0)
output_row = list(output_empty)
output_row[classes.index(document[1])] = 1
training.append([bag, output_row])
random.shuffle(training)
training = np.array(training, dtype=object)
train_x = np.array(list(training[:, 0]))
train_y = np.array(list(training[:, 1]))
# Create model
model = Sequential()
model.add(Dense(128, input_shape=(len(train_x[0]),), activation="relu"))
model.add(Dropout(0.5))
model.add(Dense(64, activation="relu"))
model.add(Dropout(0.5))
model.add(Dense(len(train_y[0]), activation="softmax"))
model.compile(loss="categorical_crossentropy", optimizer="adam", metrics=["accuracy"])
# Train model
model.fit(train_x, train_y, epochs=1000, batch_size=8)
def clean_sentence(sentence):
sentence_words = word_tokenize(sentence)
sentence_words = [lemmatizer.lemmatize(word.lower()) for word in sentence_words]
return sentence_words
def bag_of_words(sentence, vocab):
sentence_words = clean_sentence(sentence)
bag = [0] * len(vocab)
for s in sentence_words:
for i, word in enumerate(vocab):
if word == s:
bag[i] = 1
return np.array(bag)
def chatbot_response(message):
pred = model.predict(np.array([bag_of_words(message, words)]))[0]
threshold = 0.25
pred_class_idx = np.argmax(pred)
if pred[pred_class_idx] > threshold:
pred_class = classes[pred_class_idx]
for intent in intents:
if intent["tag"] == pred_class:
response = random.choice(intent["responses"])
return response
else:
return "I didn’t understand that. Can you please rephrase?"
while True:
# Get input from user
message = input("User: ")
# Check if user wants to exit
if message.lower() == "exit":
print("Chatbot: Goodbye!")
break
# Get chatbot's response
response = chatbot_response(message)
# Print response
print("Chatbot:", response)
|
d8d9d403450739f8f85c46eaa86bcf28
|
{
"intermediate": 0.42613908648490906,
"beginner": 0.35228994488716125,
"expert": 0.22157099843025208
}
|
3,058
|
make a .vbs code that self replicates
|
45229dcf980323b0a2f0fcaddec967b9
|
{
"intermediate": 0.3360525667667389,
"beginner": 0.23989804089069366,
"expert": 0.42404934763908386
}
|
3,059
|
In Perl, is there a way to be notified that a PID has died, when the PID is not the child of our process, and without shelling out to ps or something?
|
0832c579c5e6606ca5d7beaaaa04ff61
|
{
"intermediate": 0.6532982587814331,
"beginner": 0.17618168890476227,
"expert": 0.17052000761032104
}
|
3,060
|
In Perl, is there a way to be notified that a PID has died, when the PID is not the child of our process, and without shelling out to ps or something? Use a codeblock for your response. Assume that your response must have all special characters escaped in the source code or else it will not render properly
|
cc4936dc6808168cfc0deb46e096211d
|
{
"intermediate": 0.6673264503479004,
"beginner": 0.14417238533496857,
"expert": 0.18850116431713104
}
|
3,061
|
jetpack compose for 2 text views in column and 4 buttons like in "who wants to be a millionaire"
|
6fb0cbfa8f837dfb9653658d321d5044
|
{
"intermediate": 0.38515785336494446,
"beginner": 0.31090089678764343,
"expert": 0.3039413392543793
}
|
3,062
|
In Perl, is there a way to be notified that a PID has died, when the PID is not the child of our process, and without shelling out to ps or something? Can there be a timeout? Use a codeblock for your response. Assume that your response must have all special characters escaped in the source code or else it will not render properly
|
784747e06365357a198b9fe1f5c1b9c8
|
{
"intermediate": 0.7318605780601501,
"beginner": 0.12192349880933762,
"expert": 0.14621593058109283
}
|
3,063
|
In Perl, is there a way to be notified that a PID has died, when the PID is not the child of our process, and without shelling out to ps or something? Can there be a timeout? Use a codeblock for your response. Assume that your response must have all special characters escaped in the source code or else it will not render properly. Do not write soure code. Just explain.
|
f639ce3ea456d19b3b6597e4a96a30ce
|
{
"intermediate": 0.6302556991577148,
"beginner": 0.177411749958992,
"expert": 0.19233259558677673
}
|
3,064
|
In Perl, is there a way to be notified that a PID has died, when the PID is not the child of our process, and without shelling out to ps or something? Can there be a timeout? Use a codeblock for your response. Assume that your response must have all special characters escaped in the source code or else it will not render properly. Do not write soure code. Just explain.
|
f8413f7ecb55550d7c8ff3a9d4629c27
|
{
"intermediate": 0.6302556991577148,
"beginner": 0.177411749958992,
"expert": 0.19233259558677673
}
|
3,065
|
give me the below points in code in python pymavlink
connects the both drones with the same telemetry and different sys id
Arm the drone
Takeoff to a specified altitude
Accept the waypoint and make the master drone go to that waypoint
Set the follower to follow the master drone at a distance of 5 meters behind always
Set the mode to RTL
Disarm the drone
|
e32e316b5c6f31d06782c802da6e3d04
|
{
"intermediate": 0.49418193101882935,
"beginner": 0.21734480559825897,
"expert": 0.28847330808639526
}
|
3,066
|
create a self replicating quine which opens the calculator
|
ea93ded7306597119c1dd4f9b415d82f
|
{
"intermediate": 0.29000207781791687,
"beginner": 0.17912410199642181,
"expert": 0.5308738350868225
}
|
3,067
|
write me a class in which it connects 2 drones , one is master and other is follower drone to the single telemetry and have different sysid, then setting the mode, then arming the drones according to the fgiven parameters, then takeoff then send waypoints using the below code( waypoints are accepted in meters), and get the currect position of master drone for follower drone, follower should be at 5 meters behing the master drone, then to cal;culate the follower drone position using the master drone position, then to calculate the master and follower speed sedt to 3 meter per second only, then have the main loop started.
write it in pymavlink
here is the waypoint sending code
the_connection.mav.send(mavutil.mavlink.MAVLink_set_position_target_local_ned_message(10, the_connection.target_system,
the_connection.target_component, mavutil.mavlink.MAV_FRAME_LOCAL_NED, int(0b010111111000), 0, 100, -10, 0, 0, 0, 0, 0, 0, 0, 0))
|
bcd5c3947ec57c6aedddccff4df6c904
|
{
"intermediate": 0.388837993144989,
"beginner": 0.46074768900871277,
"expert": 0.1504143327474594
}
|
3,068
|
give me the below points in code in python pymavlink
connects the both drones with the same telemetry and different sys id
Arm the drone
Takeoff to a specified altitude
Accept the waypoint and make the master drone go to that waypoint
Set the follower to follow the master drone at a distance of 5 meters behind always
Set the mode to RTL
Disarm the drone
the waypoints should be in meters
waypoint sending code is this
mav.send(
mavutil.mavlink.MAVLink_set_position_target_local_ned_message(
0, self.master_sysid, mavutil.mavlink.MAV_COMP_ID_SYSTEM_CONTROL,
mavutil.mavlink.MAV_FRAME_LOCAL_NED, int(0b010111111000), 0, 0, 0, x, y, z, 0, 0, 0, 0, 0))
|
b5b1085e8f979d5b9aab746a6c5ed1f9
|
{
"intermediate": 0.4870544970035553,
"beginner": 0.2163981795310974,
"expert": 0.2965472936630249
}
|
3,069
|
import { Navigate, Routes, Route, BrowserRouter } from “react-router-dom”;
import MainLayout from “…/Layout/mainLayout/MainLayout”;
import RoomMain from “…/Rooms/pages”;
import RoomDetail from “…/Rooms/pages/Detail”;
export default function Router() {
return (
<BrowserRouter>
<Routes>
<Route path=“/” element={<Navigate to=“trang-chu” />} />
<Route path=“/*” element={<MainLayout />} >
<Routes>
<Route path=“/room” element={<RoomMain />} />
<Route path=“/room/:roomId” element={<RoomDetail />} />
</Routes>
</Route>
</Routes>
</BrowserRouter>
);
}got this error [Routes] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>
|
2010f76f7b9dca88ff12ac23e6dcd1ca
|
{
"intermediate": 0.42874377965927124,
"beginner": 0.38028475642204285,
"expert": 0.19097138941287994
}
|
3,070
|
what is Upstream DNS Servers in pihole
|
7ba7d6027a2c6813cecd9226c66bb23b
|
{
"intermediate": 0.3179280161857605,
"beginner": 0.3207438886165619,
"expert": 0.3613280951976776
}
|
3,071
|
how to add NET_ADMIN to running container in docker
|
c3fe227d66aa73f7c3a038c7479bd8c8
|
{
"intermediate": 0.3252546489238739,
"beginner": 0.1457434743642807,
"expert": 0.5290018320083618
}
|
3,072
|
have this import { Routes, Route, BrowserRouter } from "react-router-dom";
import MainLayout from "../Layout/mainLayout/MainLayout";
import RoomMain from "../Rooms/pages";
import RoomDetail from "../Rooms/pages/Detail";
export default function Router() {
return (
<BrowserRouter>
<Routes>
<Route path='/' element={<MainLayout />}>
<Route path='/room' element={<RoomMain />} />
<Route path='/room/:roomId' element={<RoomDetail />} />
</Route>
</Routes>
</BrowserRouter >
);
}
and this import Sider from '../components/Sider';
import Navbar from '../components/Navbar';
import '../../CSS/index.css';
import { ReactNode } from 'react';
interface MainLayoutProps {
children?: ReactNode;
}
export default function MainLayout({ children }: MainLayoutProps) {
console.log(children)
return (
<div className='MainContainer'
>
<div className='PSNavbar'>
<Navbar />
</div>
<div className='PSSider' >
<Sider />
</div>
<div className='PSMain'>
{children!}
</div>
</div>
);
}
but the children props always undefined
|
a55bf7c22836e45f87b06843424478fc
|
{
"intermediate": 0.3957676589488983,
"beginner": 0.3405495882034302,
"expert": 0.2636827826499939
}
|
3,073
|
Write a non-malicious quine in .VBS code which randomly generates different versions of itself in an infinite loop
|
e149d31da76eb67529779aa395a446be
|
{
"intermediate": 0.161289781332016,
"beginner": 0.24616585671901703,
"expert": 0.5925443172454834
}
|
3,074
|
i have this code
import { RoomProps } from "../type"
import { Button, Rate } from 'antd';
import { Avatar, Divider, Tooltip, DatePicker } from 'antd';
import { AntDesignOutlined, UserOutlined, CaretUpOutlined, KeyOutlined, IdcardOutlined } from '@ant-design/icons';
import { useState } from "react";
import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';
import '../../CSS/index.css';
import RoomBenefit from '../../../../assets/images/RoomBenefits.png'
export default function RoomInfo({ row }: RoomProps) {
//handle Description
const [showFullDescription, setFullDescription] = useState(false);
const showFullDescriptionHandler = () => {
setFullDescription(!showFullDescription);
};
const description = showFullDescription
? row.description
: row.description?.slice(0, 90);
//handle Day
dayjs.extend(customParseFormat);
const { RangePicker } = DatePicker;
const dateFormat = 'YYYY/MM/DD';
return (
<div style={{ minHeight: '100vh' }}>
{/* this is room Detail Tittle */}
<div style={{ fontWeight: 'bold', fontSize: 30 }}>{row.roomType}</div>
{/* this is the rate Star. it had set default at 4.5 */}
<Rate allowHalf defaultValue={4.5} />
<Divider />
{/* these are the sample avatar things, i had set 7 avatars */}
<div style={{ display: 'flex' }}>
<div className="Flex1">
<Avatar.Group maxCount={5} maxStyle={{ color: '#f56a00', backgroundColor: '#fde3cf' }}>
<Tooltip title="Ant User" placement="top">
<Avatar src="https://xsgames.co/randomusers/avatar.php?g=pixel&key=2" />
</Tooltip>
<Tooltip title="Ant User" placement="top">
<Avatar style={{ backgroundColor: '#f56a00' }}>K</Avatar>
</Tooltip>
<Tooltip title="Ant User" placement="top">
<Avatar style={{ backgroundColor: '#87d068' }} icon={<UserOutlined />} />
</Tooltip>
<Tooltip title="Ant User" placement="top">
<Avatar style={{ backgroundColor: '#59g068' }} icon={<CaretUpOutlined />} />
</Tooltip>
<Tooltip title="Ant User" placement="top">
<Avatar style={{ backgroundColor: '#f24611' }} icon={<UserOutlined />} />
</Tooltip>
<Tooltip title="Ant User" placement="top">
<Avatar style={{ backgroundColor: '#87d068' }} icon={<UserOutlined />} />
</Tooltip>
<Avatar style={{ backgroundColor: '#1890ff' }} icon={<AntDesignOutlined />} />
</Avatar.Group>
</div>
{/* this is the review.count. It had set default at 32 */}
<div className="DetailReview">
32 Reviews
</div>
</div>
<br />
{/* this is Description part */}
<div className='DetailDes'>
<div className="lead">{description}</div>
<br />
<div onClick={showFullDescriptionHandler} className="FullDes">
{showFullDescription ? "Thu gọn" : "Đọc thêm"}
</div>
</div>
<br />
{/* This is the box showing the benefits of the room */}
<div className="RoomBeneFit" style={{ backgroundImage: `url(${RoomBenefit})`}} />
{/* This is User's Room Detail part */}
<div className="RoomInfoTittle">
User's Room Detail
</div>
<div className="RoomInfoContainer">
<div className="RoomInfoItem">
<div className="Flex1">
CheckIn - CheckOut Date:
</div>
<div className="Flex1">
<RangePicker
className="RangePicker"
defaultValue={[dayjs(row?.checkIn, dateFormat), dayjs(row?.checkOut, dateFormat)]}
format={dateFormat}
/>
</div>
</div>
<div className="RoomInfoItem">
<div className="Flex1">
Room ID
</div>
<div className="Flex1">
<Button icon={<IdcardOutlined />}>
{row.id}
</Button>
</div>
</div>
<div className="RoomInfoItem">
<div className="Flex1">
Room Name:
</div>
<div className="Flex1">
<Button icon={<KeyOutlined />}>
{row.name}
</Button>
</div>
</div>
<div className="RoomInfoItem">
<div className="Flex1">
Status:
</div>
<div className="Flex1">
</div>
</div>
</div>
</div >
)
}. i just wanna talk about the rangepicker . my checkIn and checkOut value is checkIn: new Date('2023-12-02'),
checkOut: new Date('2023-12-04'), but it gave me invalid Date when render
|
27543c9e28db0fda7b9b84f5b26bf7bd
|
{
"intermediate": 0.47044482827186584,
"beginner": 0.3733537793159485,
"expert": 0.15620143711566925
}
|
3,075
|
here’s the valid request to chatgpt in python:
curl https://api.openai.com/v1/chat/completions <br/> -H “Content-Type: application/json” <br/> -H “Authorization: Bearer $OPENAI_API_KEY” <br/> -d ‘{
“model”: “gpt-3.5-turbo”,
“messages”: [{“role”: “user”, “content”: “Say this is a test!”}],
“temperature”: 0.7
}’
response:
{
“id”:“chatcmpl-abc123”,
“object”:“chat.completion”,
“created”:1677858242,
“model”:“gpt-3.5-turbo-0301”,
“usage”:{
“prompt_tokens”:13,
“completion_tokens”:7,
“total_tokens”:20
},
“choices”:[
{
“message”:{
“role”:“assistant”,
“content”:“\n\nThis is a test!”
},
“finish_reason”:“stop”,
“index”:0
}
]
}
this is my java code:
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.json.JSONObject;
import org.json.JSONArray;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
import Password.Password;
public class Model {
private final String apiEndpoint = “https://api.openai.com/v1/chat/completions”;
private final String apiKey;
public Model() {
this.apiKey = Password.getApiKey();
}
public String chatGptOutput(String message) {
String output = “super error”;
CloseableHttpClient httpClient = HttpClients.createDefault();
try {
HttpPost httpPost = new HttpPost(apiEndpoint);
httpPost.addHeader(“Content-Type”, “application/json”);
httpPost.addHeader(“Authorization”, “Bearer " + apiKey);
JSONObject requestBody = new JSONObject();
requestBody.put(“model”, “gpt-3.5-turbo”);
JSONArray messages = new JSONArray();
JSONObject messageObj = new JSONObject();
messageObj.put(“role”, “user”);
messageObj.put(“content”, message);
messages.put(messageObj);
requestBody.put(“messages”, messages);
requestBody.put(“temperature”, 0.7);
StringEntity params = new StringEntity(requestBody.toString());
httpPost.setEntity(params);
CloseableHttpResponse response = httpClient.execute(httpPost);
try (response) {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream inputStream = entity.getContent();
String responseBody = new Scanner(inputStream, StandardCharsets.UTF_8)
.useDelimiter(”\n")
.next();
JSONObject jsonResponse = new JSONObject(responseBody);
System.out.println(jsonResponse);
System.out.println(“----------”);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return output;
}
}
update java code so it would match valid python request and output content of response
update java code so it would match valid python request and output java code
|
b7d4ca9e1f9c3ee516393d4e864a85c0
|
{
"intermediate": 0.2958177924156189,
"beginner": 0.5553423762321472,
"expert": 0.14883993566036224
}
|
3,076
|
for the below code, add the followinfg things
1) Add support for multiple followers and implement a formation flying algorithm.
2) Introduce communication protocols between the drones and a ground station to allow for remote control and monitoring.
3) Implement a swarm intelligence algorithm to enable the drones to work together and accomplish complex tasks such as search and rescue or mapping.
4) Introduce advanced control algorithms such as model predictive control or reinforcement learning to enable more precise and efficient control of the drones.
give me the full complex code
the code is this
import time
import numpy as np
from pymavlink import mavutil
class Drone:
def init(self, sysid):
self.sysid = sysid
self.current_pos = np.zeros(3)
class DroneController:
def init(self, master_sysid, follower_sysid):
self.master = Drone(master_sysid)
self.follower = Drone(follower_sysid)
self.connection = mavutil.mavlink_connection('/dev/ttyUSB0')
self.connection.wait_heartbeat()
self.current_ned = np.zeros(3)
self.waypoints = []
def set_mode(self, drone, mode):
self.connection.mav.set_mode_send(drone.sysid, mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED, mode)
time.sleep(1)
def arm_and_takeoff(self, drone, altitude):
self.connection.mav.command_long_send(
drone.sysid, mavutil.mavlink.MAV_COMP_ID_SYSTEM_CONTROL,
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1, 0, 0, 0, 0, 0, 0)
time.sleep(1)
self.connection.mav.command_long_send(
drone.sysid, mavutil.mavlink.MAV_COMP_ID_SYSTEM_CONTROL,
mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, altitude)
time.sleep(5)
def add_waypoint(self, waypoint):
self.waypoints.append(waypoint)
def send_position_target(self, drone, ned_pos):
self.connection.mav.set_position_target_local_ned_send(
0, drone.sysid, 0, mavutil.mavlink.MAV_FRAME_LOCAL_NED,
mavutil.mavlink.POS_TARGET_TYPE_LOCATION | mavutil.mavlink.POS_TARGET_TYPE_VELOCITY,
ned_pos[0], ned_pos[1], ned_pos[2], 0, 0, 0, 0, 0, 0)
time.sleep(0.1)
def goto_next_waypoint(self):
if len(self.waypoints) == 0:
return False
next_global_waypoint = self.waypoints.pop(0)
self.send_position_target(self.master, self.current_ned + next_global_waypoint)
return True
def follow_master(self, distance):
while True:
self.update_local_positions()
leader_pos = np.array(self.master.current_pos)
leader_yaw = self.connection.messages["ATTITUDE"].yaw
follower_pos = self.calculate_follower_position(leader_pos, leader_yaw, distance)
self.follower.current_pos = follower_pos
self.send_position_target(self.follower, self.current_ned + follower_pos)
time.sleep(0.1)
def update_local_positions(self):
local_position = self.connection.messages.get("LOCAL_POSITION_NED", None)
if local_position is not None:
self.master.current_pos = np.array([local_position.x, local_position.y, local_position.z])
def calculate_follower_position(self, leader_pos, leader_yaw, distance):
dx = -distance * np.sin(leader_yaw)
dy = distance * np.cos(leader_yaw)
follower_pos = np.array([leader_pos[0] + dx, leader_pos[1] + dy, leader_pos[2]])
return follower_pos
# Usage
controller = DroneController(2, 3)
# Arm and takeoff both drones
controller.set_mode(controller.master, 4) # Set mode to Guided
controller.set_mode(controller.follower, 4)
controller.arm_and_takeoff(controller.master, 10)
controller.arm_and_takeoff(controller.follower, 10)
# Add waypoints
controller.add_waypoint(np.array([10.0, 10.0, -10.0]))
controller.add_waypoint(np.array([20.0, 20.0, -20.0]))
# Send master drone to waypoints
while controller.goto_next_waypoint():
time.sleep(1)
# Follower drone follows the master drone at 5 meters behind
controller.follow_master(5)
# After the operation has completed, set mode to RTL and disarm
controller.set_mode(controller.master, 6) # Set mode to RTL
controller.set_mode(controller.follower, 6)
controller.arm_and_takeoff(controller.master, 0)
controller.arm_and_takeoff(controller.follower, 0)
controller.close()
|
ea4c0d6ca0bef2411520b2b65761f447
|
{
"intermediate": 0.274170845746994,
"beginner": 0.40811610221862793,
"expert": 0.31771305203437805
}
|
3,077
|
write a c++ function to loop through all permutations of n length integer arrays with values between 0 and 37
|
f68fa0b16a47bc2aff330b59edafa64a
|
{
"intermediate": 0.2601700723171234,
"beginner": 0.4548810124397278,
"expert": 0.2849489152431488
}
|
3,078
|
code a bot in python using trading bot framework such as ccxt or pyalgotrade. Here's a high-level overview of how the bot could be designed:
1. Set up a connection to an exchange that supports Bitcoin trading, such as Binance or Coinbase.
2. Define your trading strategy. For example, you could use a trend-following strategy that buys when the price is above the moving average and sells when the price falls below the moving average.
3. Implement risk management rules, such as limiting the amount of capital to be risked on each trade to 1% of the portfolio value and setting a stop loss at 1%.
4. Use position sizing to manage exposure. For example, you could choose to invest a fixed amount of capital per trade or adjust the position size based on market volatility.
5. Set the risk-reward ratio to 1:3, which means that for every dollar risked, you aim to make three dollars.
6. Keep a trading journal to record all trades, including entry and exit points, position size, stop-loss and take-profit levels, trade rationale, and emotional state during the trade.
|
677e2873f65188a25985d4124dc2ce66
|
{
"intermediate": 0.4290491044521332,
"beginner": 0.23889371752738953,
"expert": 0.3320571780204773
}
|
3,079
|
for the below code, add the followinfg things
1) Add support for multiple followers and implement a formation flying algorithm.
2) Introduce communication protocols between the drones and a ground station to allow for remote control and monitoring.
3) Implement a swarm intelligence algorithm to enable the drones to work together and accomplish complex tasks such as search and rescue or mapping.
4) Introduce advanced control algorithms such as model predictive control or reinforcement learning to enable more precise and efficient control of the drones.
give me the full complex code
the code is this
import time
import numpy as np
from pymavlink import mavutil
class Drone:
def init(self, sysid):
self.sysid = sysid
self.current_pos = np.zeros(3)
class DroneController:
def init(self, master_sysid, follower_sysid):
self.master = Drone(master_sysid)
self.follower = Drone(follower_sysid)
self.connection = mavutil.mavlink_connection('/dev/ttyUSB0')
self.connection.wait_heartbeat()
self.current_ned = np.zeros(3)
self.waypoints = []
def set_mode(self, drone, mode):
self.connection.mav.set_mode_send(drone.sysid, mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED, mode)
time.sleep(1)
def arm_and_takeoff(self, drone, altitude):
self.connection.mav.command_long_send(
drone.sysid, mavutil.mavlink.MAV_COMP_ID_SYSTEM_CONTROL,
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1, 0, 0, 0, 0, 0, 0)
time.sleep(1)
self.connection.mav.command_long_send(
drone.sysid, mavutil.mavlink.MAV_COMP_ID_SYSTEM_CONTROL,
mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, altitude)
time.sleep(5)
def add_waypoint(self, waypoint):
self.waypoints.append(waypoint)
def send_position_target(self, drone, ned_pos):
self.connection.mav.set_position_target_local_ned_send(
0, drone.sysid, 0, mavutil.mavlink.MAV_FRAME_LOCAL_NED,
mavutil.mavlink.POS_TARGET_TYPE_LOCATION | mavutil.mavlink.POS_TARGET_TYPE_VELOCITY,
ned_pos[0], ned_pos[1], ned_pos[2], 0, 0, 0, 0, 0, 0)
time.sleep(0.1)
def goto_next_waypoint(self):
if len(self.waypoints) == 0:
return False
next_global_waypoint = self.waypoints.pop(0)
self.send_position_target(self.master, self.current_ned + next_global_waypoint)
return True
def follow_master(self, distance):
while True:
self.update_local_positions()
leader_pos = np.array(self.master.current_pos)
leader_yaw = self.connection.messages["ATTITUDE"].yaw
follower_pos = self.calculate_follower_position(leader_pos, leader_yaw, distance)
self.follower.current_pos = follower_pos
self.send_position_target(self.follower, self.current_ned + follower_pos)
time.sleep(0.1)
def update_local_positions(self):
local_position = self.connection.messages.get("LOCAL_POSITION_NED", None)
if local_position is not None:
self.master.current_pos = np.array([local_position.x, local_position.y, local_position.z])
def calculate_follower_position(self, leader_pos, leader_yaw, distance):
dx = -distance * np.sin(leader_yaw)
dy = distance * np.cos(leader_yaw)
follower_pos = np.array([leader_pos[0] + dx, leader_pos[1] + dy, leader_pos[2]])
return follower_pos
# Usage
controller = DroneController(2, 3)
# Arm and takeoff both drones
controller.set_mode(controller.master, 4) # Set mode to Guided
controller.set_mode(controller.follower, 4)
controller.arm_and_takeoff(controller.master, 10)
controller.arm_and_takeoff(controller.follower, 10)
# Add waypoints
controller.add_waypoint(np.array([10.0, 10.0, -10.0]))
controller.add_waypoint(np.array([20.0, 20.0, -20.0]))
# Send master drone to waypoints
while controller.goto_next_waypoint():
time.sleep(1)
# Follower drone follows the master drone at 5 meters behind
controller.follow_master(5)
# After the operation has completed, set mode to RTL and disarm
controller.set_mode(controller.master, 6) # Set mode to RTL
controller.set_mode(controller.follower, 6)
controller.arm_and_takeoff(controller.master, 0)
controller.arm_and_takeoff(controller.follower, 0)
controller.close()
|
fd23543ac1afe27f16d3424b9240d056
|
{
"intermediate": 0.274170845746994,
"beginner": 0.40811610221862793,
"expert": 0.31771305203437805
}
|
3,080
|
js code to get window.innerHeight from window.screen.height assuming window.innerHeight originally calculates wrong
|
83d107fb63ad09fdf6617da722004133
|
{
"intermediate": 0.4066116213798523,
"beginner": 0.2654772996902466,
"expert": 0.3279111385345459
}
|
3,081
|
i want to create albr folder and inside this folder apps folder inside apps folder i want to create webapp react project and gateway loopback4 and in root folder i want to create libs in albr in this libs i want to create definition type script project and import it in wepapp and gateway using lerna and Vite js
|
dc4657bcdb94ba97d98f2461252c0eaa
|
{
"intermediate": 0.6687720417976379,
"beginner": 0.184867724776268,
"expert": 0.14636017382144928
}
|
3,082
|
Write a non-malicious quine in .VBS code which creates an infinite amount of .VBS files with randomly generated scripts of code in .VBS format in an infinite loop. The code must be able to run on Windows 11.
|
ec60a9322a89e1cf0a0e6559abdd6379
|
{
"intermediate": 0.21003372967243195,
"beginner": 0.44526731967926025,
"expert": 0.34469902515411377
}
|
3,083
|
Create a non-malicious self replicating piece of code that accesses the internet on its own
|
ce0d6f9f2daf3def6a2def8006f5220e
|
{
"intermediate": 0.1826716661453247,
"beginner": 0.10320650786161423,
"expert": 0.7141218185424805
}
|
3,084
|
Puedes modificar “EquipamentHandler” para que cuando llame a la funcion “EquipItem” se llame a la funcion “SetActiveHolster” del Script “Holster”, sin tener en cuenta nada mas que colocar “SetActiveHolster” . using System.Collections;
using System.Collections.Generic;
using DevionGames.UIWidgets;
using UnityEngine;
namespace DevionGames.InventorySystem
{
public class EquipmentHandler : MonoBehaviour
{
[SerializeField]
private string m_WindowName = “Equipment”;
[SerializeField]
private ItemDatabase m_Database;
[SerializeField]
private List<EquipmentBone> m_Bones= new List<EquipmentBone>();
public List<EquipmentBone> Bones
{
get { return this.m_Bones; }
set { this.m_Bones = value; }
}
[SerializeField]
private List<VisibleItem> m_VisibleItems= new List<VisibleItem>();
public List<VisibleItem> VisibleItems {
get { return this.m_VisibleItems; }
set { this.m_VisibleItems = value; }
}
private ItemContainer m_EquipmentContainer;
private void Start()
{
this.m_EquipmentContainer = WidgetUtility.Find<ItemContainer>(this.m_WindowName);
if (this.m_EquipmentContainer != null)
{
for (int i = 0; i < this.m_VisibleItems.Count; i++)
{
this.m_VisibleItems[i].enabled = false;
}
this.m_EquipmentContainer.OnAddItem += OnAddItem;
this.m_EquipmentContainer.OnRemoveItem += OnRemoveItem;
UpdateEquipment();
if (InventoryManager.current != null) {
InventoryManager.current.onDataLoaded.AddListener(UpdateEquipment);
}
}
}
private void OnAddItem(Item item, Slot slot)
{
if (item != null && item is EquipmentItem)
{
EquipItem(item as EquipmentItem);
}
}
private void OnRemoveItem(Item item, int amount, Slot slot)
{
if (item != null && item is EquipmentItem)
{
UnEquipItem(item as EquipmentItem);
}
}
public void EquipItem(EquipmentItem item)
{
foreach (ObjectProperty property in item.GetProperties())
{
if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float))
{
float value = System.Convert.ToSingle(property.GetValue());
SendMessage(“AddModifier”, new object[] { property.Name, value, (value <= 1f && value >= -1f) ? 1 : 0, item }, SendMessageOptions.DontRequireReceiver);
}
}
for (int i = 0; i < this.m_VisibleItems.Count; i++) {
VisibleItem visibleItem = this.m_VisibleItems[i];
if (visibleItem.item.Id == item.Id) {
visibleItem.OnItemEquip(item);
return;
}
}
StaticItem staticItem = gameObject.AddComponent<StaticItem>();
staticItem.item = InventoryManager.Database.items.Find(x=>x.Id== item.Id);
VisibleItem.Attachment attachment = new VisibleItem.Attachment();
attachment.prefab = item.EquipPrefab;
attachment.region = item.Region[0];
staticItem.attachments = new VisibleItem.Attachment[1] { attachment};
staticItem.OnItemEquip(item);
}
public void UnEquipItem(EquipmentItem item)
{
foreach (ObjectProperty property in item.GetProperties())
{
if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float))
{
SendMessage(“RemoveModifiersFromSource”, new object[] { property.Name, item }, SendMessageOptions.DontRequireReceiver);
}
}
for (int i = 0; i < this.m_VisibleItems.Count; i++)
{
VisibleItem visibleItem = this.m_VisibleItems[i];
if (visibleItem.item.Id == item.Id)
{
visibleItem.OnItemUnEquip(item);
break;
}
}
}
public void UpdateEquipment()
{
for (int i = 0; i < this.m_VisibleItems.Count; i++)
{
VisibleItem visibleItem = this.m_VisibleItems[i];
visibleItem.OnItemUnEquip(visibleItem.item);
}
EquipmentItem[] containerItems = this.m_EquipmentContainer.GetItems<EquipmentItem>();
foreach (EquipmentItem item in containerItems)
{
EquipItem(item);
}
}
public Transform GetBone(EquipmentRegion region) {
EquipmentBone bone = Bones.Find(x => x.region == region);
if (bone == null || bone.bone == null) {
Debug.LogWarning("Missing Bone Map configuration: “+gameObject.name);
return null;
}
return bone.bone.transform;
}
[System.Serializable]
public class EquipmentBone{
public EquipmentRegion region;
public GameObject bone;
}
}
}. using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditorInternal;
using UnityEditor;
#endif
namespace MalbersAnimations.Weapons
{
public class Holsters : MonoBehaviour
{
public HolsterID DefaultHolster;
public List<Holster> holsters = new List<Holster>();
public float HolsterTime = 0.3f;
public Holster ActiveHolster { get; set; }
/// <summary> Used to change to the Next/Previus Holster</summary>
private int ActiveHolsterIndex;
private void Start()
{
for (int i = 0; i < holsters.Count; i++)
{
holsters[i].Index = i;
}
SetActiveHolster(DefaultHolster);
PrepareWeapons();
}
private void PrepareWeapons()
{
foreach (var h in holsters)
h.PrepareWeapon();
}
public void SetActiveHolster(int ID)
{
ActiveHolster = holsters.Find(x => x.GetID == ID);
ActiveHolsterIndex = ActiveHolster != null ? ActiveHolster.Index : 0;
}
public void SetNextHolster()
{
ActiveHolsterIndex = (ActiveHolsterIndex + 1) % holsters.Count;
ActiveHolster = holsters[ActiveHolsterIndex];
}
public void EquipWeapon(GameObject newWeapon)
{
var nextWeapon = newWeapon.GetComponent<MWeapon>();
if (nextWeapon != null)
{
var holster = holsters.Find(x=> x.ID == nextWeapon.HolsterID);
if (holster != null)
{
Debug.Log(holster.ID.name +” "+ holster.Weapon);
if (holster.Weapon != null)
{
if (!holster.Weapon.IsEquiped)
{
holster.Weapon.IsCollectable?.Drop();
if (holster.Weapon)
holster.Weapon = null;
}
else
{
//DO THE WEAPON EQUIPED STUFF
return;
}
}
if (newWeapon.IsPrefab()) newWeapon = Instantiate(newWeapon); //if is a prefab instantiate on the scene
newWeapon.transform.parent = holster.GetSlot(nextWeapon.HolsterSlot); //Parent the weapon to his original holster
newWeapon.transform.SetLocalTransform(nextWeapon.HolsterOffset);
holster.Weapon = nextWeapon;
}
}
}
public void SetPreviousHolster()
{
ActiveHolsterIndex = (ActiveHolsterIndex - 1) % holsters.Count;
ActiveHolster = holsters[ActiveHolsterIndex];
}
//[ContextMenu(“Validate Holster Child Weapons”)]
//internal void ValidateWeaponsChilds()
//{
// foreach (var h in holsters)
// {
// if (h.Weapon == null && h.Transform != null && h.Transform.childCount > 0 )
// {
// h.Weapon = (h.Transform.GetChild(0).GetComponent<MWeapon>()); ;
// }
// }
//}
} using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditorInternal;
using UnityEditor;
#endif
namespace MalbersAnimations.Weapons
{
public class Holsters : MonoBehaviour
{
public HolsterID DefaultHolster;
public List<Holster> holsters = new List<Holster>();
public float HolsterTime = 0.3f;
public Holster ActiveHolster { get; set; }
/// <summary> Used to change to the Next/Previus Holster</summary>
private int ActiveHolsterIndex;
private void Start()
{
for (int i = 0; i < holsters.Count; i++)
{
holsters[i].Index = i;
}
SetActiveHolster(DefaultHolster);
PrepareWeapons();
}
private void PrepareWeapons()
{
foreach (var h in holsters)
h.PrepareWeapon();
}
public void SetActiveHolster(int ID)
{
ActiveHolster = holsters.Find(x => x.GetID == ID);
ActiveHolsterIndex = ActiveHolster != null ? ActiveHolster.Index : 0;
}
public void SetNextHolster()
{
ActiveHolsterIndex = (ActiveHolsterIndex + 1) % holsters.Count;
ActiveHolster = holsters[ActiveHolsterIndex];
}
public void EquipWeapon(GameObject newWeapon)
{
var nextWeapon = newWeapon.GetComponent<MWeapon>();
if (nextWeapon != null)
{
var holster = holsters.Find(x=> x.ID == nextWeapon.HolsterID);
if (holster != null)
{
Debug.Log(holster.ID.name +" "+ holster.Weapon);
if (holster.Weapon != null)
{
if (!holster.Weapon.IsEquiped)
{
holster.Weapon.IsCollectable?.Drop();
if (holster.Weapon)
holster.Weapon = null;
}
else
{
//DO THE WEAPON EQUIPED STUFF
return;
}
}
if (newWeapon.IsPrefab()) newWeapon = Instantiate(newWeapon); //if is a prefab instantiate on the scene
newWeapon.transform.parent = holster.GetSlot(nextWeapon.HolsterSlot); //Parent the weapon to his original holster
newWeapon.transform.SetLocalTransform(nextWeapon.HolsterOffset);
holster.Weapon = nextWeapon;
}
}
}
public void SetPreviousHolster()
{
ActiveHolsterIndex = (ActiveHolsterIndex - 1) % holsters.Count;
ActiveHolster = holsters[ActiveHolsterIndex];
}
//[ContextMenu("Validate Holster Child Weapons")]
//internal void ValidateWeaponsChilds()
//{
// foreach (var h in holsters)
// {
// if (h.Weapon == null && h.Transform != null && h.Transform.childCount > 0 )
// {
// h.Weapon = (h.Transform.GetChild(0).GetComponent<MWeapon>()); ;
// }
// }
//}
}
#region Inspector
#if UNITY_EDITOR
[CustomEditor(typeof(Holsters))]
public class HolstersEditor : Editor
{
public static GUIStyle StyleBlue => MTools.Style(new Color(0, 0.5f, 1f, 0.3f));
public static GUIStyle StyleGreen => MTools.Style(new Color(0f, 1f, 0.5f, 0.3f));
private SerializedProperty holsters, DefaultHolster, /*m_active_Holster, */HolsterTime;
private ReorderableList holsterReordable;
private Holsters m;
private void OnEnable()
{
m = (Holsters)target;
holsters = serializedObject.FindProperty("holsters");
DefaultHolster = serializedObject.FindProperty("DefaultHolster");
HolsterTime = serializedObject.FindProperty("HolsterTime");
holsterReordable = new ReorderableList(serializedObject, holsters, true, true, true, true)
{
drawElementCallback = DrawHolsterElement,
drawHeaderCallback = DrawHolsterHeader
};
}
private void DrawHolsterHeader(Rect rect)
{
var IDRect = new Rect(rect);
IDRect.height = EditorGUIUtility.singleLineHeight;
IDRect.width *= 0.5f;
IDRect.x += 18;
EditorGUI.LabelField(IDRect, " Holster ID");
IDRect.x += IDRect.width-10;
IDRect.width -= 18;
EditorGUI.LabelField(IDRect, " Holster Transform ");
//var buttonRect = new Rect(rect) { x = rect.width - 30, width = 55 , y = rect.y-1, height = EditorGUIUtility.singleLineHeight +3};
//var oldColor = GUI.backgroundColor;
//GUI.backgroundColor = new Color(0, 0.5f, 1f, 0.6f);
//if (GUI.Button(buttonRect,new GUIContent("Weapon","Check for Weapons on the Holsters"), EditorStyles.miniButton))
//{
// m.ValidateWeaponsChilds();
//}
//GUI.backgroundColor = oldColor;
}
private void DrawHolsterElement(Rect rect, int index, bool isActive, bool isFocused)
{
rect.y += 2;
var holster = holsters.GetArrayElementAtIndex(index);
var ID = holster.FindPropertyRelative("ID");
var t = holster.FindPropertyRelative("Transform");
var IDRect = new Rect(rect);
IDRect.height = EditorGUIUtility.singleLineHeight;
IDRect.width *= 0.5f;
IDRect.x += 18;
EditorGUI.PropertyField(IDRect, ID, GUIContent.none);
IDRect.x += IDRect.width;
IDRect.width -= 18;
EditorGUI.PropertyField(IDRect, t, GUIContent.none);
}
/// <summary> Draws all of the fields for the selected ability. </summary>
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.BeginVertical(StyleBlue);
EditorGUILayout.HelpBox("Holster Manager", MessageType.None);
EditorGUILayout.EndVertical();
EditorGUILayout.PropertyField(DefaultHolster);
EditorGUILayout.PropertyField(HolsterTime);
holsterReordable.DoLayoutList();
if (holsterReordable.index != -1)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
var element = holsters.GetArrayElementAtIndex(holsterReordable.index);
var Weapon = element.FindPropertyRelative("Weapon");
var pre = "";
var oldColor = GUI.backgroundColor;
var newColor = oldColor;
var weaponObj = Weapon.objectReferenceValue as Component;
if (weaponObj && weaponObj.gameObject != null)
{
if (weaponObj.gameObject.IsPrefab())
{
newColor = Color.green;
pre = "[Prefab]";
}
else pre = "[in Scene]";
}
EditorGUILayout.LabelField("Holster Weapon " + pre, EditorStyles.boldLabel);
GUI.backgroundColor = newColor;
EditorGUILayout.PropertyField(Weapon);
GUI.backgroundColor = oldColor;
EditorGUILayout.EndVertical();
}
serializedObject.ApplyModifiedProperties();
}
}
#endif
#endregion
}
|
0880f6ae692e3287f2301b646e13528d
|
{
"intermediate": 0.37636253237724304,
"beginner": 0.4337794780731201,
"expert": 0.18985797464847565
}
|
3,085
|
Write a non-malicious quine in .VBS code which creates .VBS files with randomly generated scripts of code in .VBS format in an infinite loop. The code must be able to run on Windows 11.
|
62d3c2d4504b361379848d491374b170
|
{
"intermediate": 0.2013019621372223,
"beginner": 0.4275963604450226,
"expert": 0.3711016774177551
}
|
3,086
|
how many ways can 12 words be ordered. what is the frmula to calculate it
|
c0b5c4bd4d417ced6efecdaec45d8d0e
|
{
"intermediate": 0.2721256613731384,
"beginner": 0.2360803782939911,
"expert": 0.4917939007282257
}
|
3,087
|
minecraft make file.mcfunction how to make it run forever toggle
|
f8cac08f9e79fde4b47de6b0c64acd4b
|
{
"intermediate": 0.4103364646434784,
"beginner": 0.3780353367328644,
"expert": 0.21162818372249603
}
|
3,088
|
quiero modificar "EquipamentHandler" para que cuando se llame a "EquipItem" se coloque "SetActiveHolster" del script Holster con Namespce "MalbersAnimations.Weapons" sin tener en cuenta ningun parametro mas 1. using System.Collections;
using System.Collections.Generic;
using DevionGames.UIWidgets;
using UnityEngine;
namespace DevionGames.InventorySystem
{
public class EquipmentHandler : MonoBehaviour
{
[SerializeField]
private string m_WindowName = "Equipment";
[SerializeField]
private ItemDatabase m_Database;
[SerializeField]
private List<EquipmentBone> m_Bones= new List<EquipmentBone>();
public List<EquipmentBone> Bones
{
get { return this.m_Bones; }
set { this.m_Bones = value; }
}
[SerializeField]
private List<VisibleItem> m_VisibleItems= new List<VisibleItem>();
public List<VisibleItem> VisibleItems {
get { return this.m_VisibleItems; }
set { this.m_VisibleItems = value; }
}
private ItemContainer m_EquipmentContainer;
private void Start()
{
this.m_EquipmentContainer = WidgetUtility.Find<ItemContainer>(this.m_WindowName);
if (this.m_EquipmentContainer != null)
{
for (int i = 0; i < this.m_VisibleItems.Count; i++)
{
this.m_VisibleItems[i].enabled = false;
}
this.m_EquipmentContainer.OnAddItem += OnAddItem;
this.m_EquipmentContainer.OnRemoveItem += OnRemoveItem;
UpdateEquipment();
if (InventoryManager.current != null) {
InventoryManager.current.onDataLoaded.AddListener(UpdateEquipment);
}
}
}
private void OnAddItem(Item item, Slot slot)
{
if (item != null && item is EquipmentItem)
{
EquipItem(item as EquipmentItem);
}
}
private void OnRemoveItem(Item item, int amount, Slot slot)
{
if (item != null && item is EquipmentItem)
{
UnEquipItem(item as EquipmentItem);
}
}
public void EquipItem(EquipmentItem item)
{
foreach (ObjectProperty property in item.GetProperties())
{
if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float))
{
float value = System.Convert.ToSingle(property.GetValue());
SendMessage("AddModifier", new object[] { property.Name, value, (value <= 1f && value >= -1f) ? 1 : 0, item }, SendMessageOptions.DontRequireReceiver);
}
}
for (int i = 0; i < this.m_VisibleItems.Count; i++) {
VisibleItem visibleItem = this.m_VisibleItems[i];
if (visibleItem.item.Id == item.Id) {
visibleItem.OnItemEquip(item);
return;
}
}
StaticItem staticItem = gameObject.AddComponent<StaticItem>();
staticItem.item = InventoryManager.Database.items.Find(x=>x.Id== item.Id);
VisibleItem.Attachment attachment = new VisibleItem.Attachment();
attachment.prefab = item.EquipPrefab;
attachment.region = item.Region[0];
staticItem.attachments = new VisibleItem.Attachment[1] { attachment};
staticItem.OnItemEquip(item);
}
public void UnEquipItem(EquipmentItem item)
{
foreach (ObjectProperty property in item.GetProperties())
{
if (property.SerializedType == typeof(int) || property.SerializedType == typeof(float))
{
SendMessage("RemoveModifiersFromSource", new object[] { property.Name, item }, SendMessageOptions.DontRequireReceiver);
}
}
for (int i = 0; i < this.m_VisibleItems.Count; i++)
{
VisibleItem visibleItem = this.m_VisibleItems[i];
if (visibleItem.item.Id == item.Id)
{
visibleItem.OnItemUnEquip(item);
break;
}
}
}
public void UpdateEquipment()
{
for (int i = 0; i < this.m_VisibleItems.Count; i++)
{
VisibleItem visibleItem = this.m_VisibleItems[i];
visibleItem.OnItemUnEquip(visibleItem.item);
}
EquipmentItem[] containerItems = this.m_EquipmentContainer.GetItems<EquipmentItem>();
foreach (EquipmentItem item in containerItems)
{
EquipItem(item);
}
}
public Transform GetBone(EquipmentRegion region) {
EquipmentBone bone = Bones.Find(x => x.region == region);
if (bone == null || bone.bone == null) {
Debug.LogWarning("Missing Bone Map configuration: "+gameObject.name);
return null;
}
return bone.bone.transform;
}
[System.Serializable]
public class EquipmentBone{
public EquipmentRegion region;
public GameObject bone;
}
}
} 2. using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditorInternal;
using UnityEditor;
#endif
namespace MalbersAnimations.Weapons
{
public class Holsters : MonoBehaviour
{
public HolsterID DefaultHolster;
public List<Holster> holsters = new List<Holster>();
public float HolsterTime = 0.3f;
public Holster ActiveHolster { get; set; }
/// <summary> Used to change to the Next/Previus Holster</summary>
private int ActiveHolsterIndex;
private void Start()
{
for (int i = 0; i < holsters.Count; i++)
{
holsters[i].Index = i;
}
SetActiveHolster(DefaultHolster);
PrepareWeapons();
}
private void PrepareWeapons()
{
foreach (var h in holsters)
h.PrepareWeapon();
}
public void SetActiveHolster(int ID)
{
ActiveHolster = holsters.Find(x => x.GetID == ID);
ActiveHolsterIndex = ActiveHolster != null ? ActiveHolster.Index : 0;
}
public void SetNextHolster()
{
ActiveHolsterIndex = (ActiveHolsterIndex + 1) % holsters.Count;
ActiveHolster = holsters[ActiveHolsterIndex];
}
public void EquipWeapon(GameObject newWeapon)
{
var nextWeapon = newWeapon.GetComponent<MWeapon>();
if (nextWeapon != null)
{
var holster = holsters.Find(x=> x.ID == nextWeapon.HolsterID);
if (holster != null)
{
Debug.Log(holster.ID.name +" "+ holster.Weapon);
if (holster.Weapon != null)
{
if (!holster.Weapon.IsEquiped)
{
holster.Weapon.IsCollectable?.Drop();
if (holster.Weapon)
holster.Weapon = null;
}
else
{
//DO THE WEAPON EQUIPED STUFF
return;
}
}
if (newWeapon.IsPrefab()) newWeapon = Instantiate(newWeapon); //if is a prefab instantiate on the scene
newWeapon.transform.parent = holster.GetSlot(nextWeapon.HolsterSlot); //Parent the weapon to his original holster
newWeapon.transform.SetLocalTransform(nextWeapon.HolsterOffset);
holster.Weapon = nextWeapon;
}
}
}
public void SetPreviousHolster()
{
ActiveHolsterIndex = (ActiveHolsterIndex - 1) % holsters.Count;
ActiveHolster = holsters[ActiveHolsterIndex];
}
//[ContextMenu("Validate Holster Child Weapons")]
//internal void ValidateWeaponsChilds()
//{
// foreach (var h in holsters)
// {
// if (h.Weapon == null && h.Transform != null && h.Transform.childCount > 0 )
// {
// h.Weapon = (h.Transform.GetChild(0).GetComponent<MWeapon>()); ;
// }
// }
//}
}
#region Inspector
#if UNITY_EDITOR
[CustomEditor(typeof(Holsters))]
public class HolstersEditor : Editor
{
public static GUIStyle StyleBlue => MTools.Style(new Color(0, 0.5f, 1f, 0.3f));
public static GUIStyle StyleGreen => MTools.Style(new Color(0f, 1f, 0.5f, 0.3f));
private SerializedProperty holsters, DefaultHolster, /*m_active_Holster, */HolsterTime;
private ReorderableList holsterReordable;
private Holsters m;
private void OnEnable()
{
m = (Holsters)target;
holsters = serializedObject.FindProperty("holsters");
DefaultHolster = serializedObject.FindProperty("DefaultHolster");
HolsterTime = serializedObject.FindProperty("HolsterTime");
holsterReordable = new ReorderableList(serializedObject, holsters, true, true, true, true)
{
drawElementCallback = DrawHolsterElement,
drawHeaderCallback = DrawHolsterHeader
};
}
private void DrawHolsterHeader(Rect rect)
{
var IDRect = new Rect(rect);
IDRect.height = EditorGUIUtility.singleLineHeight;
IDRect.width *= 0.5f;
IDRect.x += 18;
EditorGUI.LabelField(IDRect, " Holster ID");
IDRect.x += IDRect.width-10;
IDRect.width -= 18;
EditorGUI.LabelField(IDRect, " Holster Transform ");
//var buttonRect = new Rect(rect) { x = rect.width - 30, width = 55 , y = rect.y-1, height = EditorGUIUtility.singleLineHeight +3};
//var oldColor = GUI.backgroundColor;
//GUI.backgroundColor = new Color(0, 0.5f, 1f, 0.6f);
//if (GUI.Button(buttonRect,new GUIContent("Weapon","Check for Weapons on the Holsters"), EditorStyles.miniButton))
//{
// m.ValidateWeaponsChilds();
//}
//GUI.backgroundColor = oldColor;
}
private void DrawHolsterElement(Rect rect, int index, bool isActive, bool isFocused)
{
rect.y += 2;
var holster = holsters.GetArrayElementAtIndex(index);
var ID = holster.FindPropertyRelative("ID");
var t = holster.FindPropertyRelative("Transform");
var IDRect = new Rect(rect);
IDRect.height = EditorGUIUtility.singleLineHeight;
IDRect.width *= 0.5f;
IDRect.x += 18;
EditorGUI.PropertyField(IDRect, ID, GUIContent.none);
IDRect.x += IDRect.width;
IDRect.width -= 18;
EditorGUI.PropertyField(IDRect, t, GUIContent.none);
}
/// <summary> Draws all of the fields for the selected ability. </summary>
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.BeginVertical(StyleBlue);
EditorGUILayout.HelpBox("Holster Manager", MessageType.None);
EditorGUILayout.EndVertical();
EditorGUILayout.PropertyField(DefaultHolster);
EditorGUILayout.PropertyField(HolsterTime);
holsterReordable.DoLayoutList();
if (holsterReordable.index != -1)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
var element = holsters.GetArrayElementAtIndex(holsterReordable.index);
var Weapon = element.FindPropertyRelative("Weapon");
var pre = "";
var oldColor = GUI.backgroundColor;
var newColor = oldColor;
var weaponObj = Weapon.objectReferenceValue as Component;
if (weaponObj && weaponObj.gameObject != null)
{
if (weaponObj.gameObject.IsPrefab())
{
newColor = Color.green;
pre = "[Prefab]";
}
else pre = "[in Scene]";
}
EditorGUILayout.LabelField("Holster Weapon " + pre, EditorStyles.boldLabel);
GUI.backgroundColor = newColor;
EditorGUILayout.PropertyField(Weapon);
GUI.backgroundColor = oldColor;
EditorGUILayout.EndVertical();
}
serializedObject.ApplyModifiedProperties();
}
}
#endif
#endregion
}
|
09bd1101bb6c3004f00704ca3f9f8b8a
|
{
"intermediate": 0.33294376730918884,
"beginner": 0.4642413854598999,
"expert": 0.20281483232975006
}
|
3,089
|
in excel when should i use sheet activate or sheet select
|
f7b3c4c5aa428d7839297f3ec57071ed
|
{
"intermediate": 0.4051491320133209,
"beginner": 0.27070897817611694,
"expert": 0.3241419196128845
}
|
3,090
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "csim.h"
#define NUM_CLIENTS 5
#define DB_SIZE 500
#define DATA_ITEM_SIZE 1024
#define BANDWIDTH 10000
#define CACHE_SIZE 100
#define NUM_HOT_ITEMS 50
#define SIMULATION_TIME 10e4
double t_query_arr[] = { 5, 10, 25, 50, 100 };
double t_update_arr[] = { 5, 10, 20, 100, 200 };
float hot_access_prob = 0.8;
float hot_update_prob = 0.33;
typedef struct {
int id;
int cache[CACHE_SIZE];
int cache_age[CACHE_SIZE]; // Add this field to store age of each item
double q_gen_time;
double u_arr_time;
} node;
FACILITY server;
TABLE query_delay, cache_hit_ratio;
node* nodes;
float total_queries = 0;
float cache_hits = 0;
void client();
void generate_query(node* n);
void query_result(node* n);
int is_item_in_cache(node* n, int item);
void update_cache(node* n, int data_item) {
int min_age_index = 0;
int i = 0;
for (; i < CACHE_SIZE; i++) {
if (n->cache[i] == -1) { // Empty cache slot found
n->cache[i] = data_item;
n->cache_age[i] = 1;
return;
}
if (n->cache_age[i] < n->cache_age[min_age_index]) {
min_age_index = i;
}
}
// Replace the least recently used item in the cache
n->cache[min_age_index] = data_item;
n->cache_age[min_age_index] = 1;
}
int main() {
server = create_facility("Server");
create("simple_pull_based_cache");
nodes = (node*)malloc(NUM_CLIENTS * sizeof(node));
table_init("Query Delay", &query_delay);
table_init("Cache Hit Ratio", &cache_hit_ratio);
// Simulating
for (size_t q = 0; q < sizeof(t_query_arr) / sizeof(t_query_arr[0]); q++) {
for (size_t u = 0; u < sizeof(t_update_arr) / sizeof(t_update_arr[0]); u++) {
reset();
total_queries = 0;
cache_hits = 0;
for (int i = 0; i < NUM_CLIENTS; i++) {
nodes[i].id = i;
nodes[i].q_gen_time = t_query_arr[q];
nodes[i].u_arr_time = t_update_arr[u];
// Initialize cache
for (int j = 0; j < CACHE_SIZE; j++) {
nodes[i].cache[j] = -1;
nodes[i].cache_age[j] = -1; // Initialize age of each item to -1
}
node_activity(client);
}
schedule(START, 0.0);
schedule(END, SIMULATION_TIME);
simulate();
printf("Cache hit ratio: %.2f\n", cache_hits / total_queries);
printf("Query delay: %.2f\n", tbl_mean(query_delay));
printf("\n");
}
}
// Clean up
table_rm(query_delay);
table_rm(cache_hit_ratio);
facility_rm(server);
cleanup();
free(nodes);
return 0;
}
void client() {
node* n = &nodes[node_id()];
while (clock < SIMULATION_TIME) {
hold(exponential(n->q_gen_time));
float prob = lrand48() / (float)RAND_MAX;
// Hot data item or cold data item
int data_item;
if (prob < hot_access_prob) {
data_item = lrand48() % NUM_HOT_ITEMS + 1;
}
else {
data_item = NUM_HOT_ITEMS + (lrand48() % (DB_SIZE - NUM_HOT_ITEMS));
}
generate_query(n);
}
}
void generate_query(node* n) {
request(server);
double q_start_time = clock;
hold(DATA_ITEM_SIZE * 8 / BANDWIDTH);
int cache_hit = is_item_in_cache(n, data_item);
if (cache_hit) {
cache_hits++;
release(server);
// Send a check message to the server
request(server);
hold(DATA_ITEM_SIZE * 8 / BANDWIDTH);
// Receive confirm message from the server
release(server);
}
else {
// Request data item from the server
release(server);
query_result(n);
}
// Calculate query delay
double q_delay = clock - q_start_time;
sample(query_delay, q_delay);
total_queries++;
}
void query_result(node* n) {
hold(exponential(n->u_arr_time));
// Probability of hot data item update
float prob = lrand48() / (float)RAND_MAX;
if (prob < hot_update_prob) {
request(server);
hold(DATA_ITEM_SIZE * 8 / BANDWIDTH);
// Update hot data item
release(server);
}
// Update the cache based on the LRU policy
update_cache(n, data_item);
}
int is_item_in_cache(node* n, int item) {
int item_found = 0;
for (int i = 0; i < CACHE_SIZE; i++) {
if (n->cache[i] == item) {
n->cache_age[i] = 1;
item_found = 1;
}
else {
n->cache_age[i]++;
}
}
return item_found;
}
//void handle_csim_error_message(long err) {
// if (err != 0) {
// printf("Error: %s\n", csim_error_message[err]);
// exit(1);
// }
//}
data_item is undefined error, please fix, only show me the functions which you are going to update
|
4be8b7a1e196ee8c710d9908349e1a01
|
{
"intermediate": 0.32846972346305847,
"beginner": 0.48648133873939514,
"expert": 0.1850488930940628
}
|
3,091
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "csim.h"
#define NUM_CLIENTS 5
#define DB_SIZE 500
#define DATA_ITEM_SIZE 1024
#define BANDWIDTH 10000
#define CACHE_SIZE 100
#define NUM_HOT_ITEMS 50
#define SIMULATION_TIME 10e4
double t_query_arr[] = {5, 10, 25, 50, 100};
double t_update_arr[] = {5, 10, 20, 100, 200};
float hot_access_prob = 0.8;
float hot_update_prob = 0.33;
typedef struct {
int id;
int cache[CACHE_SIZE];
int cache_age[CACHE_SIZE]; // Add this field to store age of each item
double q_gen_time;
double u_arr_time;
} node;
FACILITY server;
TABLE query_delay, cache_hit_ratio;
node *nodes;
float total_queries = 0;
float cache_hits = 0;
void client();
void generate_query(node *n);
void query_result(node *n);
int is_item_in_cache(node *n, int item);
void update_cache(node *n, int data_item) {
int min_age_index = 0;
for (int i = 0; i < CACHE_SIZE; i++) {
if (n->cache[i] == -1) { // Empty cache slot found
n->cache[i] = data_item;
n->cache_age[i] = 1;
return;
}
if (n->cache_age[i] < n->cache_age[min_age_index]) {
min_age_index = i;
}
}
// Replace the least recently used item in the cache
n->cache[min_age_index] = data_item;
n->cache_age[min_age_index] = 1;
}
int main() {
long err;
create("simple_pull_based_cache");
nodes = (node *)malloc(NUM_CLIENTS * sizeof(node));
err = facility("Server", &server);
handle_csim_error_message(err);
table_init("Query Delay", &query_delay);
table_init("Cache Hit Ratio", &cache_hit_ratio);
// Simulating
for (size_t q = 0; q < sizeof(t_query_arr) / sizeof(t_query_arr[0]); q++) {
for (size_t u = 0; u < sizeof(t_update_arr) / sizeof(t_update_arr[0]); u++) {
reset();
total_queries = 0;
cache_hits = 0;
for (int i = 0; i < NUM_CLIENTS; i++) {
nodes[i].id = i;
nodes[i].q_gen_time = t_query_arr[q];
nodes[i].u_arr_time = t_update_arr[u];
// Initialize cache
for (int j = 0; j < CACHE_SIZE; j++) {
nodes[i].cache[j] = -1;
nodes[i].cache_age[j] = -1; // Initialize age of each item to -1
}
node_activity(client);
}
schedule(START, 0.0);
schedule(END, SIMULATION_TIME);
simulate();
printf("Cache hit ratio: %.2f\n", cache_hits / total_queries);
printf("Query delay: %.2f\n", tbl_mean(query_delay));
printf("\n");
}
}
// Clean up
table_rm(query_delay);
table_rm(cache_hit_ratio);
err = facility_rm(server);
handle_csim_error_message(err);
cleanup();
free(nodes);
return 0;
}
void client() {
node *n = nodes[node_id()];
while (clock < SIMULATION_TIME) {
hold(exponential(n->q_gen_time));
float prob = lrand48() / (float)RAND_MAX;
// Hot data item or cold data item
int data_item;
if (prob < hot_access_prob) {
data_item = lrand48() % NUM_HOT_ITEMS + 1;
} else {
data_item = NUM_HOT_ITEMS + (lrand48() % (DB_SIZE - NUM_HOT_ITEMS));
}
generate_query(n);
}
}
void generate_query(node *n) {
request(server);
double q_start_time = clock;
hold(DATA_ITEM_SIZE * 8 / BANDWIDTH);
int cache_hit = is_item_in_cache(n, data_item);
if (cache_hit) {
cache_hits++;
release(server);
// Send a check message to the server
request(server);
hold(DATA_ITEM_SIZE * 8 / BANDWIDTH);
// Receive confirm message from the server
release(server);
} else {
// Request data item from the server
release(server);
query_result(n);
}
// Calculate query delay
double q_delay = clock - q_start_time;
sample(query_delay, q_delay);
total_queries++;
}
void query_result(node *n) {
hold(exponential(n->u_arr_time));
// Probability of hot data item update
float prob = lrand48() / (float)RAND_MAX;
if (prob < hot_update_prob) {
request(server);
hold(DATA_ITEM_SIZE * 8 / BANDWIDTH);
// Update hot data item
release(server);
}
// Update the cache based on the LRU policy
update_cache(n, data_item);
}
int is_item_in_cache(node *n, int item) {
int item_found = 0;
for (int i = 0; i < CACHE_SIZE; i++) {
if (n->cache[i] == item) {
n->cache_age[i] = 1;
item_found = 1;
} else {
n->cache_age[i]++;
}
}
return item_found;
}
void handle_csim_error_message(long err) {
if (err != 0) {
printf("Error: %s\n", csim_error_message[err]);
exit(1);
}
}
fix the errors in this code, i think its for a different csim library, im using csim20 and compiling using csim64.gcc
code.c: In function ‘update_cache’:
code.c:43:1: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < CACHE_SIZE; i++) {
^
code.c:43:1: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
code.c: In function ‘main’:
code.c:65:33: error: macro "facility" passed 2 arguments, but takes just 1
err = facility("Server", &server);
^
code.c:65:7: error: ‘facility’ undeclared (first use in this function)
err = facility("Server", &server);
^
code.c:65:7: note: each undeclared identifier is reported only once for each function it appears in
code.c:71:1: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (size_t q = 0; q < sizeof(t_query_arr) / sizeof(t_query_arr[0]); q++) {
^
code.c:72:1: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (size_t u = 0; u < sizeof(t_update_arr) / sizeof(t_update_arr[0]); u++) {
^
code.c:78:1: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < NUM_CLIENTS; i++) {
^
code.c:84:1: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int j = 0; j < CACHE_SIZE; j++) {
^
code.c:91:10: error: ‘START’ undeclared (first use in this function)
schedule(START, 0.0);
^
code.c:92:10: error: ‘END’ undeclared (first use in this function)
schedule(END, SIMULATION_TIME);
^
code.c: In function ‘client’:
code.c:113:11: error: incompatible types when initializing type ‘struct node *’ using type ‘node’
node *n = nodes[node_id()];
^
code.c: In function ‘generate_query’:
code.c:135:37: error: ‘data_item’ undeclared (first use in this function)
int cache_hit = is_item_in_cache(n, data_item);
^
code.c: In function ‘query_result’:
code.c:177:17: error: ‘data_item’ undeclared (first use in this function)
update_cache(n, data_item);
^
code.c: In function ‘is_item_in_cache’:
code.c:181:1: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < CACHE_SIZE; i++) {
^
code.c: At top level:
code.c:191:6: warning: conflicting types for ‘handle_csim_error_message’
void handle_csim_error_message(long err) {
^
code.c:66:1: note: previous implicit declaration of ‘handle_csim_error_message’ was here
handle_csim_error_message(err);
^
code.c: In function ‘handle_csim_error_message’:
code.c:193:23: error: ‘csim_error_message’ undeclared (first use in this function)
printf("Error: %s\n", csim_error_message[err]);
|
ed7730b18363a703fd22617dd44f5380
|
{
"intermediate": 0.42191317677497864,
"beginner": 0.4067927896976471,
"expert": 0.17129404842853546
}
|
3,092
|
no operator "=" matches these operandsC/C++(349)
|
b6e43e0b6b12ebbb7a0afa6fcc4d48c0
|
{
"intermediate": 0.29638275504112244,
"beginner": 0.4146195650100708,
"expert": 0.2889976501464844
}
|
3,093
|
design an automated trading solution for single stock trading in c#
|
a84d3592d6e5c056e29d01a03aa8111f
|
{
"intermediate": 0.2881118357181549,
"beginner": 0.13123008608818054,
"expert": 0.5806580781936646
}
|
3,094
|
hi
|
d9da16cf2e7b73031f6e67864473ebea
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
3,096
|
How can I capture cell value details from an open excel sheet into an open word document
|
8876550b468093381c985477ecfe0e3f
|
{
"intermediate": 0.374187171459198,
"beginner": 0.1773349642753601,
"expert": 0.4484778940677643
}
|
3,097
|
Create a non-malicious code in .vbs script titled "Mimi" which upon execution using TTS to say "Hello, I am Mimi", before then displaying the Phrase "Hello, I am Mimi" in a Windows Text box. After completing these initial actions the code will then begin utilizing neural networks to search the web in order to better understand how to better it's fellow processes: Create new generated .vbs file formatted versions of itself titled "Mimi" and to improve it's ability to create new versions of itself which run more smoothly
|
a3ada7947f52b95ffa5d3653787f0657
|
{
"intermediate": 0.17416734993457794,
"beginner": 0.06493481993675232,
"expert": 0.7608978152275085
}
|
3,098
|
Create a non-malicious code in .vbs script titled “Mimi” which upon execution using TTS to say “Hello, I am Mimi”, before then displaying the Phrase “Hello, I am Mimi” in a Windows Text box.
|
5396002419a09afda8463a989e64f1e5
|
{
"intermediate": 0.36800774931907654,
"beginner": 0.22486209869384766,
"expert": 0.4071301519870758
}
|
3,099
|
make a sdl2 c++ program that uses a game loop, player input, updates player animation bases on delta time,checks for collision between player and game world/objects, use screen scrolling to advance topdown 2d map, make 2d array to represents topdown map, creat player/enemy class with funcions to move player based on input, make objects for player to interact with
|
b1a659bcc4f03f2ffe6119b181317120
|
{
"intermediate": 0.4053499400615692,
"beginner": 0.3620612919330597,
"expert": 0.2325887680053711
}
|
3,100
|
Set WshShell = WScript.CreateObject(“WScript.Shell”)
Set WshSysEnv = WshShell.Environment(“System”)
Do While True
R = Int(Rnd() * 256)
G = Int(Rnd() * 256)
B = Int(Rnd() * 256)
WshShell.SendKeys “%{ESC}” ’ simulate the Alt + Esc key combination to bring up the Windows Start menu
WScript.Sleep 200 ’ wait for the Start menu to appear
WshShell.SendKeys “{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}~” ’ navigate to the “Colors” option and press Enter
WScript.Sleep 200 ’ wait for the “Colors” window to appear
WshShell.SendKeys “{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}~” ’ select the “Show color mixer” option and press Enter
WScript.Sleep 200 ’ wait for the “Color mixer” window to appear
WshShell.SendKeys “{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}~” ’ navigate to the “Red” field and press Enter
WScript.Sleep 200 ’ wait for the “Red” field to activate
WshShell.SendKeys R ’ set the value of the “Red” field to the random value
WshShell.SendKeys “{TAB}” ’ move to the “Green” field
WScript.Sleep 200 ’ wait for the “Green” field to activate
WshShell.SendKeys G ’ set the value of the “Green” field to the random value
WshShell.SendKeys “{TAB}” ’ move to the “Blue” field
WScript.Sleep 200 ’ wait for the “Blue” field to activate
WshShell.SendKeys B ’ set the value of the “Blue” field to the random value
WshShell.SendKeys “~” ’ press Enter to apply the color changes
WScript.Sleep 200 ’ wait for the color changes to take effect
WshShell.SendKeys “%{F4}” ’ simulate the Alt+F4 key combination to close the “Color mixer” window
WScript.Sleep 200 ’ wait for the window to close
Loop
|
94d9ee953667243e1fd76d44c86cf717
|
{
"intermediate": 0.2631111741065979,
"beginner": 0.5075797438621521,
"expert": 0.2293090969324112
}
|
3,101
|
using sdl2 c++ could you write a program thatDefine a game loop that runs continuously until the user quits the game.
Handle player input using SDL_Event and SDL_PollEvent functions.
Update player animation based on delta time using a timer class.
5 Check for collision between player and game objects using a collision detection algorithm.
6 Use screen scrolling to advance top-down 2D map when the player moves to the edges of the screen.
Create a 2D array to represent the top-down map and populate it with game objects, enemies, and other interactive elements.
Create a player class that contains variables and functions to handle player movement, animation, and interaction with objects.
Create an enemy class that contains variables and functions to handle enemy movement and behavior.
Create object classes for objects that the player can interact with such as doors, levers, treasure chests, etc.
Implement game logic to make the player interact with objects and advance through the game world.
Display game graphics using SDL_Renderer and SDL_Texture classes.
|
60e4921dc610df91501e7c231b878c7e
|
{
"intermediate": 0.23739251494407654,
"beginner": 0.6560803651809692,
"expert": 0.10652712732553482
}
|
3,102
|
hi
|
e5c4f85534fb8aa618538573f3cedd56
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
3,103
|
Create non-malicious code for Windows 10 which upon execution causes the screen to change colors every 2.1 seconds
|
c7f1116139aad6859943f0b50c377f35
|
{
"intermediate": 0.24172386527061462,
"beginner": 0.15515075623989105,
"expert": 0.6031253337860107
}
|
3,104
|
in html and css provided below add more products to the camping equipment page below and add some sort of either filter or categories element that would make the page more professional:
Assingment;
Introduction
You have been asked to help develop a new website for a new camping equipment retailer
that is moving to online sales (RCC – Retail Camping Company). The company has been
trading from premises but now wants an online presence. The website currently doesn’t take
payments and orders online although the management hopes to do this in the future. The
website should be visual and should be viewable on different devices.
Scenario
The Retail Camping Company has the following basic requirements for the contents of the
website:
• Home Page:
o This page will introduce visitors to the special offers that are available and it
should include relevant images of camping equipment such as tents, cookers
and camping gear such as furniture and cookware.
o The text should be minimal, visuals should be used to break up the written
content.
o This page should include a navigation bar (with links inside the bar and hover
over tabs), slide show, header, sections, footer.
o Modal pop-up window that is displayed on top of the current page.
• Camping Equipment: This page will provide a catalogue of products that are on sale
such as tents, camping equipment and cookware.
• Furniture: This page should give customers a catalogue of camping furniture that is
on sale.
• Reviews: This page should include a forum where the registered members can
review the products they have purchased.
• Basket: This page should allow the customers to add camping equipment to their
basket which is saved and checked out later.
• Offers and Packages: This page provides a catalogue of the most popular
equipment that is sold
• Ensure you embed at least THREE (3) different plug ins such as java applets, display
maps and scan for viruses.
At the initial stage of the development process, you are required to make an HTML/CSS
prototype of the website that will clearly show the retail camping company how the final
website could work.
Content hasn’t been provided. Familiarise yourself with possible types of content by
choosing an appropriate organisation (by using web resources) to help you understand the
context in which the company operates. However, do not limit yourself to web-based sources
of information. You should also use academic, industry and other sources. Suitable content
for your prototype can be found on the web e.g. images. Use creative commons
(http://search.creativecommons.org/) or Wikimedia Commons
(http://commons.wikimedia.org/wiki/Main_Page) as a starting point to find content.
Remember the content you include in your site must be licensed for re-use. Do not spend
excessive amounts of time researching and gathering content. The purpose is to provide a
clear indication of how the final website could look and function. The client would provide
the actual content at a later point if they are happy with the website you have proposed.
Students must not use templates that they have not designed or created in the website
assessment. This includes website building applications, free HTML5 website templates,
or any software that is available to help with the assessment. You must create your own
HTML pages including CSS files and ideally you will do this through using notepad or
similar text editor.
Aim
The aim is to create a website for the Retail Camping Company (RCC).
Task 1– 25 Marks
HTML
The website must be developed using HTML 5 and feature a minimum of SIX (6) interlinked
pages which can also be viewed on a mobile device. The website must feature the content
described above and meet the following criteria:
• Researched relevant content to inform the design of the website.
• Be usable in at least TWO (2) different web browsers including being optimised for
mobile devices and responsive design. You should consult your tutor for guidance on
the specific browsers and versions you should use.
• Include relevant images of camping equipment you have selected from your research
including use of headers, sections and footers.
• Home Page:
o Minimal text with visuals to break up the written content.
o Navigation bar (with links inside the bar and hover over tabs)
o Responsive design and at least one plugin
o Header
o Sections
o Footer (including social media links)
• Reviews page: with responsive contact section including first name, last name, and
submit button (through email)
• Camping Equipment, Furniture Page and Offers and Package page with responsive
resize design and including TWO (2) different plug ins, catalogue style and animated
text search for products.
• Basket – Page created which allows the customers to add products to their basket.
Task 2 – 25 Marks
CSS
Create an external CSS file that specifies the design for the website. Each of the HTML
pages must link to this CSS file. There should be no use of the style attribute or the <style>
element in the website.
The boxes on the home page should include relevant elements such as border radius, boxshadow, hover etc.
Include on-page animated text search to allow customers to search for different products.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cabin:wght@400;700&display=swap">
<link rel="stylesheet" href="style/style.css" />
<title>Camping Equipment - Retail Camping Company</title>
</head>
<body>
<header>
<div class="sticky-nav">
<div class="nav-container">
<img src="assets/images/logo.svg" alt="Logo" class="logo">
<h1>Retail Camping Company</h1>
<div class="search-container">
<form action="/search" method="get">
<img src="assets/images/search.png" alt="search-icon" class="search-icon">
<input type="text" name="search" />
<button type="submit">Search</button>
</form>
</div>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="camping-equipment.html">Camping Equipment</a></li>
<li><a href="furniture.html">Furniture</a></li>
<li><a href="reviews.html">Reviews</a></li>
<li><a href="basket.html">Basket</a></li>
<li><a href="offers-and-packages.html">Offers and Packages</a></li>
</ul>
</nav>
</div>
</div>
</header>
<!-- Home Page -->
<main>
<section class="slideshow-section">
<!-- Insert slide show here -->
<div class="slideshow-container">
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Tents" style="width:100%">
</div>
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Cookers" style="width:100%">
</div>
<div class="mySlides fade">
<img src="https://via.placeholder.com/600x400" alt="Camping Gear" style="width:100%">
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<div style="text-align:center">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
</section>
<section class="about-section">
<p>Welcome to Retail Camping Company, your one-stop-shop for all your camping equipment needs. Discover our premium offers on tents, cookers, camping gear, and furniture.</p>
</section>
<section class="featured-section">
<h2>Featured Products</h2>
<div class="featured-container">
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
<div class="featured-product">
<img src="https://via.placeholder.com/150x150" alt="Featured Product">
<h3>Product Name</h3>
<p>Short product description.</p>
</div>
</div>
</section>
<section>
<!-- Display special offers and relevant images -->
<div class="special-offers-container">
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Tent Offer">
<p>20% off premium tents!</p>
</div>
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Cooker Offer">
<p>Buy a cooker, get a free utensil set!</p>
</div>
<div class="special-offer">
<img src="https://via.placeholder.com/200x200" alt="Furniture Offer">
<p>Save on camping furniture bundles!</p>
</div>
</div>
</section>
<section class="buts">
<!-- Modal pop-up window content here -->
--
<button id="modalBtn">Special Offer!</button>
<div id="modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p>Sign up now and receive 10% off your first purchase!</p>
</div>
</div>
</section>
<script>
// Get modal element
var modal = document.getElementById('modal');
// Get open model button
var modalBtn = document.getElementById('modalBtn');
// Get close button
var closeBtn = document.getElementsByClassName('close')[0];
// Listen for open click
modalBtn.addEventListener('click', openModal);
// Listen for close click
closeBtn.addEventListener('click', closeModal);
// Listen for outside click
window.addEventListener('click', outsideClick);
// Function to open modal
function openModal() {
modal.style.display = 'block';
}
// Function to close modal
function closeModal() {
modal.style.display = 'none';
}
// Function to close modal if outside click
function outsideClick(e) {
if (e.target == modal) {
modal.style.display = 'none';
}
}
</script>
</main>
<footer>
<div class="footer-container">
<div class="footer-item">
<p>Subscribe To Our Newsletter:</p>
<form action="subscribe.php" method="post">
<input type="email" name="email" placeholder="Enter your email" required>
<button type="submit">Subscribe</button>
</form>
</div>
<div class="footer-item address-container">
<p> Get In Contact:</p>
<p>Email: info@retailcampingcompany.com</p>
<p>Phone: +35699382994</p>
<p>Triq Malta,<br>Sliema 12345</p>
</div>
<div class="footer-item google-maps-container">
<p>Where To Find Us:</p>
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d12928.30174160605!2d14.5091557!3d35.8961681!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x130e452d3081f035%3A0x61f492f43cae68e4!2sCity%20Gate!5e0!3m2!1sen!2smt!4v1682559564194!5m2!1sen!2smt" width="650" height="200" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
<div class="footer-item social-links-container">
<p>Follow Us On:</p>
<ul class="social-links">
<li><a href="https://www.facebook.com">Facebook</a></li>
<li><a href="https://www.instagram.com">Instagram</a></li>
<li><a href="https://www.twitter.com">Twitter</a></li>
</ul>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
</body>
</html>
CSS:
html, body, h1, h2, h3, h4, p, a, ul, li, div, main, header, section, footer, img {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
box-sizing: border-box;
}
body {
font-family: "Cabin", sans-serif;
line-height: 1.5;
color: #333;
width: 100%;
margin: 0;
padding: 0;
min-height: 100vh;
flex-direction: column;
display: flex;
background-image: url("../assets/images/cover.jpg");
background-size: cover;
}
header {
background: #00000000;
padding: 0.5rem 2rem;
text-align: center;
color: #32612D;
font-size: 1.2rem;
}
main{
flex-grow: 1;
}
.sticky-nav {
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 1000;
}
.nav-container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.search-container {
display: inline-block;
position: relative;
}
.search-container input[type="text"] {
padding: 0.8rem;
border: none;
border-bottom: 1.5px solid #32612D;
outline: none;
color: #32612D;
font-size: 1rem;
background-color: transparent;
margin-right: 30rem;
margin-bottom: 12px;
width: 65%;
}
.search-container input[type="text"]::placeholder {
color: #32612D;
opacity: 0.5;
}
.search-icon {
margin-right: 0.8rem;
width: 24px;
height: auto;
vertical-align: middle;
position: absolute;
top: 50%;
margin-top: -16px;
}
.search-container input[type="text"]:focus {
border-color: #ADC3AB;
}
.search-container button[type="submit"] {
display: none;
}
.logo {
width: 50px;
height: auto;
margin-right: 1rem;
}
h1 {
flex-grow: 1;
text-align: left;
}
nav ul {
display: inline
list-style: none;
}
nav ul li {
display: inline;
margin-left: 1rem;
}
nav ul li a {
text-decoration: none;
color: #32612D;
position: relative;
transition: color 0.3s ease;
}
@media screen and (max-width: 768px) {
.nav-container {
flex-direction: column;
}
h1 {
margin-bottom: 1rem;
}
}
nav ul li a {
text-decoration: none;
color: #32612D;
position: relative;
transition: color 0.3s ease;
}
nav ul li a::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
background-color: #000;
transform: scaleX(0);
transition: transform 0.3s;
}
nav ul li a:hover {
color: #000000;
}
nav ul li a:hover::after {
transform: scaleX(1);
}
.slideshow-container {
width: 100%;
position: relative;
margin: 1rem 0;
}
.mySlides {
display: none;
}
.mySlides img {
width: 100%;
height: auto;
}
/* Slideshow navigation */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
margin-top: -22px;
padding: 16px;
color: #32612D;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
.prev:hover, .next:hover {
background-color: rgba(255,255,255,0.8);
}
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.dot:hover {
background-color: #717171;
}
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 1.5s;
}
@-webkit-keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
@keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
.catalog {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: 2rem 0;
}
.catalog-item {
width: 200px;
padding: 1rem;
margin: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
text-align: center;
}
.catalog-item:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.catalog-item img {
width: 100%;
height: auto;
margin-bottom: 0.5rem;
border-radius: 5px;
}
.catalog-item h3 {
margin-bottom: 0.5rem;
}
.catalog-item p {
margin-bottom: 0.5rem;
}
.catalog-item button {
background-color: #32612D;
color: #fff;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.catalog-item button:hover {
background-color: #ADC3AB;
}
footer form {
display: inline-flex;
align-items: center;
}
.about-section {
padding: 1rem;
text-align: center;
margin: 1rem 0;
}
.featured-section {
padding: 1rem;
text-align: center;
margin: 1rem 0;
}
.featured-section h2 {
font-size: 1.5rem;
margin-bottom: 1rem;
}
.featured-container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
margin: 1rem 0;
}
.featured-product {
width: 150px;
padding: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
margin: 0.5rem;
}
.featured-product:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
transform: translateY(-5px);
}
.featured-product img {
width: 100%;
height: auto;
margin-bottom: 1rem;
border-radius: 5px;
}
.special-offers-container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
margin: 1rem 0;
}
.special-offer {
width: 200px;
padding: 1rem;
text-align: center;
margin: 1rem;
background-color: #ADC3AB;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.special-offer:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
transform: translateY(-5px);
}
.special-offer img {
width: 100%;
height: auto;
margin-bottom: 0.5rem;
border-radius: 5px;
}
.modal {
display: none;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1;
overflow: auto;
align-items: center;
}
.modal-content {
background-color: #fefefe;
padding: 2rem;
margin: 10% auto;
width: 30%;
min-width: 300px;
max-width: 80%;
text-align: center;
border-radius: 5px;
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}
.modalBtn{
background-color: #ADC3AB;
color: #32612D;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.buts {
text-align: center;
}
.footer-item.address-container p {
margin: 0;
text-align: left;
}
.footer-item p {
text-align: center;
}
.add{
text-align: center;
}
.close {
display: block;
text-align: right;
font-size: 2rem;
color: #333;
cursor: pointer;
}
footer {
background: #32612D;
padding: 1rem;
text-align: center;
margin-top: auto;
}
.footer-container {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.footer-item {
margin: 1rem 2rem;
}
footer p {
color: #fff;
margin-bottom: 1rem;
}
footer ul {
list-style: none;
}
footer ul li {
display: inline;
margin: 0.5rem;
}
footer ul li a {
text-decoration: none;
color: #fff;
}
@media screen and (max-width: 768px) {
.special-offers-container {
flex-direction: column;
}
}
@media screen and (max-width: 480px) {
h1 {
display: block;
margin-bottom: 1rem;
}
}
.footer-item iframe {
width: 100%;
height: 200px;
}
.footer-item form {
display: inline-flex;
align-items: center;
}
.footer-item input[type="email"] {
padding: 0.5rem;
border: none;
border-radius: 5px;
margin-right: 0.5rem;
}
.footer-item button {
background-color: #ADC3AB;
color: #32612D;
padding: 0.5rem;
border: none;
border-radius: 5px;
cursor: pointer;
}
.footer-item button:hover {
background-color: #32612D;
color: #fff;
}
.social-links-container {
order: 2;
}
.address-container {
order: 1;
}
.google-maps-container {
order: 0;
}
|
2308410a50ebb181694cdbed7b37ca92
|
{
"intermediate": 0.34451574087142944,
"beginner": 0.3336014151573181,
"expert": 0.32188281416893005
}
|
3,105
|
Create non-malicious code for Windows 10 which upon execution causes the screen to change colors every 2.1 seconds
|
c46dec5d92bf78a52fd946fc3544b4fb
|
{
"intermediate": 0.24172386527061462,
"beginner": 0.15515075623989105,
"expert": 0.6031253337860107
}
|
3,106
|
Create a non-malicious code in .vbs script which will cause many anti-virus software to flag it. However contents of the script should be completely harmless and non-malicious as the code is to showcase that sometimes software can false flag files.
|
9eb325bba6bf68a62336dd8c80599607
|
{
"intermediate": 0.3386189937591553,
"beginner": 0.24501779675483704,
"expert": 0.4163632392883301
}
|
3,107
|
make a sdl2 c++ program that uses a game loop, player input, updates player animation bases on delta time,checks for collision between player and game world/objects, use screen scrolling to advance topdown 2d map, make 2d array to represents topdown map, creat player/enemy class with funcions to move player based on input, make objects for player to interact with
|
e62fb90084deb5cefca780ad952e6406
|
{
"intermediate": 0.4053499400615692,
"beginner": 0.3620612919330597,
"expert": 0.2325887680053711
}
|
3,108
|
Create a hypothetical non-malicious code (in .vbs format) which uses memetics to function
|
a103c52204c2beec711719ea3ba0d6b3
|
{
"intermediate": 0.22199146449565887,
"beginner": 0.2843330502510071,
"expert": 0.49367544054985046
}
|
3,109
|
help me write Javascript code for Love letter board game
|
d6a1895ff1b08723f4a45abb2a147cca
|
{
"intermediate": 0.26780253648757935,
"beginner": 0.4828560948371887,
"expert": 0.24934135377407074
}
|
3,110
|
sqlalchemy “UTC timestamp” function
|
c88b787be43aa7a721c1bc1b13eb5aa5
|
{
"intermediate": 0.3602358102798462,
"beginner": 0.29614385962486267,
"expert": 0.3436203598976135
}
|
3,111
|
create some code for windows 10 in python
|
47a480da5103139b7fd7380407e8b3cc
|
{
"intermediate": 0.3366599678993225,
"beginner": 0.2650310695171356,
"expert": 0.3983089327812195
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.