row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
22,607 | Write UML classes based on the following application features:
Front End Page (No Memory) - Difficulty: 130
Create Architecture for Application
Will focus on React based components and directory Structure
Will redirect user to essential features available at desired location
For this product, features will be limited to Long Beach, CA related content
UI Home Page (Local Memory) - Difficulty: 130
Create Architecture for Application
Will focus on React based components and directory Structure
Will allow user to view Personal Home Page customized from previous interactions with the application
For this product, features will be limited to Long Beach, CA related content
Profile information will also be accessible on this page and will allow user modifications
UI Representative Bio Page - Difficulty 130
Create Architecture for Application
Will focus on React based components and directory Structure
Information displayed on page will include:
Sponsors
Voting History
Approval
Bio information
Contact information
Information will be acquired from third-party websites from verified sources such as:
Non-profit, neutral websites
Official government websites displaying voting records and politician information
UI for Bills Page - Difficulty : 130
Create Architecture for Application
Will focus on React based components and directory Structure
Information displayed on page will include:
Bill Title
Ballot listed description
Date of creation
Bill's political leaning based on applications prediction system
Information will be acquired from third-party websites from verified sources such as:
Non-profit, neutral websites
Official government websites displaying voting records and politician information
Set up backend Data Structure - Difficulty: 130
Create Database Framework
Will focus on remote database provider such as MongoDB
Will utilize SQL within MongoDB to manage incoming data and relationships
Information searched will be stored to decrease application latency
Information commonly queried may include:
Sponsors
Voting History
Approval
Bio information
Contact information
Bill Title
Ballot listed description
Date of creation
Bill's political leaning based on applications prediction system
User - Difficulty: 130
Create User Framework
Will focus on creating
Unique Features
For You Page - Difficulty: 130
Implement an algorithm to track topics a user shows interest in
Will feature bills user is mostly likely to engage with
Get Important Data from Ballotpedia - Difficulty: 100
Access and filter for data compatible with app function
Cross-reference data from OpenSecrets/Government Websites
Pull data that has been triple-verified
Get Important Data from OpenSecrets - Difficulty: 100
Access and filter for data compatible with app function
Cross-reference data from Ballotpedia/Government Websites
Pull data that has been triple-verified
Get data from Government Websites - Difficulty: 100
Access and filter for data compatible with app function
Cross-reference data from OpenSecrets/Ballotpedia
Pull data that has been triple-verified
Graphs - Difficulty: 80
Will use datasets to graph out aesthetically pleasing visual representations of the data
Ability to comment and react to bills & representatives - Difficulty: 60
Users will be able to comment on featured bills and interact with one another
React feature will use visual effect to show how popular/unpopular a bill is publicly received
API for connecting front and back-end information for when new data needs processing - Difficulty: 130
Will need to connect data from legitimate websites to our own app
Government websites
Ballotpedia
Open secrets
The ability to star important information - Difficulty: 10
Display star for each post
Users will be able to store bills they wish to revisit by clicking on star
Possible animation effect activated by clicking
The ability to have information in chronological order - Difficulty: 30
New/upcoming bills will feature at the top of the Home page or will have their own, separate page | 3ad68b06350272ced81de90b16f5f288 | {
"intermediate": 0.5606334805488586,
"beginner": 0.18073569238185883,
"expert": 0.25863078236579895
} |
22,608 | Write a Perl script to calculate the lines of code of all C source and header files recursively within a directory | 4b13eeea0e2269a498bc49a845434e0d | {
"intermediate": 0.367602676153183,
"beginner": 0.18642224371433258,
"expert": 0.44597509503364563
} |
22,609 | How to upload dataframe with app_context in flask | 3ad21499de5da22f363ba1f401cb7876 | {
"intermediate": 0.712012529373169,
"beginner": 0.07848230004310608,
"expert": 0.20950524508953094
} |
22,610 | generate a overleaf code to create a front cover page for teacher training assignment which will contain below details share with sample data
College name
College logo
University logo
B.ed year and session
Assignment subject
College photo
Submitted to
Submitted by
Student name
Class
Roll number | db93365839539898eef4c0735e0c6bc8 | {
"intermediate": 0.26086753606796265,
"beginner": 0.34513184428215027,
"expert": 0.3940006196498871
} |
22,611 | generate a overleaf code to create a front cover page for teacher training assignment which will contain below details share with sample data
College name
College logo
University logo
B.ed year and session
Assignment subject
College photo
Submitted to
Submitted by
Student name
Class
Roll number | d1ec16828b49e1ac2add2b4eae49598b | {
"intermediate": 0.26086753606796265,
"beginner": 0.34513184428215027,
"expert": 0.3940006196498871
} |
22,612 | peux tu me montrer le test unitaire de cette fonction qui permet au gagnant de retirer avec succès "function withdraw(uint256 _gameId, uint256 _amount) public payable {
address winner = games[_gameId].winner;
currentPlayer = msg.sender;
require(currentPlayer == games[_gameId].player1 || currentPlayer == games[_gameId].player2, "You re not a player");
require(!games[_gameId].player1HasWithdrawn || !games[_gameId].player2HasWithdrawn, "withdrawn balance");
uint256 balance = playerBalances[_gameId][currentPlayer].balance;
require(balance >= _amount, "Insufficient balance");
require(winner == currentPlayer, "You are not the winner");
playerBalances[_gameId][currentPlayer].balance -= _amount;
(bool success, ) = payable(currentPlayer).call{value: _amount}("");
require(success, "The withdrawal failed");
if (currentPlayer == games[_gameId].player1) {
games[_gameId].player1HasWithdrawn = true;
} else {
games[_gameId].player2HasWithdrawn = true;
}
emit Withdraw(_gameId);
}é | 210649af459296eb41b8b2fb443d992e | {
"intermediate": 0.39998582005500793,
"beginner": 0.3575885593891144,
"expert": 0.24242565035820007
} |
22,613 | using react library help me do some testing on the following code
/* eslint-disable react/function-component-definition */
import React, { useEffect, useState } from 'react';
import {
notification, Row,
} from 'antd';
import {
Cell,
Bar,
BarChart,
LabelList,
Line,
LineChart,
ScatterChart,
Scatter,
XAxis,
YAxis,
ZAxis,
CartesianGrid,
Tooltip,
ReferenceLine,
ResponsiveContainer,
} from 'recharts';
import { t } from 'i18next';
import { CustomTooltip } from 'data/utils/chartFunctions';
import { MMolienda } from 'domain/models/Molienda';
import { PoToolTipData } from 'domain/interfaces/PoToolTipData';
import { EnumMoliendas } from 'presentation/components/constants/enums';
import { MPLMoliendaIBP } from 'domain/models/PLMoliendaIBP';
import MoliendaService from 'domain/services/MoliendaService';
import PLMoliendaIBPService from 'domain/services/PLMoliendaIBPService';
import ModalQuality from 'presentation/components/Weekly/Modal/ModalQuality';
import ModalProcess from 'presentation/components/Weekly/Modal/ModalProcess';
import ModalMolienda from 'presentation/components/Weekly/Modal/ModalMoliendaIBP';
import ModalCommercial from 'presentation/components/Weekly/Modal/ModalCommercial';
import ModalRestrictions from 'presentation/components/Weekly/Modal/ModalRestrictions';
import SeasonTableBox from './SeasonTableBox';
interface PreparedNetMargin {
name: string,
pv: number,
module: string,
tooltipData: PoToolTipData[],
uv: number
}
interface PreparedBarchar {
module: string,
name: string,
tooltipData: PoToolTipData[],
pv: number
}
interface TableMolienda {
date?: number,
monthlyProfit?: number,
monthlyValue: number,
order: number,
profit?: number,
type: string,
value: number
}
interface ModalInterface {
month: number,
setSavedMolienda: (b: boolean) => void,
setVisibleCommercial: (b: boolean) => void,
setVisibleMolienda: (b: boolean) => void,
setVisibleProcess: (b: boolean) => void,
setVisibleQuality: (b: boolean) => void,
setVisibleRestrictions: (b: boolean) => void,
visibleMolienda: boolean,
visibleQuality: boolean,
visibleCommercial: boolean,
visibleProcess: boolean,
visibleRestrictions: boolean
}
// x sacar de molienda IBP el month y de ahi sacar los dias.
// z es el value
const data01 = [
{ x: 25, y: 2000, z: 10 },
{ x: 25, y: 3000, z: 10 },
];
const CustomizedDot = props => {
const {
cx, cy,
} = props;
return (
<svg fill="#6495ED" height={20} viewBox="0 0 100 100" width={20} x={cx - 10} y={cy - 10}>
<circle cx="50" cy="25" r="25" />
</svg>
);
};
const WeeklyBody: React.FC<ModalInterface> = ({
month, setSavedMolienda,
setVisibleCommercial, setVisibleMolienda, setVisibleProcess,
setVisibleQuality, setVisibleRestrictions,
visibleMolienda, visibleQuality, visibleCommercial,
visibleProcess, visibleRestrictions,
}) => {
const [ maxValue, setMaxValue ] = useState(0);
const [ minValue, setMinValue ] = useState(0);
const [ api, contextHolder ] = notification.useNotification();
const [ moliendas, setMoliendas ] = useState<MMolienda[]>([]);
const [ moliendaIBP, setMoliendaIBP ] = useState<MPLMoliendaIBP>();
const [ dataBarChar, setBarChar ] = useState<PreparedBarchar[]>([]);
const [ dataNetMargin, setDataNetMargin ] = useState<PreparedNetMargin[]>([]);
const [ tableData, setTableData ] = useState<TableMolienda[]>([]);
const [ calculationName, setCalculationName ] = useState('');
const [ reloadMoliendaIBP, setReloadMoliendaIBP ] = useState(false);
const errorMessage = () => {
notification.error({
message: t('Custom_Messages.GeneralError'),
});
};
const saveMessage = () => {
notification.success({
message: t('Modal.Save_Message'),
});
};
const onFetch = async (): Promise<void> => {
const moliendaService = new MoliendaService();
const response = await moliendaService.GetMoliendas();
if (response.data) {
const data = (response.data as MMolienda[]);
setMoliendas(data);
prepareTableData(data);
}
fetchMoliendaIBP();
};
const fetchMoliendaIBP = async (): Promise<void> => {
const IBPService = new PLMoliendaIBPService();
const responseIBP = await IBPService.GetMoliendaIBP();
if (responseIBP.data) {
const data = responseIBP.data as MPLMoliendaIBP;
setCalculationName(data.calculationName);
data.calculationName = '';
setMoliendaIBP(data);
}
setReloadMoliendaIBP(false);
};
const prepareTableData = (data:MMolienda[]) => {
const moliendaTypes = [ 21, 20, 23, 22, 24 ];
const filteredMolienda = data.filter(x => moliendaTypes.includes(x.moliendaType));
const moliendaData: TableMolienda[] = filteredMolienda.map(item => ({
date: item.timeStamp,
monthlyProfit: item.monthlyProfit,
monthlyValue: item.monthlyValue,
order: item.moliendaType,
profit: item.profit,
type: EnumMoliendas[item.moliendaType],
value: item.value,
}));
moliendaData.sort((a, b) => {
const indexA = moliendaTypes.indexOf(Number(a.order));
const indexB = moliendaTypes.indexOf(Number(b.order));
return indexA - indexB;
});
setTableData(moliendaData);
};
const getTooltipElements = (item):PoToolTipData[] => ([
{
id: 1,
line: 0,
name: 'dailygriding',
requid: 'none',
value: item.value,
},
{
id: 2,
line: 0,
name: 'netmargin',
requid: 'none',
value: item.profit,
},
{
id: 3,
line: 0,
name: 'monthlygriding',
requid: 'none',
value: item.monthlyValue,
},
{
id: 4,
line: 0,
name: 'modality',
requid: 'none',
value: item.moliendaType,
},
{
id: 5,
line: 0,
name: 'monthlyprofit',
requid: 'none',
value: item.monthlyProfit,
},
{
id: 6,
line: 0,
name: 'optimaldifference',
requid: 'none',
value: item.optimDifference,
},
]);
const getTooltipElementsBarChar = (item):PoToolTipData[] => ([
{
id: 1,
line: 0,
name: 'Molienda Diaria (MT/d)',
requid: 'none',
value: item.value,
},
{
id: 2,
line: 0,
name: 'Net Margin (USD/MT)',
requid: 'none',
value: item.profit,
},
{
id: 3,
line: 0,
name: 'Molienda Mes (MT/mes)',
requid: 'none',
value: 0,
},
{
id: 4,
line: 0,
name: 'Modalidad',
requid: 'none',
value: item.moliendaType,
},
]);
const transformData = (type: string) => {
const filtered = moliendas.filter(x => x.profit !== null);
// eslint-disable-next-line prefer-spread
setMaxValue(Math.max.apply(Math, filtered.map(o => o.value)));
// eslint-disable-next-line prefer-spread
setMinValue(Math.min.apply(Math, filtered.map(o => o.value)));
if (type === 'NetMargin') {
const datos = moliendas.sort((a, b) => a.value - b.value).map(item => ({
module: 'Planning',
name: item.value.toString(),
pv: item.profit,
tooltipData: getTooltipElements(item),
uv: item.value,
}));
setDataNetMargin(datos);
}
setBarChar(
filtered.filter(x => x.moliendaType !== 23).sort((a, b) => a.value - b.value).map(item => ({
module: 'Planning',
// eslint-disable-next-line no-nested-ternary
name: item.moliendaType === 21 ? 'Maxima'
: item.moliendaType === 22 ? 'Cotinua' : 'Optima',
pv: item.monthlyProfit,
tooltipData: getTooltipElementsBarChar(item),
})),
);
};
useEffect(() => {
onFetch();
}, []);
useEffect(() => {
if (reloadMoliendaIBP) {
onFetch();
}
}, [ reloadMoliendaIBP ]);
useEffect(() => {
if (moliendas.length > 0) {
transformData('NetMargin');
}
}, [ moliendas ]);
return (
<>
{contextHolder}
<Row className="flex-container">
<div className="flex-item Left">
<SeasonTableBox
calculationName={calculationName}
dataSource={tableData}
date={moliendaIBP?.date}
desiredTotalGrind={moliendaIBP?.desiredTotalGrind}
month={month}
season={moliendaIBP?.season}
/>
</div>
<div className="flex-item Right">
<ResponsiveContainer height="99%" width="99%">
<ScatterChart
height={400}
margin={{
bottom: 20,
left: 20,
right: 20,
top: 20,
}}
>
<CartesianGrid />
<XAxis
dataKey="x"
domain={[ 0, 31 ]}
name="stature"
type="number"
/>
<YAxis
dataKey="y"
domain={[ 0, 5000 ]}
name="weight"
type="number"
/>
<ZAxis
dataKey="z"
name="score"
range={[ 10, 300 ]}
type="number"
unit="km"
/>
<Tooltip cursor={{ strokeDasharray: '3 3' }} />
<ReferenceLine
label={{
position: 'top',
value: 'segm1',
}}
segment={[
{
x: 0,
y: 2000,
},
{
x: 24, // cantidad de dias del mes - SDT
y: 2000,
},
]}
stroke="orange"
strokeWidth="5"
/>
<ReferenceLine
stroke="grey"
strokeWidth="2"
x={24} // cantidad de dias del mes - SDT
/>
<ReferenceLine
segment={[
{
x: 24, // cantidad de dias del mes - SDT
y: 2000,
},
{
x: 26, // max dias mes
y: 2000,
},
]}
stroke="red"
strokeWidth="10"
/>
<Scatter data={data01} fill="blue" name="A school" shape="square" />
</ScatterChart>
</ResponsiveContainer>
</div>
</Row>
<Row className="flex-container">
<div className="flex-item Middle">
<ResponsiveContainer height={400} width="100%">
<LineChart
data={dataNetMargin}
height={300}
margin={{
bottom: 5,
left: 20,
right: 30,
top: 5,
}}
width={500}
>
<CartesianGrid strokeDasharray="monotone" />
<XAxis dataKey="name" domain={[ minValue, maxValue + 500 ]} />
<YAxis />
<Tooltip
content={(
<CustomTooltip
t={t}
/>
)}
// position={positiontooltip}
/>
<Line dataKey="pv" dot={<CustomizedDot />} isAnimationActive={false} stroke="#6495ED" strokeDasharray="4 4" />
</LineChart>
</ResponsiveContainer>
</div>
<div className="flex-item Middle">
<ResponsiveContainer height="100%" width="100%">
<BarChart
data={dataBarChar}
height={300}
margin={{
bottom: 5,
left: 20,
right: 30,
top: 5,
}}
width={500}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="name" />
<YAxis />
<Tooltip
content={(
<CustomTooltip
t={t}
/>
)}
// position={positiontooltip}
/>
<Bar
animationDuration={0}
barSize={70}
cursor="pointer"
dataKey="pv"
fill="#82ca9d"
isAnimationActive={false}
stackId="a"
>
{
dataBarChar.map((item, index) => {
if (item.name === 'Maxima') {
return <Cell key={`${dataBarChar}_${item.name}`} fill="#5B8F22" />;
}
if (item.name === 'Cotinua') {
return <Cell key={`${dataBarChar}_${item.name}`} fill="#ABAD23" />;
}
return <Cell key={`${dataBarChar}_${item.name}`} fill="#005C84" />;
})
}
<LabelList dataKey="pv" />
</Bar>
</BarChart>
</ResponsiveContainer>
</div>
</Row>
{visibleMolienda && (
<ModalMolienda
errorMessage={errorMessage}
moliendaIBP={moliendaIBP}
month={month}
saveMessage={saveMessage}
setCalculationName={setCalculationName}
setMoliendaIBP={setMoliendaIBP}
setReloadMoliendaIBP={setReloadMoliendaIBP}
setSavedMolienda={setSavedMolienda}
setVisibleMolienda={setVisibleMolienda}
visibleMolienda={visibleMolienda}
/>
)}
{visibleQuality && (
<ModalQuality
errorMessage={errorMessage}
month={month}
saveMessage={saveMessage}
setVisibleQuality={setVisibleQuality}
visibleQuality={visibleQuality}
/>
)}
{visibleCommercial && (
<ModalCommercial
errorMessage={errorMessage}
month={month}
saveMessage={saveMessage}
setVisibleCommercial={setVisibleCommercial}
visibleCommercial={visibleCommercial}
/>
)}
{visibleProcess && (
<ModalProcess
errorMessage={errorMessage}
month={month}
saveMessage={saveMessage}
setVisibleProcess={setVisibleProcess}
visibleProcess={visibleProcess}
/>
)}
{visibleRestrictions && (
<ModalRestrictions
errorMessage={errorMessage}
month={month}
saveMessage={saveMessage}
setVisibleRestrictions={setVisibleRestrictions}
visibleRestrictions={visibleRestrictions}
/>
)}
</>
);
};
export default WeeklyBody; | 12229e481c226091785d649a6721b058 | {
"intermediate": 0.38658878207206726,
"beginner": 0.3344002068042755,
"expert": 0.2790110111236572
} |
22,614 | en utilisant la structure "const Penduel = artifacts.require("Penduel");
const { BN, expectRevert, expectEvent } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const Web3 = require('web3');" peux tu me montrer le test unitaire de cette fonction :"function withdraw(uint256 _gameId, uint256 _amount) public payable {
address winner = games[_gameId].winner;
currentPlayer = msg.sender;
require(currentPlayer == games[_gameId].player1 || currentPlayer == games[_gameId].player2, "You re not a player");
require(!games[_gameId].player1HasWithdrawn || !games[_gameId].player2HasWithdrawn, "withdrawn balance");
uint256 balance = playerBalances[_gameId][currentPlayer].balance;
require(balance >= _amount, "Insufficient balance");
require(winner == currentPlayer, "You are not the winner");
playerBalances[_gameId][currentPlayer].balance -= _amount;
(bool success, ) = payable(currentPlayer).call{value: _amount}("");
require(success, "The withdrawal failed");
if (currentPlayer == games[_gameId].player1) {
games[_gameId].player1HasWithdrawn = true;
} else {
games[_gameId].player2HasWithdrawn = true;
}
emit Withdraw(_gameId);
}" | a597dea61762ac0bd7be91f2c503c9b5 | {
"intermediate": 0.5971819758415222,
"beginner": 0.3379809856414795,
"expert": 0.06483706831932068
} |
22,615 | Type 'Mock<any, any>' is not assignable to type 'boolean' , how to fix it ? | 618efbc63bff52bc03cd32ecae31ed9c | {
"intermediate": 0.4581441879272461,
"beginner": 0.17809151113033295,
"expert": 0.36376428604125977
} |
22,616 | can you give me a PHP code to print a grandient color betaweeb 2 colors | 6575dcc47a3f5a00236e8afb936562d9 | {
"intermediate": 0.5269488096237183,
"beginner": 0.3147483766078949,
"expert": 0.15830278396606445
} |
22,617 | make javascript code in html that gives a random number from 0 to 9, and make the user input a number in forms to guess the number. If the number is guessed correctly display an image of the number and write good job under the image, otherwise display an image and write good try in red text | 7710768773213f91016b7a2c5092079a | {
"intermediate": 0.4828464984893799,
"beginner": 0.18117305636405945,
"expert": 0.33598050475120544
} |
22,618 | setfield! immutable struct of type Complex cannot be changed как обойти эту ошибку в julia | 57590ec9946c5082ad4b987a4d7f2b43 | {
"intermediate": 0.39043989777565,
"beginner": 0.2566984295845032,
"expert": 0.3528616726398468
} |
22,619 | cannot assign a value to variable Base.Complex from module Main | a5e28a2901f4a4057466edf0867c4671 | {
"intermediate": 0.34833046793937683,
"beginner": 0.46182888746261597,
"expert": 0.18984058499336243
} |
22,620 | setfield! immutable struct of type Complex cannot be changed как обойти julai | e8549e816d523d9c02c86d5474b8851d | {
"intermediate": 0.3929896056652069,
"beginner": 0.20398975908756256,
"expert": 0.4030206501483917
} |
22,621 | setfield! immutable struct of type Complex cannot be changed обойти в julia | f698603ba6acd23ff90fa5fe171f3179 | {
"intermediate": 0.4056470990180969,
"beginner": 0.2129320353269577,
"expert": 0.3814208507537842
} |
22,622 | pourquoi l'adresse du player2 n'est pas reconnu dans le test comme le winner ? voici les fonctions "function proposeLetter(uint256 _gameId, string memory _letterToGuess, string memory _wordToGuess) public {
require(_gameId != 0, "Bad ID");
currentPlayer = getActivePlayer(_gameId);
require(playerBalances[_gameId][msg.sender].balance > 0, "you didn't bet");
require(bytes(_letterToGuess).length == 1, "a single letter");
require(state == State.firstLetter, "Bad State");
string memory letterFiltered = filteredLetter(_letterToGuess);
checkLetter(_gameId, letterFiltered);
state = State.inProgress;
proposeWord(_gameId, _wordToGuess, currentPlayer);
}" "function proposeWord(uint256 _gameId, string memory _wordToGuess, address _currentPlayer) public {
require(state == State.inProgress, "Bad State");
string memory filteredWord = wordFiltered(_wordToGuess);
if (isWordCorrect(_wordToGuess)) {
emit WordWin(_gameId, filteredWord);
games[_gameId].winner = _currentPlayer;
state = State.finished;
emit GameFinished(_gameId);
addBetToPlayer(_currentPlayer);
} else {
currentWord = _wordToGuess;
emit WordGuessedFalse(_gameId, _wordToGuess);
playersSwitched(_gameId);
}
}" "function withdraw(uint256 _gameId, uint256 _amount) public payable {
address winner = games[_gameId].winner;
currentPlayer = msg.sender;
require(currentPlayer == games[_gameId].player1 || currentPlayer == games[_gameId].player2, "You re not a player");
require(!games[_gameId].player1HasWithdrawn || !games[_gameId].player2HasWithdrawn, "withdrawn balance");
uint256 balance = playerBalances[_gameId][currentPlayer].balance;
require(balance >= _amount, "Insufficient balance");
require(winner == currentPlayer, "You are not the winner");
playerBalances[_gameId][currentPlayer].balance -= _amount;
(bool success, ) = payable(currentPlayer).call{value: _amount}("");
require(success, "The withdrawal failed");
if (currentPlayer == games[_gameId].player1) {
games[_gameId].player1HasWithdrawn = true;
} else {
games[_gameId].player2HasWithdrawn = true;
}
emit Withdraw(_gameId);
}" le test "context ("FONCTION RETRAIT - GAGNANT", () => {
before(async function() {
penduelInstance = await Penduel.new(subId);
const value = web3.utils.toWei("1", "ether");
const letterToGuess = "i";
const wordToGuess = "immuable";
const currentWord = "immuable";
await penduelInstance.createGame({ from: player1 });
await penduelInstance.joinGame({ from: player2 });
await penduelInstance.deposit({ from: player1, value: value });
await penduelInstance.deposit({ from: player2, value: value });
await penduelInstance.updateStateFirstLetter();
const gameId = 1;
const currentPlayer = player2;
await penduelInstance.proposeLetter(gameId, letterToGuess, wordToGuess, {from: currentPlayer});
const updateState = await penduelInstance.state();
assert.equal(updateState, 5, "L'état devrait être inProgress");
await penduelInstance.proposeWord(gameId, "immuable", currentPlayer);
await penduelInstance.getIsWordCorrect(currentWord);
});
describe ("Vérifie la fonction withdraw avec le gagnant", () => {
it("devrait permettre au gagnant de retirer avec succès", async () => {
const gameId = 1;
const currentPlayer = player2;
const amount = 2;
const initialBalance = await penduelInstance.playerBalances(gameId, currentPlayer);
const game = await penduelInstance.games(gameId);
assert.equal(game.winner, currentPlayer, "L’adresse du gagnant ne correspond pas à l’adresse attendue");
const { logs } = await penduelInstance.withdraw(gameId, amount, { from: currentPlayer });
;
const finalBalance = await penduelInstance.playerBalances(gameId, currentPlayer);
const difference = finalBalance - initialBalance;
assert.isAbove(difference, 0, "Le retrait n'a pas réussi");
expect(game.player2HasWithdrawn).to.be.true;
expect(logs).to.have.lengthOf(1);
expectEvent(logs[0], "Withdraw", { _gameId: new BN(gameId) });
});
});" | c1a2134f1ce85d5e7c649e6f7067e5b4 | {
"intermediate": 0.3731522262096405,
"beginner": 0.3806678056716919,
"expert": 0.24617992341518402
} |
22,623 | how do i make a run configuration in VS Code that runs a powershell command | 0c55b5f252b52361496396ed73ac1498 | {
"intermediate": 0.4409651458263397,
"beginner": 0.34187084436416626,
"expert": 0.21716399490833282
} |
22,624 | hi | c4a229746e0a7fa02a727d9a4548ce2a | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
22,625 | how to user the timer function in aseba programming language | bbc682338c9ecb79d4365459d14d453c | {
"intermediate": 0.33174726366996765,
"beginner": 0.3532438576221466,
"expert": 0.31500881910324097
} |
22,626 | Исправь ошибки в коде на c++: #include <iostream>
#include <vector>
using namespace std;
void input_v(vector<float> &v_arr)
{
cout << "Enter the values: " << endl;
for(int i=0;i<v_arr.size();i++)
cin>> v_arr[i];
}
void output_v(vector<float> &v)
{
cout << "Output: " << endl;
for(int i=0;i<v.size();i++)
cout << v[i]<<"\t";
cout << endl;
}
void insert_elements(vector<float> &v)
{
int pos;
cout << "Enter the position: " << endl;
cin >>pos;
int n_el;
cout << "Enter the number of elements you want to insert: " << endl;
cin>>n_el;
cout << "Enter the elements: " << endl;
for(int it = pos; it<n_el; it++)
{
float num;
cin >> num;
v.insert(it, num);
}
cout << "Vector after inserting: " << endl;
output_v(v);
}
int main()
{
int N;
cout << "Enter the number of values: " << endl;
cin>>N;
vector<float> v(N);
input_v(v);
insert_elements(v);
return 0;
} | ca9747b4af1fbc466859d83489fd7cec | {
"intermediate": 0.35467758774757385,
"beginner": 0.3837426006793976,
"expert": 0.26157987117767334
} |
22,627 | how do i round a number to end in a multiple of 3 | 831ad6f6f55ae9f32dc59a4518b7098b | {
"intermediate": 0.296773225069046,
"beginner": 0.2569817304611206,
"expert": 0.44624510407447815
} |
22,628 | my current zshell script looks like
#!/bin/zsh
gcloud spanner databases ddl update ryan-mate-db --instance=ken-mate-poc-test --ddl-file=drop_tables.ddl
gcloud spanner databases ddl update ryan-mate-db --instance=ken-mate-poc-test --ddl-file=create_tables.ddl
how could i move ryan-mate-db and ken-mate-poc-test to be command line arguments? | 77e3db76aefc832f5c0d435bbbd965de | {
"intermediate": 0.6031015515327454,
"beginner": 0.21634441614151,
"expert": 0.18055404722690582
} |
22,629 | Hi, I am new to R and R studio, and I need to use ggplot 2 to draw some figure, before draw the figures, I need to do some counting work and use the results of the counting to draw the figures, could you please help me to do this step by step from the very begining? | 82ec1e4fed4a5539609f166dc395b26c | {
"intermediate": 0.8102707266807556,
"beginner": 0.05114316940307617,
"expert": 0.13858607411384583
} |
22,630 | give me $ne = -1 in json | 4e95b878b87eded00e900587e702813b | {
"intermediate": 0.2099239081144333,
"beginner": 0.3005208671092987,
"expert": 0.4895552396774292
} |
22,631 | give me $ne = -1 in json for nosql injection | eb690ac4bd138efd3498c089a17e1828 | {
"intermediate": 0.4410639703273773,
"beginner": 0.2856796085834503,
"expert": 0.27325642108917236
} |
22,632 | give me $ne = -1 in json for nosql injection | a3b4746a0acb219f52f685071be90d8e | {
"intermediate": 0.4410639703273773,
"beginner": 0.2856796085834503,
"expert": 0.27325642108917236
} |
22,633 | using react test library got ann error
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function. | 12fadeb68dba984bc9e284d410e7892c | {
"intermediate": 0.700471818447113,
"beginner": 0.16303834319114685,
"expert": 0.1364898532629013
} |
22,634 | what kind of xss payloads should i use for this code: <!DOCTYPE html>
<html lang="en-US" data-cargo="locale:en-US,language:EN,currency:USD,site:US,group:Trip">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Profile</title>
</head><link rel="shortcut icon" href="/trip.ico" type="image/x-icon" />
<link rel="icon" href="/trip.ico" />
<link rel="stylesheet" href="//webresource.tripcdn.com/resaresenglish/basebiz/membersinfo/css/membercenter.9b1d39c6.css"/>
<link rel="stylesheet" href="//webresource.tripcdn.com/resaresenglish/ibu/online-assets/dist/css/font.6ffcbb29.css">
<style>
.profile_info_arab {
display: flex;
justify-content: right;
flex-direction: column;
}
.profile_radio_is_arab{
display: inline-block;
}
.profile_radio_margin_right_is_arab{
margin-right: 0 !important;
display: inline-block;
}
.profile_info_arab li{
display: flex;
flex-direction: row-reverse;
}
.profile_info_arab li label.keyName{
float: none !important;
margin-left: 20px !important;
text-align: left !important;
}
.profile_info_arab li .btn_normal{
margin-right: 164px;
}
.profile_info_arab .btn_shallow, a, input[type=text]{
padding: 0 10px;
}
.container_is_arab{
display: flex;
justify-content: space-between;
}
.profile_position_right{
position: relative;
right: -10px;
}
.input_direction_rtl{
direction: rtl;
}
</style><script src="/m/i18n/100009239/en-US.js"></script>
<script src="//webresource.tripcdn.com/resaresenglish/basebiz/i18naccountpageheader/trip_header_footer_bundle.3841f2c0.js"></script>
<body>
<div class="header-container"></div>
<div class="container container_box " id="ibu_ordersearch_online">
<div class="main">
<div class="model information_box ">
<ul class="filed_area">
<li><label class="keyName">Last name</label><div class="filed_con" id="surnameValue"></div></li>
<li><label class="keyName">First & middle names</label><div class="filed_con" id="givennameValue"></div></li>
<li><label class="keyName">Date of birth</label><div class="filed_con" id="birthValue"></div></li>
<li><label class="keyName">Gender</label><div class="filed_con" id="genderValue"></div></li>
<li><button class="btn_normal" type="button" onclick="javascript:jQuery('#editlist').show();">Edit</button></li>
</ul>
<ul class="filed_area" id="editlist" style="display:none">
<li><label class="keyName">Last name</label>
<div class="filed_con"><input type="text" id="surname" name="surname" value="" class="ipt " placeholder="Surname" maxlength="60"></div>
</li>
<li><label class="keyName">First & middle names</label>
<div class="filed_con"><input type="text" id="givenname" name="givenname" value="" class="ipt " placeholder="Givenname" maxlength="60"></div>
</li>
<li><label class="keyName">Date of birth</label>
<div class="filed_con ">
<select class="selt selt_ws" id="dobMonth" name="dobMonth">
<option value="">---Month---</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<select class="selt selt_ws" id="dobDay" name="dobDay">
<option value="">---Day---</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select class="selt selt_ws" id="dobYear" name="dobYear">
<option value="">---Year---</option>
<option value="1930">1930</option>
<option value="1931">1931</option>
<option value="1932">1932</option>
<option value="1933">1933</option>
<option value="1934">1934</option>
<option value="1935">1935</option>
<option value="1936">1936</option>
<option value="1937">1937</option>
<option value="1938">1938</option>
<option value="1939">1939</option>
<option value="1940">1940</option>
<option value="1941">1941</option>
<option value="1942">1942</option>
<option value="1943">1943</option>
<option value="1944">1944</option>
<option value="1945">1945</option>
<option value="1946">1946</option>
<option value="1947">1947</option>
<option value="1948">1948</option>
<option value="1949">1949</option>
<option value="1950">1950</option>
<option value="1951">1951</option>
<option value="1952">1952</option>
<option value="1953">1953</option>
<option value="1954">1954</option>
<option value="1955">1955</option>
<option value="1956">1956</option>
<option value="1957">1957</option>
<option value="1958">1958</option>
<option value="1959">1959</option>
<option value="1960">1960</option>
<option value="1961">1961</option>
<option value="1962">1962</option>
<option value="1963">1963</option>
<option value="1964">1964</option>
<option value="1965">1965</option>
<option value="1966">1966</option>
<option value="1967">1967</option>
<option value="1968">1968</option>
<option value="1969">1969</option>
<option value="1970">1970</option>
<option value="1971">1971</option>
<option value="1972">1972</option>
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>
<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
<option value="1987">1987</option>
<option value="1988">1988</option>
<option value="1989">1989</option>
<option value="1990">1990</option>
<option value="1991">1991</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
</select>
</div>
</li>
<li><label class="keyName">Gender</label>
<div class="filed_con">
<label class="sel_label "><input id="genderM" name="gender" value="M" class="input_radio" type="radio">Male</label>
<label class="sel_label "><input id="genderF" name="gender" value="F" class="input_radio" type="radio">Female</label>
</div>
</li>
<li>
<button class="btn_normal" type="button" id="btnsave">Save</button>
<input type="hidden" id="ModifyToken" name="ModifyToken" value="dfedaa9a-51cd-4df0-a849-d1932a6921b1">
</li>
</ul>
</div>
</div>
<div id="leftNavWrapper" class="" menutype="3" menuid="multi_account_profile" local="en-US"></div>
</div>
<div class="footer-container"></div>
<!--引入cQuery 资源-->
<script src="https://webresource.tripcdn.com/code/cquery/cQuery_110421.js" ></script>
<script src="//webresource.tripcdn.com/resaresenglish/basebiz/membersinfo/js/cquery_pro.8a96a3b4.js"></script>
<script src="//webresource.tripcdn.com/resaresenglish/basebiz/membersinfo/js/jquery-1.9.1.min.af4d518a.js"></script>
<!--页脚HTML-->
<!--loading-->
<div id="submitLoading" c-layout="tile" class="p-pop pop-loading">
<div class="pop-table">
<!-- pop-releasable -->
<div class="pop-cell">
<div class="pop-con">
<i class="c-icon icon-loading-64"></i>
<div class="loading-txt"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//初始化页头页脚
// head_foot_init();
var ErrorMsg = {
NameErrorMsg1: 'Please provide first name',
NameErrorMsg2: 'Please provide last name',
NameErrorMsg3: 'Please check spelling of name',
NameErrorMsg4: 'Your name cannot be more than 25 characters long',
MobileErrorMsg1: 'Please enter a mobile number',
MobileErrorMsg2: 'Please check phone number.'
};
</script><input id="page_id" type="hidden" value="10320668112" />
<script src="//webresource.tripcdn.com/resaresenglish/basebiz/membersinfo/js/profileinfo.8615c663.js"></script>
<script>
var pageMenuDate = new Date();
var pageMenuYear = pageMenuDate.getFullYear();
var pageMenuMonth = (pageMenuDate.getMonth()+1).toString().padStart(2,'0');
var pageMenuDay = pageMenuDate.getDate().toString().padStart(2,'0');
var pageMenuHour = pageMenuDate.getHours().toString().padStart(2,'0');
var pageMenuTime = pageMenuYear+pageMenuMonth+pageMenuDay+pageMenuHour;
function loadScript(url, callback) {
var script = document.createElement("script");
script.src = url;
script.type = "text/javascript";
script.charset = "utf-8";
if (document.all) {//在IE下
script.onload = script.onreadystatechange = function () {
if (!script.readyState || script.readyState == 'loaded' || script.readyState == 'complete') {//MS文档说明loaded,completed可能只会出现其中之一
script.onload = script.onreadystatechange = null//重置为null,确保事件不被重复执行
callback();
}
}
}
else {//非IE
script.onload = function () {
callback();
}
}
document.getElementsByTagName("head")[0].appendChild(script);
}
var trip_loader_url = ""
if(document.location.href.indexOf('fat1') > -1){
trip_loader_url = "//webresource.english.fws.qa.nt.ctripcorp.com/ARES/accounts/pagemenu/js/trip_loader.js"
}else{
trip_loader_url = "//webresource.tripcdn.com/ARES/accounts/pagemenu/js/trip_loader.js"
}
var pageMenuUrlWithTime =trip_loader_url + "?v=" + pageMenuTime;
if ('https:' == document.location.protocol) {
pageMenuUrlWithTime = 'https://' + pageMenuUrlWithTime;
}
else {
pageMenuUrlWithTime = 'http://' + pageMenuUrlWithTime;
}
loadScript(pageMenuUrlWithTime, function(){});
</script>
<script>
const localeBlackList = []
if(window.TripHeaderFooterBundle) {
var headerProps = {showHeadLine: true, localeBlackList }
var footerProps = {}
window.TripHeaderFooterBundle.renderHeader(headerProps, document.querySelector('.header-container'));
window.TripHeaderFooterBundle.renderFooter(footerProps, document.querySelector('.footer-container'));
}
</script>
</body>
</html> | a9b67787ac2f6282e40a55da15b0d71d | {
"intermediate": 0.3006506562232971,
"beginner": 0.5398832559585571,
"expert": 0.15946601331233978
} |
22,635 | # define LED_PIN 13
# define BUZZER_PIN 6
# define STATE_INITIAL 0
# define STATE_JOIN_LINE 1
# define STATE_ON_LINE 2
# define STATE_LOST_LINE 3
# define STATE_RETURN_TO_START 4
# define STATE_HOME 5
# include "fsm.h"
FSM_c fsm;
int state;
int previous_state; | ba0ac9e1f51709376ee79ccb75e47ee9 | {
"intermediate": 0.30598360300064087,
"beginner": 0.3678796589374542,
"expert": 0.32613667845726013
} |
22,636 | how can i make the application fullscreen in c++ sdl2? | 11caa39dd3916812412502965b9548a2 | {
"intermediate": 0.41734862327575684,
"beginner": 0.24412085115909576,
"expert": 0.3385305106639862
} |
22,637 | for i in range(3):
try:
code
excluded:
pass
how do i also print the error that caused the exclude | 2183a57407b5da5518689be02280d1a4 | {
"intermediate": 0.22313816845417023,
"beginner": 0.5828112363815308,
"expert": 0.19405058026313782
} |
22,638 | this is my code: # Use ProcessPoolExecutor for parallel processing
with ProcessPoolExecutor(max_workers=num_processes) as executor:
results = list(tqdm(executor.map(get_bpr, row_contract_pairs), total=len(row_contract_pairs), desc='Getting BPR'))
that is located in a def.
the get_bpr is found outside that function.
# find bpr
def get_bpr(index_row_contract):
index, row, contract = index_row_contract
# Blank variables for new Search
placed_order_response = None
data = {'symbol': None,
'short_bpr_margin': None,
'short_bpr_cash': None,
'long_bpr_margin': None,
'long_bpr_cash': None,
'fee_calculation_total_fees': None,
'price_candidate_used': None,
'sold_price': None,
}
# Set symbol to allow connection
data['symbol'] = row['symbol']
# Convert back to Option and FutureOption Classes
contract = contract_list[index]
# Create Legs
leg = contract.build_leg(Decimal('1'), order.OrderAction.SELL_TO_OPEN)
buy_leg = contract.build_leg(Decimal('1'), order.OrderAction.BUY_TO_OPEN)
# Try prices in price_candidates until results
for candidate in row['price_candidates']:
try:
# Save Candidates
data['price_candidate_used'] = candidate
# Rounds to the nearest candidate price
price_bid = round_mid_price(row['midPrice'], candidate)
data['sold_price'] = price_bid
# Sell Side
order_to_fill = order.NewOrder(
time_in_force=order.OrderTimeInForce.GTC,
order_type=order.OrderType.LIMIT,
price= price_bid,
legs=[leg],
price_effect=order.PriceEffect.CREDIT
)
# Results of margin account for sell_leg
placed_order_response_margin = margin_account.place_order(session, order_to_fill, dry_run=True)
if placed_order_response_margin is not None:
data['short_bpr_margin'] = placed_order_response_margin.buying_power_effect.change_in_buying_power
data['fee_calculation_total_fees'] = placed_order_response_margin.fee_calculation.total_fees
try:
# Results of cash account for sell_leg
placed_order_response_cash = cash_account.place_order(session, order_to_fill, dry_run=True)
data['short_bpr_cash'] = placed_order_response_cash.buying_power_effect.change_in_buying_power
except Exception as e:
# Errors will occur when BPR is not enough in cash account or if trying to short call a ticker less then $10 in value
data['short_bpr_cash'] = -float('inf')
if row['instrument_type']=='FUTURE_OPTION':
# Buy Side
order_to_fill = order.NewOrder(
time_in_force=order.OrderTimeInForce.GTC,
order_type=order.OrderType.LIMIT,
price= price_bid,
legs=[buy_leg],
price_effect=order.PriceEffect.DEBIT
)
# Results of margin account for buy_leg
placed_order_response_margin = margin_account.place_order(session, order_to_fill, dry_run=True)
if placed_order_response_margin is not None:
data['long_bpr_margin'] = placed_order_response_margin.buying_power_effect.change_in_buying_power
try:
# Results of margin account for buy_leg
placed_order_response_cash = cash_account.place_order(session, order_to_fill, dry_run=True)
data['long_bpr_cash'] = placed_order_response_cash.buying_power_effect.change_in_buying_power
except Exception as e:
# Errors will occur when BPR is not enough in cash account or if trying to short call a ticker less then $10 in value
data['long_bpr_cash'] = -float('inf')
else:
data['long_bpr_margin'] = price_bid * row['notional_multiplier']
data['long_bpr_cash'] = price_bid * row['notional_multiplier']
if data['long_bpr_cash']>= float(cash_balance['derivative_buying_power'].values[0]):
data['long_bpr_cash'] = -float('inf')
return data
except Exception as e:
# Log the exception
logging.error(f"Error processing symbol {row['symbol']}: {str(e)}")
return data
contract_list was defined in the def where with ProcessPoolExecutor(max_workers=num_processes) as executor:
results = list(tqdm(executor.map(get_bpr, row_contract_pairs), total=len(row_contract_pairs), desc='Getting BPR')) is called.
---------------------------------------------------------------------------
_RemoteTraceback Traceback (most recent call last)
_RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.10/concurrent/futures/process.py", line 246, in _process_worker
r = call_item.fn(*call_item.args, **call_item.kwargs)
File "/usr/lib/python3.10/concurrent/futures/process.py", line 205, in _process_chunk
return [fn(*args) for args in chunk]
File "/usr/lib/python3.10/concurrent/futures/process.py", line 205, in <listcomp>
return [fn(*args) for args in chunk]
File "/tmp/ipykernel_3219/4156391043.py", line 93, in get_bpr
contract = contract_list[index]
NameError: name 'contract_list' is not defined
"""
The above exception was the direct cause of the following exception:
NameError Traceback (most recent call last)
/app/Notebooks/2_oldipynb.ipynb Cell 11 line 1
----> 1 full_df = get_contract_information()
/app/Notebooks/2_oldipynb.ipynb Cell 11 line 5
501 # Use ProcessPoolExecutor for parallel processing
502 with ProcessPoolExecutor(max_workers=num_processes) as executor:
...
404 finally:
405 # Break a reference cycle with the exception in self._exception
406 self = None
NameError: name 'contract_list' is not defined | 4a8f5fa8b9f77c8ea80386d5a00ecfde | {
"intermediate": 0.3472433388233185,
"beginner": 0.5254855751991272,
"expert": 0.12727110087871552
} |
22,639 | fix this error: sudo apt install -y libpcap-dev
[sudo] password for unknown:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libpcap0.8-dev : Depends: libpcap0.8 (= 1.10.0-2) but 1.10.3-1~bpo11+1 is to be installed | 9b8d36c5a60524fb4ef35975ecaa08e7 | {
"intermediate": 0.350240021944046,
"beginner": 0.3273869752883911,
"expert": 0.32237303256988525
} |
22,640 | напиши парсер на C# для wildberries | 09ced25c381a453d8d62a41a775b4d98 | {
"intermediate": 0.3833591639995575,
"beginner": 0.31722089648246765,
"expert": 0.29941996932029724
} |
22,641 | how can i force my program to crash/simulate it crashing in c++ sdl2 | e54a3314204c2813448a96bc2aeae24f | {
"intermediate": 0.3743077516555786,
"beginner": 0.2147543728351593,
"expert": 0.4109378457069397
} |
22,642 | int return_to_start(){
digitalWrite(LED_PIN, true);
kinematics.update();
if (kinematics.Theta_Home == 0) {
kinematics.Theta_Home = 3.14159 + atan(kinematics.Y_pos/kinematics.X_pos);
Serial.println(kinematics.Theta_Home);
if (kinematics.Theta_Home > 3.14) {
kinematics.Theta_Home -= (2 * 3.14159);
}
if (kinematics.Theta_Home < -3.14) {
kinematics.Theta_Home += (2 * 3.14159);
}
}
if (kinematics.Theta > kinematics.Theta_Home + 0.20) {
motors.setMotorPower(21, -21);
return 4;
}
if (kinematics.Theta < kinematics.Theta_Home - 0.20) {
motors.setMotorPower(-21, 22);
return 4;
}
else {
speed_pid_left.reset();
speed_pid_right.reset();
unsigned long time_to_home = millis() + 15000;
unsigned long current_time;
while (true) {
current_time = millis();
if (current_time >= time_to_home) {
Serial.println ("HOME!");
motors.setMotorPower(0, 0);
return 5;
}
update_state(4);
kinematics.update();
motors.setMotorPower(pwm_left, pwm_right);
}
}
}你能用其他结构写这个代码吗 | 2697b8d4ffdf6f1da62d584a98123ac5 | {
"intermediate": 0.3807123601436615,
"beginner": 0.3875654637813568,
"expert": 0.23172219097614288
} |
22,643 | net Razor call post webapi | d5ab0e31a7aa6dc310c6beb464d57d6a | {
"intermediate": 0.4013334810733795,
"beginner": 0.2871228754520416,
"expert": 0.31154364347457886
} |
22,644 | razor ajax without jquery | 80fbc3b03308da833aef7f838c458d6c | {
"intermediate": 0.46049362421035767,
"beginner": 0.245362788438797,
"expert": 0.29414358735084534
} |
22,645 | pk_frame2 <-sub_visit3%>%
arrange(Subject_ID,PSCHDAY,ACTHOUR) %>%
left_join(pk_frame1,by="Subject_ID")%>%
mutate(
#trtstm = as.POSIXct(anchor_time,format = "%H:%M"),
visit_date = anchor + days(PSCHDAY - 1),
collection_time =trtstm + as.difftime(ACTHOUR, units = "hours"),
#collection_time1 = as.POSIXct(collection_time, format = "%H:%M"),
# collection_time1 = with_tz(collection_time1, tz = "UTC"),
random_minutes = ifelse(PSCHHOUR %% 24 == 0 & PSCHMIN>0, sample(0:120, length(collection_time), replace = TRUE),
sample(-15:0, length(collection_time), replace = TRUE)),
ifelse(PSCHHOUR %% 24 == 0 & PSCHMIN<0, sample(-120:0, length(collection_time), replace = TRUE),
sample(0:15, length(collection_time), replace = TRUE)),
shifted_time = collection_time + lubridate::minutes(random_minutes),
SPECTIM = format(shifted_time, "%H:%M"),
SPECDAT = visit_date,
)
how to fix this code to show when PSCHHOUR %%24==0 AND PSCHMIN<0 THEN RANDOM_MINS RANGE IS -120:0, AND WHEN PSCHHOUR %%24==0 AND PSCHMIN>0 THEN RANDOM_MINIS RANGE IS 0:120, AND IF PSCHHOUR%%24 !=0 AND PSCHMIN<0 THEN RANDOM_MINS RANGE IS -15:0 AND WHEN PSCHHOUR %%24!=0 AND PSCHMIN>0 THEN RANDOM_MINS RANGE IS 0:15 | 6acfe6114073c18b1ddc4af7c53551c2 | {
"intermediate": 0.44364380836486816,
"beginner": 0.3745099604129791,
"expert": 0.1818462759256363
} |
22,646 | it seems it doesn't understand it completely. help craft a prompt normally to bring the concept in your english language: "look: if cover toddler girl's skin in color of the universe=? I mean her skin shouldn't look as normal skin but as universe skin covered in universal color of the universe." | d8333386cb93144e2561c90b1438a212 | {
"intermediate": 0.43686529994010925,
"beginner": 0.17768710851669312,
"expert": 0.3854476511478424
} |
22,647 | напиши парсер для wildberries на регулярных выражениях на C# | 3ed281a6c1c9d3d42f762e059681dd89 | {
"intermediate": 0.37603914737701416,
"beginner": 0.38025957345962524,
"expert": 0.24370130896568298
} |
22,648 | Write me some code that sends a row from a csv file to another csv file removing it from the first. | 3fc12d4360de273e02d3148e76a1f210 | {
"intermediate": 0.4927133619785309,
"beginner": 0.1149422824382782,
"expert": 0.3923443555831909
} |
22,649 | now=$(date +%H:%M) check if now is between '13:00' and '13:40' in shell | 729b04fc44b155ec418e59a2a702e56c | {
"intermediate": 0.3766091763973236,
"beginner": 0.3554060161113739,
"expert": 0.26798486709594727
} |
22,650 | now=$(date +%H:%M) check if now is between '13:00' and '13:40' in shell | a685010630a6748f6412726b039ec327 | {
"intermediate": 0.3766091763973236,
"beginner": 0.3554060161113739,
"expert": 0.26798486709594727
} |
22,651 | To check if the current time falls within the specified range in shell | de055270d00d6837017eae96f3f4cd05 | {
"intermediate": 0.3376868665218353,
"beginner": 0.20407865941524506,
"expert": 0.45823442935943604
} |
22,652 | Write a C++ library to work with complex numbers. Real and imaginary part in separate classes. You cannot use the complex template from the standard std library. Must implement addition, subtraction, multiplication, division, modulus and square root functions for complex numbers. At the end, give a couple of lines with an example of working with the library | 3d6be31e6b97b1bbd02fbcee82f10377 | {
"intermediate": 0.8365381956100464,
"beginner": 0.08470853418111801,
"expert": 0.07875325530767441
} |
22,653 | I want a datatype in in postgres that can hold floating type number of any size. Currently I am using this,
revenue NUMERIC(20, 5) NULL,
Can you suggest a better one? | 51ac2938eabda1ad17a31202cc41726f | {
"intermediate": 0.5871581435203552,
"beginner": 0.2054675966501236,
"expert": 0.20737424492835999
} |
22,654 | http header injection prevention in web.config file | b040d70c592e9c555425933c296fecf2 | {
"intermediate": 0.29524216055870056,
"beginner": 0.2548888921737671,
"expert": 0.44986894726753235
} |
22,655 | hi | e19153968ee2d3653dea097ba44728ad | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
22,656 | Write a C++ library for working with complex numbers. The library implements its own namespace. Complex numbers are implemented through a class. Real and imaginary parts are different data types (separate classes). You cannot use the complex template from std. You cannot use third-party libraries. There must be methods for addition, subtraction, multiplication, division, modulus calculation, degree expansion and root extraction for complex numbers. Inherit all methods from the main class. Create complex numbers through constructors. Access class fields through getters and setters that check the correctness of arguments (numbers). Handle errors and abnormal argument values with try, catch, and throw. In the library, use at least once: static method, static variable, friendly function. Avoid errors in your code. Keep variable names to no more than 2 characters. Don't write comments in the code. Don't explain anything. Write only the code. At the end, give 2 lines with an example of working with the library. | bfaecb5705d8556c0f31bbc7ab21154e | {
"intermediate": 0.6664707064628601,
"beginner": 0.20071083307266235,
"expert": 0.13281844556331635
} |
22,657 | how can I add rows or columns to a surface in maxsurf using vba | 09109cf76785fd61bafe9a8f1e791b47 | {
"intermediate": 0.5038825273513794,
"beginner": 0.19979265332221985,
"expert": 0.29632484912872314
} |
22,658 | Is it possible to use vuex in js file of Vue 3 project | b3348d412070931aff5e89efa956768f | {
"intermediate": 0.553030252456665,
"beginner": 0.18300306797027588,
"expert": 0.2639666497707367
} |
22,659 | How do we join multiple tables in a SELECT statement? Give an example. | ed1f3876426a2ebeaed7785666cfda75 | {
"intermediate": 0.5555146932601929,
"beginner": 0.14081759750843048,
"expert": 0.3036676347255707
} |
22,660 | write a python code that download Instagram post | 520bbdbecf98777ff7d6a3367e82b6f1 | {
"intermediate": 0.28813204169273376,
"beginner": 0.2930137813091278,
"expert": 0.4188541769981384
} |
22,661 | In my worksheet 'Events'
the following vba code deletes a row if the row value in column E is equals to 'Close'
as shown below;
For i = 2 To lastRow
If LCase(eventsSheet.Range("E" & i).Value) = "close" Then
response = MsgBox("Do you want to delete this row?" & vbNewLine & _
eventsSheet.Range("B" & i).Value & vbNewLine & _
eventsSheet.Range("C" & i).Value & vbNewLine & _
eventsSheet.Range("D" & i).Value & vbNewLine & _
eventsSheet.Range("E" & i).Value, vbYesNo)
If response = vbYes Then
eventsSheet.Rows(i).Delete
lastRow = lastRow - 1 ' Update LastRow after deleting the row
i = i - 1 ' Loop counter must decrease by one to check the new row that moved up
eventsSheet.Calculate ' Refresh conditional formatting
End If
End If
If eventsSheet.Range("B" & i).Value = "" Then Exit For ' Exit loop if first empty row is reached
Next i
I would like to amend the formula to do the following.
For each row in worksheet 'Events' that is deleted, copy the row values only in columns A, B, C, & D, to the next available row in worksheet'Events History' | be9308d9a61dec917a2b0685c47e45b5 | {
"intermediate": 0.3202053904533386,
"beginner": 0.47799360752105713,
"expert": 0.20180092751979828
} |
22,662 | access control allow origin shows * how to remove in iis server | ce36582ad8bd41cf9174b0b8f2db107a | {
"intermediate": 0.3493138551712036,
"beginner": 0.3087846338748932,
"expert": 0.3419015109539032
} |
22,663 | can you give me a PHP code, to order an array who's keys are software versions (like 118.0.5993.90, 118.0.5993.117, 118.0.5993.118) ? | cfc6da814a6febef750a81722373c00b | {
"intermediate": 0.43560945987701416,
"beginner": 0.2842390835285187,
"expert": 0.28015145659446716
} |
22,664 | can you give me a PHP code, to order an array who's keys are software versions (like 118.0.5993.90, 118.0.5993.117, 118.0.5993.118) ? | 36ff9f345de9df5da3596234a5ffe6d2 | {
"intermediate": 0.43560945987701416,
"beginner": 0.2842390835285187,
"expert": 0.28015145659446716
} |
22,665 | can you give me a PHP code, to order an array who's keys are software versions (like 118.0.5993.90, 118.0.5993.117, 118.0.5993.118) ? | 9c54acd831dbd307cc1ce3b119485fe0 | {
"intermediate": 0.43560945987701416,
"beginner": 0.2842390835285187,
"expert": 0.28015145659446716
} |
22,666 | can you give me a PHP code, to order an array who’s keys are software versions (like 118.0.5993.90, 118.0.5993.117, 118.0.5993.118) ? | ab10f4c620e9715880644a1a8961929c | {
"intermediate": 0.47790729999542236,
"beginner": 0.23629224300384521,
"expert": 0.2858005166053772
} |
22,667 | can you give me a PHP code, to order an array who's keys are software versions (like 118.0.5993.90, 118.0.5993.117, 118.0.5993.118) ? | c913dd951c10d9a931ededaace969272 | {
"intermediate": 0.43560945987701416,
"beginner": 0.2842390835285187,
"expert": 0.28015145659446716
} |
22,668 | У меня есть API написанное на Spring Java. Сервис который работает с ресторанами. Методы следующие:
Для контроллера ресторана:
@GetMapping("api/restaurant/")
public List<Restaurant> findAll() {
return repository.findAll();
}
При том что этот контроллер выводит список ресторанов и связанные с ним сущности, а именно меню которые есть в ресторане и блюда.
Для контроллера заказов:
@GetMapping("api/restaurant/orders")
public List<OrderDto> findAll() {
return service.mappingListDto(service.getAllOrders());
}
@GetMapping("api/restaurant/orders/active")
public List<OrderDto> findByActiveStatus() {
return service.mappingListDto(service.getOrdersByActiveStatus());
}
@GetMapping("api/restaurant/orders/{id}")
public OrderDto findById(@PathVariable("id") Long id) {
return service.mappingDto(service.getOrderById(id));
}
@PostMapping("api/restaurant/orders")
public OrderDto create(@RequestBody OrderDto dto) {
return service.mappingDto(service.save(dto));
}
@PutMapping("api/restaurant/orders/{point}")
public OrderDto update(@RequestBody OrderDto dto, @PathVariable("point") Integer point) {
return service.mappingDto(service.updateStatus(dto, point));
}
Напиши мне страницу с помощью bootstrap которая красиво покажет все рестораны с меню и блюдами, а так же страницу для заказов с формами и красивым выводом, ещё напиши с помощью javascript напиши так что бы HTTP-запросы с помощью JavaScript и получать ответы от сервера | 13bb90c0f2c8ef2dcb3bdadbc9f220c9 | {
"intermediate": 0.3863978385925293,
"beginner": 0.33597639203071594,
"expert": 0.27762582898139954
} |
22,669 | У меня есть API написанное на Spring Java. Сервис который работает с ресторанами. Методы следующие:
Для контроллера ресторана:
@GetMapping(“api/restaurant/”)
public List<Restaurant> findAll() {
return repository.findAll();
}
При том что этот контроллер выводит список ресторанов и связанные с ним сущности, а именно меню которые есть в ресторане и блюда.
Для контроллера заказов:
@GetMapping(“api/restaurant/orders”)
public List<OrderDto> findAll() {
return service.mappingListDto(service.getAllOrders());
}
@GetMapping(“api/restaurant/orders/active”)
public List<OrderDto> findByActiveStatus() {
return service.mappingListDto(service.getOrdersByActiveStatus());
}
@GetMapping(“api/restaurant/orders/{id}”)
public OrderDto findById(@PathVariable(“id”) Long id) {
return service.mappingDto(service.getOrderById(id));
}
@PostMapping(“api/restaurant/orders”)
public OrderDto create(@RequestBody OrderDto dto) {
return service.mappingDto(service.save(dto));
}
@PutMapping(“api/restaurant/orders/{point}”)
public OrderDto update(@RequestBody OrderDto dto, @PathVariable(“point”) Integer point) {
return service.mappingDto(service.updateStatus(dto, point));
}
Напиши мне страницу с помощью bootstrap которая красиво покажет все рестораны с меню и блюдами, а так же страницу для заказов с формами и красивым выводом, ещё напиши с помощью javascript напиши так что бы HTTP-запросы с помощью JavaScript и получать ответы от сервера. Распиши полностью файл script.js что бы добавить было нечего | ed7820f9ae2b0293df2eaea66411f796 | {
"intermediate": 0.48317691683769226,
"beginner": 0.3057766854763031,
"expert": 0.21104644238948822
} |
22,670 | #include <stdio.h>
#include <stdlib.h>
struct proc_info{
int atime;
int cpub;
int prio;
} proc[20];
struct rqnode{
int pid,prio;
struct rqnode *link;
} *first=NULL, *curr, *prev, *last;
struct ganttchart{
int stime;
int pid;
int etime;
}gchart[20];
int i,n,ctime,gi=0,wtime[20],ttime[20];
void getprocs();
void start();
void addprocq();
void attachtoq(int );
void addgchart(int);
void dispgchart();
void disptimes();
void main(){
getprocs();
ctime=0;
start();
dispgchart();
disptimes();
}
void getprocs(){
printf("\n How many processes: ");
scanf("%d",&n);
printf("\nPID\tATIME\tCPUB\tPriority\n");
for (i=1; i<=n; i++){
printf("%d\t",i);
scanf("%d%d%d",&proc[i].atime,&proc[i].cpub,&proc[i].prio);
}
}
void start(){
int pid;
addprocq();
pid=getfirstproc();
while(!finished()){
if(pid!=-1){
ctime++;
proc[pid].cpub--;
if(proc[pid].cpub==0){
printf("\nProc %d completed at time %d..",pid,ctime);
pid=getfirstproc();
}
}
else
ctime++;
addprocq();
}
gchart[gi].etime=ctime;
}
void addprocq(){
for(i=1;i<=n;i++){
if(proc[i].atime==ctime)
attachtoq(i);
}
}
void attachtoq(int pid){
struct rqnode *selp,*pselp;
curr=(struct rqnode *)malloc(sizeof(struct rqnode));
curr->pid=pid;
curr->prio=proc[pid].prio;
curr->link=NULL;
if(first==NULL){
first=curr;
return;
}
selp=first;
while(selp->prio<=curr->prio && selp!=NULL){
pselp=selp;
selp=selp->link;
}
if(selp==first){
curr->link=first;
first=curr;
}
else{
pselp->link=curr;
curr->link=selp;
}
}
int finished(){
for(i=1;i<=n;i++){
if(proc[i].cpub!=0)
return(0);
}
return(1);
}
int getfirstproc(){
int pid;
if(first==NULL)
return(-1);
pid=first->pid;
curr=first;
first=first->link;
free(curr);
addgchart(pid);
return(pid);
}
void addgchart(int pid){
static int ppid=-1;
if(pid!=ppid){
gchart[++gi].pid=pid;
gchart[gi].stime=ctime;
gchart[gi-1].etime=gchart[gi].stime;
ppid=pid;
}
}
void dispgchart(){
printf("\n");
for(i=1;i<=gi;i++)
printf("|----");
printf("|\n");
for(i=1;i<=gi;i++)
printf("| %d ",gchart[i].pid);
printf("|\n");
for(i=1;i<=gi;i++)
printf("|----");
printf("|\n");
for(i=1;i<=gi;i++)
printf("%d ",gchart[i].stime);
printf("%d\n",gchart[gi].etime);
}
void disptimes(){
int sumwt=0,sumtt=0,pid;
for(i=1;i<=gi;i++){
pid=gchart[i].pid;
ttime[pid]=(gchart[i].etime - proc[pid].atime);
}
for(i=1;i<=gi;i++){
pid=gchart[i].pid;
wtime[pid]+=(gchart[i].stime - proc[pid].atime);
proc[pid].atime=gchart[i].etime;
}
printf("\n**Waiting Time**");
printf("\nPID\tWtime");
for(i=1;i<=n;i++)
{
printf("\n%d\t%d",i,wtime[i]);
sumwt+=wtime[i];
}
printf("\nAverage:%.2f",(float)sumwt/n);
printf("\n**Turnaround Time**");
printf("\nPID\t ttime");
for(i=1;i<=n;i++)
{
printf("\n%d\t%d",i,ttime[i]);
sumtt+=ttime[i];
}
printf("\nAverage:%.2f",(float)sumtt/n);
}
find error out of the code and give me corrected | c4ebcb8be9e37a5b4e5bffd92b555b99 | {
"intermediate": 0.3882625997066498,
"beginner": 0.42704764008522034,
"expert": 0.18468979001045227
} |
22,671 | how do i use an arduino and thermistor to make an automated 5v dc fan | 5673c3959cb8057de26caf0e12cb1b37 | {
"intermediate": 0.40430787205696106,
"beginner": 0.33984702825546265,
"expert": 0.25584515929222107
} |
22,672 | calculate equivalent latitude in matlab | 2688dececabc1b966567cb8553f769c6 | {
"intermediate": 0.32411542534828186,
"beginner": 0.22438956797122955,
"expert": 0.4514949917793274
} |
22,673 | in c++ sdl2. i have two variables, screen_width and screen_height. screen_width is a multiple of 320 and screen_height is a multiple of 240. if i decrease screen_width, how do i decrease screen_height by the same 1:1 ratio? | b0479cc856951e147bfcce724b922c4f | {
"intermediate": 0.37447014451026917,
"beginner": 0.4083964228630066,
"expert": 0.21713341772556305
} |
22,674 | Make an autohotkey script that auto pastes "Aaaaaa1!" whenever I press CTRL+D | fa8ab7864098657d3e405f3b16ce571a | {
"intermediate": 0.34684234857559204,
"beginner": 0.31445783376693726,
"expert": 0.3386997580528259
} |
22,675 | can you gve me a PHP code to order an array whos key ares software version (like 118.0.5993.90, 118.0.5993.118, 118.0.5993.117) ? | 8cb920df68523d2c5e28b05ec827cdc2 | {
"intermediate": 0.5274750590324402,
"beginner": 0.17688587307929993,
"expert": 0.2956390380859375
} |
22,676 | how to center img inside div without resizing it and without using display flex? | ee2be49eebe3696ddc6ac3c14ad6d63c | {
"intermediate": 0.33532729744911194,
"beginner": 0.193762868642807,
"expert": 0.47090980410575867
} |
22,677 | Make an autohotkey script that whenever I press CTRL+Q will generate and paste 24 random characters and letters | b67ae8bf7ff6f059c2c5fc0503cf22fe | {
"intermediate": 0.33795395493507385,
"beginner": 0.18315306305885315,
"expert": 0.478892982006073
} |
22,678 | Write a program in python Program:
2 sliders
You spin the first one and it fills with green circles one by one
You spin the second one and the green circles are randomly painted red | e6471333dff7cc14f6ea3d321c157d42 | {
"intermediate": 0.3506796360015869,
"beginner": 0.14543263614177704,
"expert": 0.5038877129554749
} |
22,679 | ^d::
Send, Aaaaaa)1
return
Modify this script to press TAB and send the same string | 0c1873626fcd018830655298bcbea8c3 | {
"intermediate": 0.33336034417152405,
"beginner": 0.3288809657096863,
"expert": 0.3377586901187897
} |
22,680 | in a excel file in sharepoint, how can I link to files in different channel to keep the information updated automatically instead of copy and paste | 979aaed809c3cd766f25144930ff0e92 | {
"intermediate": 0.4184606671333313,
"beginner": 0.29249870777130127,
"expert": 0.28904062509536743
} |
22,681 | %tform = cp2tform(cpstruct.inputpoints, cpstruct.basepoints, 'affine');
>> tform = fitgeotrans(cpstruct.inputpoints, cpstruct.basepoints, 'affine'); % Structure of control
Unable to resolve the name 'cpstruct.inputpoints'.
>> %imtransform(I1, tform, 'bilinear');
>> Iregistered = imwarp(I1, tform); %wrap transformed image with the original one
tform requires one of the following:
Sensor Fusion and Tracking Toolbox
Navigation Toolbox
Robotics System Toolbox
ROS Toolbox
UAV Toolbox
>> figure, imshow(Iregistered, []); %show registered image
Unrecognized function or variable 'Iregistered'. | fdfc6a02fbd117fc7a9f209fbe29f3f0 | {
"intermediate": 0.3728790581226349,
"beginner": 0.412577748298645,
"expert": 0.21454325318336487
} |
22,682 | Есть набор данных времени temperatureData на Python. Например, temperatureData[0]= 26.10.2023 21:00 и т.д.
Пытаюсь выполнить такой код: for day in temperatureData:
start_time = day.replace(hour=10, minute=0, second=0)
end_time = day.replace(hour=19, minute=0, second=0)
TypeError: str.replace() takes no keyword arguments start_time = day.replace(hour=10, minute=0, second=0) | 66a077144708e4f7dc71d336cb9642ce | {
"intermediate": 0.34954971075057983,
"beginner": 0.40020737051963806,
"expert": 0.2502429187297821
} |
22,683 | #include<stdio.h>
#define INF -1
/*全局变量*/
int n, //结点数目
length = 0, //临时存储当前路径的路径长
shortest_length = INF, //存储最短路径长
**graph, //存储图
*path, //临时存储路径
*best_path; //存储最短路径
/*交换*/
void swap(int *array, int i, int j)
{
int temp;
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
/*结果输出*/
void output()
{
printf("最短路径长度是%d\n", shortest_length);
printf("此时路径为:%d", best_path[1]);
for (int i = 2; i < n + 1; i++)
printf("-->%d", best_path[i]);
printf("-->%d\n", best_path[1]);
}
/*递归回溯*/
void travel(int t)
{
/*终止条件,并处理最后一层*/
if (t == n)
{
if (graph[path[t - 1]][path[t]] != INF
&& graph[path[t]][1] != INF
&& (length + graph[path[t - 1]][path[t]] + graph[path[t]][1] < shortest_length || shortest_length == INF))
{
/*更新路径和最短回路的长度*/
for (int i = 0; i < n + 1; i++)
best_path[i] = path[i];
shortest_length = length + graph[path[t - 1]][path[t]] + graph[path[t]][1];
}
return;
}
/*递归的主体部分*/
for (int i = t; i < n + 1; i++)
{
if (graph[path[t - 1]][path[i]] != INF /*判断是否有路*/
&& (length + graph[path[t - 1]][path[i]] < shortest_length || shortest_length == INF)) /*判断是否比当前最短路径还要长,如果还没形成回路就已经比shortest_length大就直接进入下一轮*/
{
/*通过交换调整最短路径*/
swap(path, i, t);
/*更新length的值,便于下一层递归的筛选*/
length += graph[path[t - 1]][path[t]];
/*进入下一层递归;*/
travel(t + 1);
/*还原*/
length -= graph[path[t - 1]][path[t]];
swap(path, i, t);
}
}
}
int main()
{
/*起点*/
int start;
/*指定结点数目,可以根据需要自行修改*/
n = 5;
/*内存分配*/
graph = (int**)malloc(sizeof(int*) * (n + 1));//为二维数组分配n+1行
for (int i = 0; i <= n; i++)
graph[i] = (int*)malloc(sizeof(int) * (n + 1));
path = (int*)malloc(sizeof(int)*(n + 1));
best_path = (int*)malloc(sizeof(int)*(n + 1));
/*初始化*/
for (int i = 0; i < n + 1; i++)
{
path[i] = i;
for (int j = 0; j < n + 1; j++)
graph[i][j] = INF;
}
/*图输入,可以根据需要自行修改,结点从1开始编号,且编号即下标*/
graph[1][2] = graph[2][1] = 3;
graph[1][5] = graph[5][1] = 9;
graph[1][4] = graph[4][1] = 8;
graph[2][3] = graph[3][2] = 3;
graph[2][4] = graph[4][2] = 10;
graph[2][5] = graph[5][2] = 5;
graph[3][4] = graph[4][3] = 4;
graph[3][5] = graph[5][3] = 2;
graph[4][5] = graph[5][4] = 20;
//--------------------------------------------------------
/*指定起点*/
printf("请输入以第几个结点作为起点:");
scanf("%d", &start);
getchar();//吸收回车
/*调用递归开始遍历路径*/
travel(start+1);
/*结果输出*/
output();
/*释放动态开辟的空间*/
for (int i = 0; i < n + 1; i++)
free(graph[i]);
free(graph);
free(best_path);
free(path);
return 0;
} | 88ff0f4716d5516aaf558588940fe15f | {
"intermediate": 0.3304891586303711,
"beginner": 0.4167158603668213,
"expert": 0.2527949810028076
} |
22,684 | Пытаюсь создать график температуры на основе данных из файла. Вот код на python:
s0 = 'd:\\Develop\\Балка\\9\\'
start_year = 2023
start_month = 10
start_day = 19
start_hour = 12
start_minutes = 0
stop_year = 2023
stop_month = 10
stop_day = 26
stop_hour = 21
stop_minutes = 0
df = pd.read_csv(s0 + 'data_balka.csv', delimiter=';', header=None)
start_date = datetime.datetime(start_year, start_month, start_day, start_hour, start_minutes)
end_date = datetime.datetime(stop_year, stop_month, stop_day, stop_hour, stop_minutes)
temperatureData = df[0]
temperature = df[1]
# График для температуры
fig, ax = plt.subplots()
ax.minorticks_on()
ax.yaxis.grid(True, "major") # линии сетки для основных делений оси Y
ax.xaxis.grid(True, "major", color="red") # линии сетки для основных делений оси X
ax.yaxis.grid(True, "minor", linestyle=':') # линии сетки для основных делений оси Y
ax.xaxis.grid(True, "minor", linestyle=':') # линии сетки для основных делений оси X
# Добавляем подписи осям
ax.set_xlabel('Время',
bbox={'boxstyle': 'rarrow', # вид области
'pad': 0.1, # отступы вокруг текста
'facecolor': 'white', # цвет области
'edgecolor': 'red', # цвет крайней линии
'linewidth': 2}) # ширина крайней линии
ax.set_ylabel('Температура в градусах цельсия, С',
fontsize=7,
bbox={'boxstyle': 'rarrow', # вид области
'pad': 0.1, # отступы вокруг текста
'facecolor': 'white', # цвет области
'edgecolor': 'red', # цвет крайней линии
'linewidth': 2}) # ширина крайней линии
ax.tick_params(axis='x', labelsize=3)
ax.tick_params(axis='y', labelsize=6)
# Форматирование дат
date_formatter = mdates.DateFormatter('%Hч %d-%m')
ax.xaxis.set_major_formatter(date_formatter)
# Добавляем деления на каждые 6 часов
hour_locator_major = mdates.HourLocator(interval=12)
ax.xaxis.set_major_locator(hour_locator_major)
# Добавляем деления на каждые 3 часа (1/2 интервала основных делений)
hour_locator_minor = mdates.HourLocator(interval=2)
ax.xaxis.set_minor_locator(hour_locator_minor)
ax.plot_date(temperatureData, temperature, fmt='-', marker='.', markersize=2, color=(0, 0.25, 0.75), linewidth=0.5)
ymin, ymax = ax.get_ylim()
# Добавляем закрашенные прямоугольники на каждый день
for day in temperatureData:
day = datetime.datetime.strptime(day, '%d.%m.%Y %H:%M') # преобразование строки в datetime
start_time = day.replace(hour=10, minute=0, second=0)
end_time = day.replace(hour=19, minute=0, second=0)
ax.fill_between([start_time, end_time], 0, ymax, alpha=0.5, color=(0.8, 0.8, 0.0))
ax.set_title('График изменения температуры с течением времени')
# Сохранение графика
plt.show()
Возникает ошибка здесь: ax.fill_between([start_time, end_time], 0, ymax, alpha=0.5, color=(0.8, 0.8, 0.0)) | 8e9d6d8a781dfda91cb10d06832cbb42 | {
"intermediate": 0.25820696353912354,
"beginner": 0.5188112854957581,
"expert": 0.2229817509651184
} |
22,685 | escalation matrix | 99544037e115653294248b61145e42f7 | {
"intermediate": 0.34559205174446106,
"beginner": 0.32914236187934875,
"expert": 0.3252656161785126
} |
22,686 | generate 20 posts with title, short description, extended text and tags. format it as json list. | 07826059c8446568bdc5f4197ab192f6 | {
"intermediate": 0.3658357262611389,
"beginner": 0.21320655941963196,
"expert": 0.42095768451690674
} |
22,687 | how to use app_context flask to dataframe to postgresdb | 3c03851e5a16f51b09ca21f71a7d6e28 | {
"intermediate": 0.8881916403770447,
"beginner": 0.057859666645526886,
"expert": 0.05394874885678291
} |
22,688 | how do i convert between screen coordinates and the virtual coordinates used by sdl_logicalsize in c++ sdl2? | d90069a432fe5cb42c4ab2986f98fdc8 | {
"intermediate": 0.45772555470466614,
"beginner": 0.15243200957775116,
"expert": 0.38984251022338867
} |
22,689 | can you give me a php code to compare a date to now ? | 95f041fd682f8f00979d273420e436a8 | {
"intermediate": 0.5839361548423767,
"beginner": 0.21036505699157715,
"expert": 0.20569881796836853
} |
22,690 | how to use to_sql with app_context in Flask | e7522a3be5658c2b21947c3a6d66e26b | {
"intermediate": 0.7643410563468933,
"beginner": 0.129695326089859,
"expert": 0.10596364736557007
} |
22,691 | Hi, can you prepare CURL with GET and Header with Autorization Bearer with some random token to this address? http://localhost:8081/v2/countries/DE/dmlive/history/QWER123?startDate=2021-12-10T13%3A00%3A00&endDate=2021-12-10T14%3A00%3A00 | 852f541bf1a4d0a406153a3e4aabfe22 | {
"intermediate": 0.4918379485607147,
"beginner": 0.21367837488651276,
"expert": 0.2944836914539337
} |
22,692 | Write a program to read in a datafram from and excel file and make plot of two columns | c38f5454a02c444897a735d27acdcafc | {
"intermediate": 0.5233384370803833,
"beginner": 0.10518509894609451,
"expert": 0.3714764416217804
} |
22,693 | Hello | 0b311af3bf24235ded2df21b6d76058d | {
"intermediate": 0.3123404085636139,
"beginner": 0.2729349136352539,
"expert": 0.4147246778011322
} |
22,694 | SDL_SetRenderTarget(renderer, screenTexture);
// Render all of your screen content
// …
// Reset the rendering target to the default framebuffer
SDL_SetRenderTarget(renderer, NULL);
// Clear the renderer with a black color
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);
show me how to use a render texture to render in sdl2 c++, but include sdl_renderpresent | 7f763a59e40f3095f4e400e5b1dfd379 | {
"intermediate": 0.5824486017227173,
"beginner": 0.23456339538097382,
"expert": 0.1829880028963089
} |
22,695 | how to make number 0.13028e3 to number multiple of 1 in ruby | 278568098ccc3f4ae894455c9a00fa70 | {
"intermediate": 0.29927271604537964,
"beginner": 0.21200262010097504,
"expert": 0.48872461915016174
} |
22,696 | Mandible playbook to install https and configure | 65ccce4528f443606907f9587d39c5b3 | {
"intermediate": 0.5327022075653076,
"beginner": 0.185541033744812,
"expert": 0.281756728887558
} |
22,697 | how to draw table with bootstrap | d63ef18248b66bd5410581981fddd7c0 | {
"intermediate": 0.3724452555179596,
"beginner": 0.18500776588916779,
"expert": 0.4425469636917114
} |
22,698 | Calculate Equivalent Latitude in python | 4ab283c6a8831663d36955a2a73a17bf | {
"intermediate": 0.351132869720459,
"beginner": 0.22755928337574005,
"expert": 0.42130783200263977
} |
22,699 | in the below code the margin: 10px is not working
const cell = $('td');
cell.each(board);
function board(){
$(this).css({ "height" : "100px",
"width" : "100px",
"border": "1px solid black",
"border-radius" : "50%",
"background": "grey",
"margin": "10px !important"
})
} | 6c8d114847ef1b53b08371331c093534 | {
"intermediate": 0.3206547796726227,
"beginner": 0.4401577115058899,
"expert": 0.23918752372264862
} |
22,700 | how to upload big data to postgresql with sqlalchemy | 7140220a2d2b83d6f69cd55944d13875 | {
"intermediate": 0.562311053276062,
"beginner": 0.14981292188167572,
"expert": 0.2878761291503906
} |
22,701 | I have numerous workshets which contain formulas and vba codes.
To protect the formulas in the cells from bein deleted or changed, it is recommended that I protect the sheet.
When I do protect a sheet, sometimes the VBA code will fail because the sheet is protected.
Is there a way of still protecting my cell formulas yet still allowing my VBA codes to work correctly. | 711f18fc0bbe8c6cb561368217ec6b83 | {
"intermediate": 0.473265677690506,
"beginner": 0.21784815192222595,
"expert": 0.30888617038726807
} |
22,702 | CSV1 is my source CSV file, CSV2 is my destination CSV file. Write me some python code that transfers rows containing the word "lay" from CSV1 to CSV2. | a430063e3a16050cc76c6c7ee7c8ddc7 | {
"intermediate": 0.4151374101638794,
"beginner": 0.26883381605148315,
"expert": 0.31602880358695984
} |
22,703 | SELECT * FROM public.tasks
where tasks.url not None в чем ошибка? | afaded48ecb532fd05d36d6291e834cd | {
"intermediate": 0.3314015865325928,
"beginner": 0.37640905380249023,
"expert": 0.2921893298625946
} |
22,704 | How would I apply feature selection techniques to this dataset: mites(Percent) parasite(percent) Diseases (percent) Pesticides(percent) Other 3/(percent) Unknown(percent) Total Bee Colony losses
2015 19.8 12.5 2.2 4.9 15.5 20.8 1722360
2016 17.6 13.4 2.2 4.1 10.4 16.1 1645560
2017 26.3 18.2 5 13 22.2 1503910
2018 50.35 17.025 8.175 13.275 11.425 6.9 1615150
2019 33.85 10.8 5.25 9.525 7.375 3.75 1655880
2020 43.225 22.15 5.7 10.225 17.35 5.3 1612510
2021 40 9.9 4.5 7.15 8.9 3.75 1256980
to eventually determine the future honey bee population expectancy? Using pandas. | b1b15c8fb1eec3ff729fbf39be0d527b | {
"intermediate": 0.24068684875965118,
"beginner": 0.10955123603343964,
"expert": 0.6497618556022644
} |
22,705 | Hi! I need to write javascript function that will take credit card data and return cryptogram using CloudPayments API | 6dc527b7f15f598e6a4714a26b8564b1 | {
"intermediate": 0.839855968952179,
"beginner": 0.062159229069948196,
"expert": 0.09798481315374374
} |
22,706 | import json
import os
import requests
import time
from keep_alive import keep_alive
keep_alive()
url = ("https://api.mcstatus.io/v2/status/java/" + os.environ['SERVER_IP'])
while True:
response = requests.get(url)
json_data = json.loads(response.text)
expires_at = json_data['expires_at'] / 1000
current_time = time.time()
print("Current time:", current_time, " Expires at:", expires_at)
players_list = json_data['players']['list']
players_online = json_data['players']['online']
players_list_names = [player["name_clean"] for player in players_list]
print("Players online:", players_online)
print(players_list_names)
players_list_names_tmp = players_list_names
time.sleep(expires_at - current_time) | 48bac31f817fd10297f4f2e878fe3b94 | {
"intermediate": 0.33968979120254517,
"beginner": 0.45925331115722656,
"expert": 0.20105691254138947
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.