row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
16,877 | помоги с рефакторингом
public class ErrorCounter : MonoBehaviour, IDisposable
{
[SerializeField]
private TextMeshProUGUI textCurrentCounter;
[SerializeField]
private TextMeshProUGUI textMaxErrorCounter;
[SerializeField]
private Image slashIcon;
[SerializeField]
private Image errorIcon;
[Inject]
private ISubscriber subscriber;
private int error = 0;
private int errorMax = 0;
private bool isExam = false;
private Color ColorNoError = new Color(54f / 255f, 185f / 255f, 98f / 255f);
private Color ColorErrors = new Color(255f / 255f, 161f / 255f, 19f / 255f);
private Color ColorСriticalErrors = new Color(255f / 255f, 84f / 255f, 83f / 255f);
public event Action OnMaxErrors;
public int GetError()
{
return error;
}
public void ResetError()
{
error = 0;
textCurrentCounter.text = error.ToString();
}
public void Initialization(int errorMax, bool isExam)
{
this.isExam = isExam;
this.errorMax = errorMax;
subscriber.Subscribe<ViolationMessage>(IncreaseValueErrors);
SwitchExamMode();
textMaxErrorCounter.text = errorMax.ToString();
}
private void SwitchExamMode()
{
if (isExam)
{
slashIcon.Active();
textMaxErrorCounter.Active();
errorIcon.color = ColorNoError;
}
else
{
slashIcon.Deactive();
textMaxErrorCounter.Deactive();
}
}
private void IncreaseValueErrors(ViolationMessage message)
{
error++;
textCurrentCounter.text = error.ToString();
if (isExam)
{
errorIcon.color = ColorErrors;
}
if (isExam && error >= errorMax)
{
errorIcon.color = ColorСriticalErrors;
OnMaxErrors?.Invoke();
}
}
public void Dispose()
{
subscriber?.UnSubscribe<ViolationMessage>(IncreaseValueErrors);
}
private void OnDestroy()
{
Dispose();
}
} | 8b010b6c95aba2d69849d5f9c859a972 | {
"intermediate": 0.3239990174770355,
"beginner": 0.45051413774490356,
"expert": 0.2254868447780609
} |
16,878 | Power BI, I need to show the cumulative values for 4 Quarters (Field name Quarter Reported) in percentage based on the field Score percentage in table Merged. eg. 50% 50% 50% 100% shall give results in graph as 50%, 50%, 50 %, 62.5%. I need to create measure which gives this result in line graph | f4d48da694257220d50c1788c04907b6 | {
"intermediate": 0.34232327342033386,
"beginner": 0.2931192219257355,
"expert": 0.36455750465393066
} |
16,879 | open serial port in mips assembly? | fc50a6d1185b4ee759adf07b7b5f46e4 | {
"intermediate": 0.45306485891342163,
"beginner": 0.21973322331905365,
"expert": 0.3272019326686859
} |
16,880 | what is onmessage event listner | 462517214c6d02ca4f686ecf88d2133b | {
"intermediate": 0.29068994522094727,
"beginner": 0.3735562562942505,
"expert": 0.33575379848480225
} |
16,881 | I used your code: while True:
lookback = 10080
df = get_klines(symbol, interval, lookback)
if df is not None:
signals = signal_generator(df)
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signals: {signals}")
if signals == 'buy':
lookback = 1
df = get_klines(symbol, interval, lookback)
# Get last position entry price
trades = client.get_account_trades(symbol=symbol)
entry_price = float(trades[-1]['price'])
# Set stop loss price at +0.2% of short entry price
stop_loss_price = entry_price * (1 + 0.002)
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=0.1, stopPrice=stop_loss_price)
print("Long order executed!")
if signals == 'sell':
lookback = 1
df = get_klines(symbol, interval, lookback)
# Get last position entry price
trades = client.get_account_trades(symbol=symbol)
entry_price = float(trades[-1]['price'])
# Set stop loss price at +0.2% of short entry price
stop_loss_price = entry_price * (1 + 0.002)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=0.1, stopPrice=stop_loss_price)
print("Short order executed!")
time.sleep(1)
Can you tell me please if the mark price is higher than 0.2% of the entry price where your code will place stop loss ? | d4cf02c69f3315e57ee84af86714611d | {
"intermediate": 0.3336379826068878,
"beginner": 0.31795793771743774,
"expert": 0.3484041094779968
} |
16,882 | Hi, Please write a C# program that creates an array of ten integers. It should put ten random numbers from 1 to 100 in the array. It should copy all the elements of that array into another array of the same size.
Then display the contents of both arrays. To get the output to look like this, you'll need a several for loops.
Create an array of ten integers
Fill the array with ten random numbers (1-100)
Copy the array into another array of the same capacity
Change the last value in the first array to a -7
Display the contents of both arrays | 394ae97a89c9710bbfb5da7d324908e5 | {
"intermediate": 0.3843846619129181,
"beginner": 0.4007933735847473,
"expert": 0.2148219496011734
} |
16,883 | python code for getting the embedding representation of a sentence using BERT and pytorch | 9648664dae4757a7c03f3d06aadba52a | {
"intermediate": 0.42599695920944214,
"beginner": 0.11427654325962067,
"expert": 0.4597265124320984
} |
16,884 | does the javascipt engine v8 for example,first compile the javascript code to c++ code,and then machine code or machine code only | ca32b4cec7f91548c6009d2fc9d2c340 | {
"intermediate": 0.5309221744537354,
"beginner": 0.13225015997886658,
"expert": 0.33682766556739807
} |
16,885 | как вывести photo в json Api in javascript make me some examples | 0afb5bcab7c087f422a43ad7a624dd88 | {
"intermediate": 0.5391698479652405,
"beginner": 0.32735949754714966,
"expert": 0.13347063958644867
} |
16,886 | where is the error? <?php
header('Access-Control-Allow-Origin: *');
include 'FeedbackForm.php';
include 'FeedbackProcessorCrm.php';
$postData = file_get_contents('php://input');
$data = json_decode($postData, true);
/*
// для тесте
$data = ['phone' => 71234567890, 'url' => 'https://dmp.one/?yclid=3725717487900465674', 'email' => ["test@test.test"] ];
*/
$ym_uid = $_COOKIE['_ym_uid'];
$phone = $data["phone"];
$email = $data["email"][0];
$noemail = 'noemail+'.$phoneemail.'@gmail.com';
$website = $data["website"];
$referer = $data["referer"];
$utm_source = $data["utm_source"];
$utm_medium = $data["utm_medium"];
$utm_campaign = $data["utm_campaign"];
$utm_term = $data["utm_term"];
$utm_content = $data["utm_content"];
$date = date('Y-m-d') . ' ' . $time = date('H:i:s');
$url = "https://$website/?utm_source=$utm_source&utm_medium=$utm_medium&utm_campaign=$utm_campaign&utm_term=$utm_term&utm_content=$utm_content";
$logtext .= "\"$phone\";\"$email\";\"$url\";\"$referer\";\"$website\";\"$date\";\"$ym_uid\"\n";
$logtext = "$logtext";
// определяем директорию, куда писать, из названия домена:
$site = parse_url($url, PHP_URL_HOST);
$site = preg_replace('/[^ a-z\d]/ui', '',stristr($site, '.', true) );
// создаём директорию:
if (!is_dir('logs/' . $site)) {
mkdir('logs/' . $site);
}
file_put_contents(__DIR__ . '/logs/'.$site.'/data.csv', print_r($logtext,true), FILE_APPEND);
if ( $site === 'new' || $site == 'actionmarketing' && $phone > 0) {
$code = '2505';
// для ODP:
$bitrixid = '0';
$day = date('Y-m-d');
$time = date('H:i:s');
// заявки Актион-Маркетинг в ODP:
$data = [
"bitrixid" => $bitrixid,
"phone" => $phone,
"url" => $url
];
$data_string = json_encode ($data, JSON_UNESCAPED_UNICODE);
print_r($data_string);
$curl = curl_init('http://basis.inkerting.ru/action/add_candidate.php');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
// Принимаем в виде массива. (false - в виде объекта)
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($curl);
print_r($result);
curl_close($curl);
} else if ( $site === 'bizprogress' ) {
$code = '15004';
} else if ( $site === 'boxberry' ) {
$code = '14372';
} else if ( $site === 'equeo' ) {
$code = '15005';
} else if ( $site === 'klinikon' ) {
$code = '14889';
} else if ( $site === 'euroauto' ) {
$code = '15500';
} else if ( $site === 'joompro' ) {
$code = '15952';
} else if ( $site === 'makves' ) {
$code = '16191';
} else if ( $site === 'panaceadoc' ) {
$code = '16472';
} else if ( $site === 'ns23' ) {
$code = '16336';
} else if ( $site === 'scloud' ) {
$code = '16192';
} else if ( $site === 'mrdoors' ) {
$code = '16118';
} else if ( $site === 'strategs' ) {
$code = '16453';
} else {
$code = '2505';
}
if (isset($phone) and strlen($phone) > 0) {
$feedback = new FeedbackForm();
$feedback->name = 'Не указано';
$feedback->BitrixId = '0';
$feedback->phone = $phone;
$feedback->email = (isset($email) ? $email : $noemail);
$feedback->comment = '';
$feedback->url = $url;
$feedback->code = $code;
$sendcrm = new FeedbackProcessorCrm();
if ($sendcrm->send($feedback)) {
echo "Спасибо, ваша заявка принята";
} else {
echo "Повторите отправку заявки позже";
}
} else {
echo "Нет номера телефона";
} | e4539dd839c5f0404bbd20b7d36a918d | {
"intermediate": 0.3903568983078003,
"beginner": 0.4469072222709656,
"expert": 0.16273587942123413
} |
16,887 | postgres find all unique values in column | 153fa581104ca7446f979b2f45f12f1a | {
"intermediate": 0.3754754364490509,
"beginner": 0.3468707799911499,
"expert": 0.2776537835597992
} |
16,888 | Unity C# script to teleport 2d rigidbodies that fit LayerMask, to another transform | 68358d1427e3d1e26a8aba881362b0ba | {
"intermediate": 0.4274682104587555,
"beginner": 0.18597246706485748,
"expert": 0.3865593373775482
} |
16,889 | show me a full python script | 44989d4c4e8cb148886caa846a1e2e66 | {
"intermediate": 0.3565923869609833,
"beginner": 0.2635944187641144,
"expert": 0.3798132538795471
} |
16,890 | please provide an explanation with drawing to quantom cryptography secure bit transfer | cd9a965bf005f9516a6812137ea241d8 | {
"intermediate": 0.3099943995475769,
"beginner": 0.34286826848983765,
"expert": 0.34713733196258545
} |
16,891 | hi | 80c7c1a0030afb03a63b8c040b778658 | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
16,892 | char str[32] = {0};
int main(void) {
USART1_init(115200);
tim7delay(1000);
printf("this is main\r\n");
printf("定时器更改后%s\r\n",str);
} | eaddea640908e52cd661a0355a3dcd12 | {
"intermediate": 0.27066636085510254,
"beginner": 0.5021582245826721,
"expert": 0.22717534005641937
} |
16,893 | What does this code do?
document.querySelector(‘#gallery’).insertAdjacentHTML(‘beforeend’, <br/> <div class="modal-container" aria-modal="true" role="dialog" hidden="true"><br/> <div class="modal"><br/> <div class="modal__overlay"><br/> <div class="modal__btn-container"><br/> <button class="modal__btn modal__arrow modal__arrow--left" id="left" aria-label="Previous image"><br/> <svg width="24" height="24" fill="none" viewBox="0 0 24 24"><br/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10.25 6.75L4.75 12L10.25 17.25"></path><br/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 12H5"></path><br/> </svg><br/> </button><br/> <button class="modal__btn modal__close" aria-label="Close gallery"><br/> <svg width="24" height="24" fill="none" viewBox="0 0 24 24"><br/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 6.75L6.75 17.25"></path><br/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 6.75L17.25 17.25"></path><br/> </svg><br/> </button><br/> <button class="modal__btn modal__arrow modal__arrow--right" id="right" aria-label="Next image"><br/> <svg width="24" height="24" fill="none" viewBox="0 0 24 24"><br/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M13.75 6.75L19.25 12L13.75 17.25"></path><br/> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19 12H4.75"></path><br/> </svg><br/> </button><br/> </div><br/> <div class="modal__indicator-container"><br/> <br/> </div><br/> </div><br/> <br/> <div class="modal__image-container"><br/> <br/> </div><br/> </div><br/> </div><br/> <style><br/> .modal-container {<br/> position: fixed;<br/> inset: 0;<br/> background-color: hsl(var(--dark) / .8);<br/> display: grid;<br/> place-items: center;<br/> opacity: 0;<br/> pointer-events: none;<br/> transition: opacity 250ms ease-in-out;<br/> }<br/> <br/> .modal-container.active {<br/> opacity: 1;<br/> pointer-events: all;<br/> }<br/> <br/> .modal {<br/> position: relative;<br/> margin: 2rem;<br/> max-width: 900px;<br/> width: 100%;<br/> display: grid;<br/> place-items: center;<br/> overflow: hidden;<br/> box-shadow: 0px 2px 40px hsl(var(--dark));<br/> }<br/> <br/> .modal__image-container {<br/> display: flex;<br/> max-height: 100vh;<br/> }<br/> <br/> .modal__image {<br/> width: 100%;<br/> height: 100%;<br/> aspect-ratio: 16/10;<br/> object-fit: cover;<br/> }<br/> <br/> .modal__overlay {<br/> position: absolute;<br/> z-index: 4;<br/> bottom: 1rem;<br/> display: grid;<br/> gap: 1rem;<br/> }<br/> <br/> .modal__btn-container {<br/> display: flex;<br/> gap: 1rem;<br/> }<br/> <br/> .modal__btn {<br/> display: grid;<br/> place-items: center;<br/> background-color: hsl(var(--bkg) / .5);<br/> color: hsl(var(--text));<br/> padding: .5rem;<br/> border: 4px solid transparent;<br/> border-radius: 50%;<br/> cursor: pointer;<br/> transition: background-color 250ms cubic-bezier(0.9, 0, 0, 0.96), border 250ms cubic-bezier(0.9, 0, 0, 0.96);<br/> }<br/> <br/> .modal__btn:is(:hover,:focus) {<br/> background-color: hsl(var(--bkg) / .7);<br/> border: 4px solid hsl(var(--bkg) / .8);<br/> }<br/> <br/> .modal__btn svg {<br/> pointer-events: none;<br/> width: 2rem;<br/> height: 2rem;<br/> transition: transform 250ms cubic-bezier(0.9, 0, 0, 0.96);<br/> }<br/> .modal__btn:is(:hover,:focus) svg {<br/> transform: scale(1.2);<br/> }<br/> <br/> .modal__indicator-container {<br/> order: -1;<br/> display: flex;<br/> justify-content: center;<br/> gap: 1rem;<br/> }<br/> <br/> .modal__indicator {<br/> width: 1rem;<br/> height: 1rem;<br/> border-radius: 50%;<br/> background-color: hsl(var(--bkg) / .4);<br/> border: 3px solid hsl(var(--bkg) / .6);<br/> cursor: pointer;<br/> position: relative;<br/> }<br/> <br/> .modal__indicator:is(:hover, :focus) {<br/> background-color: hsl(var(--bkg) / .5);<br/> border: 3px solid hsl(var(--bkg) / .7);<br/> }<br/> <br/> .modal__indicator.active::before {<br/> content: '';<br/> position: absolute;<br/> inset: 2px;<br/> border-radius: 50%;<br/> background-color: hsl(var(--bkg) / .9);<br/> }<br/> </style><br/> ) | d36a0e35f2d9ec7b88610bd670651485 | {
"intermediate": 0.3087012767791748,
"beginner": 0.4638387858867645,
"expert": 0.2274598777294159
} |
16,894 | weit in py | 45d60baed9beb3e14aeb63daade87e00 | {
"intermediate": 0.3105573058128357,
"beginner": 0.42233604192733765,
"expert": 0.2671065926551819
} |
16,895 | You are given a single string. You need to convert each character into it's ASCII value and add the odd numbers together.
Example
Input: ABC
A,B,C → 65,66,67
Take odd numbers
65+67=132 Please write C# code | 849d488217a7083630e0bcf15403c993 | {
"intermediate": 0.4198971092700958,
"beginner": 0.39388027787208557,
"expert": 0.1862225979566574
} |
16,896 | handlebars compile how to use private variables | dfc32681b7857cbb0dd7da329c27ea27 | {
"intermediate": 0.3485437333583832,
"beginner": 0.4523947536945343,
"expert": 0.1990615278482437
} |
16,897 | GPT-3.5 Chatbot | 8690777df3fbe0550c8e4cb32223644d | {
"intermediate": 0.3232736587524414,
"beginner": 0.2754828631877899,
"expert": 0.40124350786209106
} |
16,898 | how can I make a function in js that has an argument and then adding a method to this function | 59995fa99a87e96edc9df0e50a7fc882 | {
"intermediate": 0.3970615863800049,
"beginner": 0.4450471103191376,
"expert": 0.15789127349853516
} |
16,899 | For a given regular jigsaw puzzle of of size h x w how many tabs (the bits that stick out) are there?
- A rectangular jigsaw puzzle has pieces arranged in a grid.
- Each piece has a single tab or socket on each side that is in contact with an adjacent piece.
Input
Line 1: Two space-separated integers h and w for the height and width of the puzzle in terms of pieces.
Output
Line 1: The numbers of tabs as an integer. Please write a C# program to solve this. | 6ca4df1c11783befea14a849c2d254db | {
"intermediate": 0.40586385130882263,
"beginner": 0.2870499789714813,
"expert": 0.30708616971969604
} |
16,900 | помоги с рефактроингом public class QuestTime : MonoBehaviour
{
private const int SecondsInMinute = 60;
private const int SecondsInHour = 3600;
private const int SecondsToWait = 1;
[SerializeField]
private TextMeshProUGUI hourHand;
[SerializeField]
private GameObject timerIcon;
[SerializeField]
private GameObject timeIcon;
private float timeSeconds = 0;
private bool isTimeReduction = false;
private Coroutine currentTimeCoroutine;
public event Action OnTimeIsUp;
public void SetTimeLimit(int timeMinutes, bool isTimeReduction)
{
timeSeconds = timeMinutes * SecondsInMinute;
this.isTimeReduction = isTimeReduction;
}
public string GetTime()
{
return hourHand.text;
}
public void ResetTime()
{
timeSeconds = 0;
if (currentTimeCoroutine != null)
{
StopCoroutine(currentTimeCoroutine);
}
}
public void Initialize()
{
ChangeIcons();
currentTimeCoroutine = StartCoroutine(TimeCoroutine());
}
private IEnumerator TimeCoroutine()
{
while (true)
{
ConvertTime(isTimeReduction ? timeSeconds-- : timeSeconds++);
yield return new WaitForSeconds(SecondsToWait);
if (isTimeReduction && timeSeconds < 0)
{
OnTimeIsUp?.Invoke();
yield break;
}
}
}
private void ConvertTime(float time)
{
var hours = Mathf.Floor(time / SecondsInHour);
var minutes = Mathf.Floor((time % SecondsInHour) / SecondsInMinute);
var seconds = Mathf.Floor(time % SecondsInMinute);
UpdateQuestTime(hours, minutes, seconds);
}
private void UpdateQuestTime(float hours, float minutes, float seconds)
{
hourHand.text = $"{((int)hours):D2}:{ ((int)minutes):D2}:{ ((int)seconds):D2}";
}
private void ChangeIcons()
{
timerIcon.SetActive(isTimeReduction);
timeIcon.SetActive(!isTimeReduction);
}
} | 097c0e57fba3635b77964d848655b22b | {
"intermediate": 0.32538726925849915,
"beginner": 0.45091912150382996,
"expert": 0.22369356453418732
} |
16,901 | signal?.aborted | 7e0887bfe31ca050280ac8647088ebcb | {
"intermediate": 0.30368390679359436,
"beginner": 0.3238329589366913,
"expert": 0.37248313426971436
} |
16,902 | Potree.Viewer is not a constructor | 9dca08dc2203d0a447db3a5fb2f68f78 | {
"intermediate": 0.3519083261489868,
"beginner": 0.3693993091583252,
"expert": 0.2786923944950104
} |
16,903 | как сделать оверлей в imgui, т.е нужно убрать bg у приложения, которое содержит окна внутри себя | 36ab7be57b11d4416f8825ebf98374cc | {
"intermediate": 0.39337942004203796,
"beginner": 0.2356812059879303,
"expert": 0.37093931436538696
} |
16,904 | Simon the firefighter has to rescue a family from a burning building. The family is located on an upper floor, but unfortunately the fire has already spread and the stairs are not accessible anymore.
Build a ladder for Simon so he can reach the family and rescue them.
For every floor you have to print 1 ladder segment. 1 segment looks like this:
# #
####
# #
Two segments look like this:
# #
####
# #
####
# #
Input
An integer floor, on which the family is located.
Output
The ASCII ladder. For example output for number 2 is # #
####
# #
####
# # | b4023bdbee721c75e16a55ad26efefcf | {
"intermediate": 0.41328170895576477,
"beginner": 0.23052294552326202,
"expert": 0.3561953604221344
} |
16,905 | Write an excel macro that will highlight duplicated cells | b88ae6a6bbb2cc1340aaf2c69ed7985f | {
"intermediate": 0.3963286280632019,
"beginner": 0.25603437423706055,
"expert": 0.34763699769973755
} |
16,906 | Get me foodname which I can make based on its ingredient availability in fridge create table recipe (foodname varchar(20), ingredient_id int, ingredient varchar(20))
create table fridge (ingredient_id int, ingredientname varchar(20))
insert into recipe values('hotdog', 1, 'sausage'),
('hotdog', 2, 'bread'),
('plov', 3, 'rice'),
('plov', 4, 'carrot'),
('plov', 5, 'meat'),
('pizza', 6, 'flour'),
('pizza', 7, 'tomato'),
('pizza', 8, 'cheese')
insert into fridge values (1, 'sausage'), (2, 'bread'), (3, 'rice'), (4, 'carrot'), (6, 'flour')
select * from recipe
select * from fridge | c4f28c1b37a72e68ba25ffcdd8389ebd | {
"intermediate": 0.37681812047958374,
"beginner": 0.24093663692474365,
"expert": 0.382245272397995
} |
16,907 | у меня выдает ошибки
Uncaught TypeError: Cannot read properties of undefined (reading 'call')
at $.validator.check (jquery.validate.js:624:45)
at $.validator.checkForm (jquery.validate.js:411:10)
at HTMLInputElement.<anonymous> (jquery.validate.js:59:20)
at HTMLInputElement.dispatch (jquery-1.11.3.min.js:4:8549)
at r.handle (jquery-1.11.3.min.js:4:5252)
вот код мой
<div class="col-6 col-md-3">
<label class="ui-label">Срок</label>
<div class="ui-field">
<form:input class="ui-input js-mask-term" type="text" maxlength="5"
path="monthYear"
placeholder="ММ/ГГ" id="month_year" autocomplete="off"
required="true"/>
<div class="input_with_result_error_text"></div>
</div>
</div>
$(document).ready(function () {
var cvc = $('#cvc');
var amountControl = $('#amountControl');
var monthYear = $('#month_year');
monthYear.on('input change paste keyup', function () {
var monthYear = $(this).val();
if (!monthYear.substring(0, 2).match(/^(0[1-9]|1[012])$/g)) {
monthYear = monthYear.replace(/^(0?[0-9]{2}|[1-9][3-9])/g, '');
}
$(this).val(monthYear);
});
amountControl.on('input change paste keyup', function () {
var summ = $(this).val();
if (summ.match(/[^0-9]/g)) {
summ = summ.replace(/[^0-9]/g, '');
}
$(this).val(summ);
});
cvc.on('input change paste keyup', function () {
var cvc = $(this).val();
if (cvc.match(/[^0-9]/g)) {
cvc = cvc.replace(/[^0-9]/g, '');
}
$(this).val(cvc);
});
if(monthYear.length > 0){
new IMask(
document.getElementById('month_year'), {
mask: '00/00',
});
}
monthYear.rules('add', {
checkNull: true
});
$('input[type="text"], input[type="password"]').on('keyup input', function () {
var self = $(this);
var value = self.val().replace(/\s/g, '').replace('_', '');
if (self.attr('id') == 'cardFrom') {
if (!self.hasClass('has-error2') && !self.hasClass('has-error') && value.length == 16) {
$('#month_year').focus();
}
} else if (self.attr('id') == 'month_year' && value.length == 5) {
$('#cvc').focus();
} else if (self.attr('id') == 'cvc' && value.length == 3) {
$('#cardTo').focus();
} else if (self.attr('id') == 'cardTo') {
if (!self.hasClass('has-error2') && !self.hasClass('has-error') && value.length == 16) {
$('#amountControl').focus();
}
}
});
});
что не так? | e6eb8247501dd8d128d902d379e6ebaf | {
"intermediate": 0.35015869140625,
"beginner": 0.49155110120773315,
"expert": 0.15829022228717804
} |
16,908 | I used your code: def set_stop_loss(symbol, entry_price, mark_price):
lookback = 1
df = get_klines(symbol, interval, lookback)
# Get the open price of the previous candle
prev_open = float(df.iloc[-2]['open'])
# Set stop loss price
stop_loss_price = prev_open
if mark_price > entry_price * (1 - 0.002):
stop_loss_price = entry_price * (1 - 0.002)
return stop_loss_price
while True:
lookback = 10080
df = get_klines(symbol, interval, lookback)
if df is not None:
signals = signal_generator(df)
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signals: {signals}")
if signals == 'buy':
lookback = 1
df = get_klines(symbol, interval, lookback)
# Get last position entry price
trades = client.get_account_trades(symbol=symbol)
entry_price = float(trades[-1]['price'])
# Set stop loss price
stop_loss_price = set_stop_loss(symbol, entry_price)
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=0.1, stopPrice=stop_loss_price)
print("Long order executed!")
if signals == 'sell':
lookback = 1
df = get_klines(symbol, interval, lookback)
# Get last position entry price
trades = client.get_account_trades(symbol=symbol)
entry_price = float(trades[-1]['price'])
# Set stop loss price
stop_loss_price = set_stop_loss(symbol, entry_price)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=0.1, stopPrice=stop_loss_price)
print("Short order executed!")
time.sleep(1)
But I getting ERROR: The signal time is: 2023-08-03 18:55:00 - Signals: sell
No data found for the given timeframe and symbol
Traceback (most recent call last):
File "c:\Users\Alan\.vscode\jew_bot\jew_bot\jew_bot.py", line 216, in <module>
stop_loss_price = set_stop_loss(symbol, entry_price)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: set_stop_loss() missing 1 required positional argument: 'mark_price' | 04c398068ffac63ceb28c6b80d8143e1 | {
"intermediate": 0.31985145807266235,
"beginner": 0.46301528811454773,
"expert": 0.21713325381278992
} |
16,909 | how can I optimize this code? Its using an absurd ammount of memory and absolutelly rapes my pretty beefy pc, i have 16gb ram
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
prompt = (
"""Greetings sir, what's your name?"""
)
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
gen_tokens = model.generate(
input_ids,
do_sample=True,
temperature=0.9,
max_length=100,
)
gen_text = tokenizer.batch_decode(gen_tokens)[0]
print(gen_text) | 65b68bc758a0784c25a5e2a9fac4d26a | {
"intermediate": 0.288242906332016,
"beginner": 0.2946808338165283,
"expert": 0.4170762896537781
} |
16,910 | как очистить stage в react pixi | 27039e02ea297743d78fb697618ad818 | {
"intermediate": 0.3229454457759857,
"beginner": 0.3385204076766968,
"expert": 0.3385342061519623
} |
16,911 | local uis = game.UserInputService
local camn = 1
local cameras = {}
local cam = game.Workspace.CurrentCamera
local used = true
for i, v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("BasePart") and v.Name == "Camera" and v.Parent.Name == "Camera" then
table.insert(cameras, v)
end
end
if used == true then
script.Parent.Enabled = true
camn = 1
cam.CameraType = "Scriptable"
cam.CFrame = cameras[camn]
end
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Right then
end
end) скрипт не работает почему предметы не попадают в таблицу исправь | ee8ff655631f1764101c6ac9df5d30c6 | {
"intermediate": 0.3898746073246002,
"beginner": 0.3567580580711365,
"expert": 0.25336742401123047
} |
16,912 | local uis = game.UserInputService
local camn = 1
local cameras = {}
local cam = game.Workspace.CurrentCamera
local used = true
for i, v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("BasePart") and v.Name == "Camera" and v.Parent:IsA("Camera") then
table.insert(cameras, v)
end
end
if used == true then
script.Parent.Enabled = true
camn = 1
cam.CameraType = "Scriptable"
cam.CFrame = cameras[camn]
used = false
end
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Right then
end
end) роблокс дает ошибку Unable to assign property CFrame. CoordinateFrame expected, got nil это потому что предметы не входят в таблицу? | 9efb5bc69993afba0d7bfbdd88608d9d | {
"intermediate": 0.48173561692237854,
"beginner": 0.27279940247535706,
"expert": 0.2454649806022644
} |
16,913 | local uis = game.UserInputService
local camn = 1
local cameras = {}
local cam = game.Workspace.CurrentCamera
local used = true
for i, v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("BasePart") and v.Name == "Camera" then
print(v)
table.insert(cameras, v)
end
end
if used == true then
script.Parent.Enabled = true
camn = 1
cam.CameraType = "Scriptable"
cam.CFrame = cameras[camn]
end
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Right then
end
end) сделай так чтобы все блоки в workspace с именем "Camera" и parent "Camera" добавлялись в таблицу. У меня где-то ошибка в скрипте | 9e838bf1fa4eb68afa5841a194392031 | {
"intermediate": 0.31859514117240906,
"beginner": 0.46712595224380493,
"expert": 0.2142789363861084
} |
16,914 | make a loading bar in python which updates in the console without wiping the entire screen or repeating it by just modifying the original in any means you can | cefaac9ae782407d69a148276170cce4 | {
"intermediate": 0.5479466915130615,
"beginner": 0.14119838178157806,
"expert": 0.3108549416065216
} |
16,915 | local uis = game:GetService("UserInputService")
local camn = 1
local cameras = {}
local cam = game.Workspace.CurrentCamera
local used = true
if used == true then
script.Parent.Enabled = true
camn = 1
game["Run Service"].Stepped:Connect(function()
game.Lighting.CamerasCorrection.Enabled = true
for i, v in ipairs(game.Workspace:GetDescendants()) do
if v:IsA("BasePart") and v.Name == "CameraPart" and v.Parent.Name == "Camera" then -- Добавляем проверку родительского объекта
local alreadyAdded = false
for j, existingCamera in ipairs(cameras) do
if existingCamera == v then
alreadyAdded = true
return
end
end
if not alreadyAdded then
table.insert(cameras, v)
end
end
end
end)
end
repeat
wait()
if #cameras > 0 then
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = cameras[1].CFrame -- Исправляем доступ к CFrame камеры
end
until #cameras > 1
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Right or key.KeyCode == Enum.KeyCode.D then
if camn > #cameras - 1 then
camn = 1
cam.CFrame = cameras[camn].CFrame -- Исправляем доступ к CFrame камеры
else
camn = camn + 1
cam.CFrame = cameras[camn].CFrame -- Исправляем доступ к CFrame камеры
end
script.Parent.cam.Text = "CAM "..camn
print(camn)
cam.CameraType = Enum.CameraType.Scriptable
elseif key.KeyCode == Enum.KeyCode.Left or key.KeyCode == Enum.KeyCode.A then
if camn == 1 then
camn = #cameras
else
camn = camn - 1
end
script.Parent.cam.Text = "CAM "..camn
print(camn)
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = cameras[camn].CFrame -- Исправляем доступ к CFrame камеры
end
end) сделай так что если ты ЗАЖИМАЕШь клавиши указанные в этом скрипте на протяжении 2х секунд, то камеры перелистываются автоматически пока не отпустишь клавишу | 5879cdda794548cfa9ddaaf4eecb964b | {
"intermediate": 0.4001104533672333,
"beginner": 0.3877379596233368,
"expert": 0.21215155720710754
} |
16,916 | with mkvinfo, i'd like to remove all extras info of a file | dc5fd4f9c1d04153c177252cd8414333 | {
"intermediate": 0.37486550211906433,
"beginner": 0.22697599232196808,
"expert": 0.398158460855484
} |
16,917 | how to remove duplicate line in a text file in linux | 8ed8b302122c844e5f1e27d28b9be554 | {
"intermediate": 0.34189289808273315,
"beginner": 0.33916983008384705,
"expert": 0.318937212228775
} |
16,918 | Can you please write a VBA code that can meet the requirements and conditions described below:
The range B3:B1000 contains a series of text values that repeat in the following order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
The value in cell B3 identifies the position of the value in the series. For example, if the value in B3 is "Wednesday", then the next cell with a value in the range must be "Thursday".
The VBA code will use the value in B3 to identify the position of the value in the series, and then look for the next cell that has a value in the range. The code should ignore empty cells in the range.
If a cell value is found that does not follow the pattern of the sequence, the code should highlight the cell and then continue down the range, treating the next cell with a value as a fresh start of the find procedure.
The code should stop when cell B1000 is reached. | c19cbf3d1c3444bab118555296192c6d | {
"intermediate": 0.4072592854499817,
"beginner": 0.15712414681911469,
"expert": 0.4356165826320648
} |
16,919 | opensource tool for managed file transfer covers HTTPs, FTP, SFTP, SCP | c2ed9b252807c2c934db6862878af319 | {
"intermediate": 0.37805575132369995,
"beginner": 0.20925036072731018,
"expert": 0.4126938581466675
} |
16,920 | I have this code: def set_stop_loss(symbol, entry_price, mark_price):
lookback = 1
df = get_klines(symbol, interval, lookback)
# Get the open price of the previous candle
prev_open = float(df.iloc[-2]['Open'])
# Set stop loss price
stop_loss_price = prev_open
if mark_price > entry_price * (1 - 0.002):
stop_loss_price = entry_price * (1 - 0.002)
return stop_loss_price
while True:
lookback = 10080
df = get_klines(symbol, interval, lookback)
if df is not None:
signals = signal_generator(df)
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signals: {signals}")
if signals == 'buy':
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=0.1)
print("Long order executed!")
except binance.error.ClientError as e:
print(f"Error executing long order: {e}")
time.sleep(1)
if signals == 'sell':
try:
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=0.1)
print("Short order executed!")
except binance.error.ClientError as e:
print(f"Error executing short order: {e}")
time.sleep(1)
time.sleep(1)
Can you set my algorithm in my code , algorithm: Get price by this code = mark_price = client.ticker_price(symbol=symbol), if the signal == buy or sell set stop loss - 10% how to set stop loss - 10% :(get mark price , mark price - 0.2% result = stop loss , example: mark price = 200 , 200-0.2% result = 199.96. 199.96 will be stop loss price ) | d6d5d035063ac4f6db893e481251e342 | {
"intermediate": 0.3004625141620636,
"beginner": 0.1711229383945465,
"expert": 0.5284146070480347
} |
16,921 | refactor this method in java private <K, V> Map<K, JsonFieldAuditChangeDetector.ValueDifference> difference(
Map<? extends K, V> newNode,
Map<? extends K, V> oldNode,
String fieldName) {
Map<K, JsonFieldAuditChangeDetector.ValueDifference> differences = new HashMap<>();
Map<K, Object> onlyOldValue = new HashMap<>(oldNode);
var suffix = getSuffix(newNode);
for (Map.Entry<? extends K, V> entryFromNewValue : newNode.entrySet()) {
K newValueKey = entryFromNewValue.getKey();
Object newEntryValue = entryFromNewValue.getValue();
var fieldNameKey = fieldName + "." + newValueKey + suffix;
if (oldNode.containsKey(newValueKey)) {
var oldEntryValue = onlyOldValue.remove(newValueKey);
//If the value is an instance of Map we use recursion to go deep into the map.
if (oldEntryValue instanceof Map oldEntryValueMap &&
newEntryValue instanceof Map newEntryValueMap) {
differences.putAll(difference(newEntryValueMap, oldEntryValueMap, fieldNameKey));
} else if (oldEntryValue instanceof List oldEntryValueList &&
newEntryValue instanceof List newEntryValueList) {
differences.putAll(difference(this, newEntryValueList, oldEntryValueList, differences, fieldNameKey));
} else if (!Objects.equals(newEntryValue, oldEntryValue)) {
differences.put((K) fieldNameKey, new JsonFieldAuditChangeDetector.ValueDifference<>(newEntryValue, oldEntryValue));
}
} else {
differences.put((K) fieldNameKey, new JsonFieldAuditChangeDetector.ValueDifference(newEntryValue, null));
}
}
return differences;
} | 2fbc399bd28d838598f69a5f000c34ab | {
"intermediate": 0.4077651798725128,
"beginner": 0.3976447880268097,
"expert": 0.1945900171995163
} |
16,922 | in python, will a while loop be cancel imediately if variable such as while variable= true: change to false? | e6dbb82b6b376aec5b0652a23f110ea4 | {
"intermediate": 0.1866665929555893,
"beginner": 0.7005259990692139,
"expert": 0.11280746757984161
} |
16,923 | def greedyMC(coinvalueList, change):
res = []
coinvalueList.sort(reverse=True)
for c in coinvalueList:
# Добавить максимально возможное число монет очередного наибольшего номинала.
change = change - (change // c) * c
#res.append([c * (change // c))
res += [19] * (change // c)
print(change, res)
# Обновить сумму сдачи, остающуюся до возврата.
if change == 0:
return res | 92a09eac5246552249bd8f8e3db78335 | {
"intermediate": 0.2879848778247833,
"beginner": 0.48624053597450256,
"expert": 0.22577455639839172
} |
16,924 | using the bitcoinlib library and hikari (might not havve spelt that correct) make a discord bot where you can deposit and withdraw bitcoin from | 42db9871663a499320c6bfded1c931a2 | {
"intermediate": 0.7305468320846558,
"beginner": 0.09859377145767212,
"expert": 0.1708594262599945
} |
16,925 | make a basic economy bot using hikari and python, | 2f94647e9f7b6bd42239ae1ea554fea0 | {
"intermediate": 0.3098949193954468,
"beginner": 0.19430795311927795,
"expert": 0.49579712748527527
} |
16,926 | This is a cookie given by a website called "validation_id": a930f285-7607-4832-a80f-4362bad64bd2:00000407:1691096878277 Can you try to deduce anything from this string? | ddfd4593e2ad8eaa6c62bdbb48a6bf1e | {
"intermediate": 0.38925135135650635,
"beginner": 0.21414817869663239,
"expert": 0.39660048484802246
} |
16,927 | create python environment with python version 3.7 | 8c8ffaefce867ca0f43f0740d99eb16f | {
"intermediate": 0.3303980529308319,
"beginner": 0.2593541741371155,
"expert": 0.4102477431297302
} |
16,928 | Create a recon tool | 98c267876bb570081cb964ba57c8686c | {
"intermediate": 0.34854742884635925,
"beginner": 0.24927836656570435,
"expert": 0.402174174785614
} |
16,929 | run recon opt on phyton to show visual | cc643adae338d68ba636de902df1f048 | {
"intermediate": 0.38697758316993713,
"beginner": 0.23166489601135254,
"expert": 0.3813575506210327
} |
16,930 | hey | 2edc541bdc8b450a8659971613506a0d | {
"intermediate": 0.33180856704711914,
"beginner": 0.2916048467159271,
"expert": 0.3765866458415985
} |
16,931 | I want to add a column in the second position in a CSV file, please give me the R language code. | 927d8a9b12a7f5c20d3515b02e88e583 | {
"intermediate": 0.3211359977722168,
"beginner": 0.2677437365055084,
"expert": 0.41112020611763
} |
16,932 | local server_ip = "112.125.89.8"
local server_port = 43531
local UDP_port = 37834
local ssl_port = 35528
local rxbuf = zbuff.create(8192)
local function netCB(netc, event, param)
if param ~= 0 then
sys.publish("socket_disconnect")
return
end
if event == socket.LINK then
elseif event == socket.ON_LINE then
socket.tx(netc, "hello,luatos!")
elseif event == socket.EVENT then
socket.rx(netc, rxbuf)
socket.wait(netc)
if rxbuf:used() > 0 then
log.info("收到", rxbuf:toStr(0,rxbuf:used()):toHex())
log.info("发送", rxbuf:used(), "bytes")
socket.tx(netc, rxbuf)
end
rxbuf:del()
elseif event == socket.TX_OK then
socket.wait(netc)
log.info("发送完成")
elseif event == socket.CLOSE then
sys.publish("socket_disconnect")
end
end
local function socketTask()
local netc = socket.create(nil, netCB)
socket.debug(netc, true)
socket.config(netc, nil, nil, nil, 300, 5, 6) --开启TCP保活,防止长时间无数据交互被运营商断线
while true do
local succ, result = socket.connect(netc, server_ip, server_port)
if not succ then
log.info("未知错误,5秒后重连")
else
local result, msg = sys.waitUntil("socket_disconnect")
end
log.info("服务器断开了,5秒后重连")
socket.close(netc)
log.info(rtos.meminfo("sys"))
sys.wait(5000)
end
end
local function UDPTask()
local netc = socket.create(nil, netCB)
socket.debug(netc, true)
socket.config(netc, nil, true, nil, 300, 5, 6) --开启TCP保活,防止长时间无数据交互被运营商断线
while true do
local succ, result = socket.connect(netc, server_ip, UDP_port)
if not succ then
log.info("未知错误,5秒后重连")
else
local result, msg = sys.waitUntil("socket_disconnect")
end
log.info("服务器断开了,5秒后重连")
socket.close(netc)
log.info(rtos.meminfo("sys"))
sys.wait(5000)
end
end
local function SSLTask()
local netc = socket.create(nil, netCB)
socket.debug(netc, true)
socket.config(netc, nil, nil, true, 300, 5, 6) --开启TCP保活,防止长时间无数据交互被运营商断线
while true do
local succ, result = socket.connect(netc, server_ip, ssl_port)
if not succ then
log.info("未知错误,5秒后重连")
else
local result, msg = sys.waitUntil("socket_disconnect")
end
log.info("服务器断开了,5秒后重连")
socket.close(netc)
log.info(rtos.meminfo("sys"))
sys.wait(5000)
end
end
function socketDemo()
mobile.rtime(1)
sys.taskInit(socketTask)
end
function UDPDemo()
mobile.rtime(1)
sys.taskInit(UDPTask)
end
function SSLDemo()
mobile.rtime(1)
sys.taskInit(SSLTask)
end 在此代码中加入一个可以连续输出温度的代码 | 5434ebd75ee4790398efa5a799b8e5a0 | {
"intermediate": 0.3164314031600952,
"beginner": 0.48459726572036743,
"expert": 0.19897130131721497
} |
16,933 | local server_ip = "112.125.89.8"
local server_port = 43531
local UDP_port = 37834
local ssl_port = 35528
local rxbuf = zbuff.create(8192)
local function netCB(netc, event, param)
if param ~= 0 then
sys.publish("socket_disconnect")
return
end
if event == socket.LINK then
elseif event == socket.ON_LINE then
socket.tx(netc, "hello,luatos!")
elseif event == socket.EVENT then
socket.rx(netc, rxbuf)
socket.wait(netc)
if rxbuf:used() > 0 then
log.info("收到", rxbuf:toStr(0,rxbuf:used()):toHex())
log.info("发送", rxbuf:used(), "bytes")
socket.tx(netc, rxbuf)
end
rxbuf:del()
elseif event == socket.TX_OK then
socket.wait(netc)
log.info("发送完成")
elseif event == socket.CLOSE then
sys.publish("socket_disconnect")
end
end
local function socketTask()
local netc = socket.create(nil, netCB)
socket.debug(netc, true)
socket.config(netc, nil, nil, nil, 300, 5, 6) --开启TCP保活,防止长时间无数据交互被运营商断线
while true do
local succ, result = socket.connect(netc, server_ip, server_port)
if not succ then
log.info("未知错误,5秒后重连")
else
local result, msg = sys.waitUntil("socket_disconnect")
end
log.info("服务器断开了,5秒后重连")
socket.close(netc)
log.info(rtos.meminfo("sys"))
sys.wait(5000)
end
end
local function UDPTask()
local netc = socket.create(nil, netCB)
socket.debug(netc, true)
socket.config(netc, nil, true, nil, 300, 5, 6) --开启TCP保活,防止长时间无数据交互被运营商断线
while true do
local succ, result = socket.connect(netc, server_ip, UDP_port)
if not succ then
log.info("未知错误,5秒后重连")
else
local result, msg = sys.waitUntil("socket_disconnect")
end
log.info("服务器断开了,5秒后重连")
socket.close(netc)
log.info(rtos.meminfo("sys"))
sys.wait(5000)
end
end
local function SSLTask()
local netc = socket.create(nil, netCB)
socket.debug(netc, true)
socket.config(netc, nil, nil, true, 300, 5, 6) --开启TCP保活,防止长时间无数据交互被运营商断线
while true do
local succ, result = socket.connect(netc, server_ip, ssl_port)
if not succ then
log.info("未知错误,5秒后重连")
else
local result, msg = sys.waitUntil("socket_disconnect")
end
log.info("服务器断开了,5秒后重连")
socket.close(netc)
log.info(rtos.meminfo("sys"))
sys.wait(5000)
end
end
function socketDemo()
mobile.rtime(1)
sys.taskInit(socketTask)
end
function UDPDemo()
mobile.rtime(1)
sys.taskInit(UDPTask)
end
function SSLDemo()
mobile.rtime(1)
sys.taskInit(SSLTask)
end 在此代码中添加一段代码,使其连接后输出随机温度值 | 5bdbcb43f53ffb3971960c654bf1a567 | {
"intermediate": 0.3164314031600952,
"beginner": 0.48459726572036743,
"expert": 0.19897130131721497
} |
16,934 | <script setup>
import { defineProps, ref } from 'vue';
import { useRouter } from 'vue-router';
import axios from 'axios';
import Cookies from 'js-cookie';
const my_token = Cookies.get('token')
const columns = [
{
name: 'projectCode',
required: true,
label: 'Lot号',
align: 'left',
field: 'projectCode',
},
{ name: 'productName', align: 'center', label: '调整时间', field: 'productName' },
]
const tab = ref('ResetRecord')
const router = useRouter();
const props = defineProps({
productID: {
type: String,
required: true
}
})
//获取上级信息
const last_data = ref();
axios.get = ("http://192.168.1.8:8006/indDevelopProduct/" + props.productID + "?access_token=" + my_token).then(res=>{
console.log(res.data.data)
})
</script>这段代码有什么问题 | 2138aa4de71196e3924daa88b26a8ba0 | {
"intermediate": 0.4815833270549774,
"beginner": 0.29491257667541504,
"expert": 0.22350406646728516
} |
16,935 | Hi | 32d8391dda404da44113c0f8f03b59c6 | {
"intermediate": 0.33010533452033997,
"beginner": 0.26984941959381104,
"expert": 0.400045245885849
} |
16,936 | In a c++ wxwidget application, I have this custom class:
#ifndef GRIDSTRINGTABLEGAMES_H
#define GRIDSTRINGTABLEGAMES_H
#include “Game.h”
#include “CompletionStatus.h”
#include <wx/grid.h>
#include <wx/arrstr.h>
class GridStringTableGames : public wxGridStringTable
{
public:
GridStringTableGames(int cols);
GridStringTableGames(const std::vector<Game>& g, int cols);
virtual ~GridStringTableGames();
int GetNumberRows() override;
int GetNumberCols() override;
wxString GetValue(int row, int col) override;
void SetValue(int row, int col, const wxString& value) override;
wxString GetColLabelValue(int col) override;
std::vector<Game> GetGames();
void SetGames(std::vector<Game> games);
Game GetGame(int position);
void SetGame(int position, Game game);
private:
wxString GetCompletionStatusString(CompletionStatus status);
CompletionStatus GetCompletionStatusFromString(wxString status);
int GetIntFromString(wxString value);
std::vector<Game> games;
int columns;
};
#endif // GRIDSTRINGTABLEGAMES_H
#include “GridStringTableGames.h”
GridStringTableGames::GridStringTableGames(int cols) : GridStringTableGames(std::vector<Game>(), cols)
{
}
GridStringTableGames::GridStringTableGames(const std::vector<Game>& g, int cols) : games(g), columns(cols)
{
}
GridStringTableGames::~GridStringTableGames()
{
}
int GridStringTableGames::GetNumberRows()
{
return games.size();
}
int GridStringTableGames::GetNumberCols()
{
return columns;
}
wxString GridStringTableGames::GetValue(int row, int col)
{
switch (col)
{
case 0: return games[row].GetName();
case 1: return games[row].GetSystem();
case 2: return games[row].GetGenre();
case 3: return GetCompletionStatusString(games[row].GetCompletetionStatus());
case 4: return wxString(std::to_string(games[row].GetFinishYear()));
case 5: return wxString(std::to_string(games[row].GetStartYear()));
default: return “”;
}
}
void GridStringTableGames::SetValue(int row, int col, const wxString& value)
{
switch (col)
{
case 0: games[row].SetName(value); break;
case 1: games[row].SetSystem(value); break;
case 2: games[row].SetGenre(value); break;
case 3: games[row].SetCompletetionStatus(GetCompletionStatusFromString(value)); break;
case 4: games[row].SetFinishYear(GetIntFromString(value)); break;
case 5: games[row].SetStartYear(GetIntFromString(value)); break;
}
}
wxString GridStringTableGames::GetColLabelValue(int col)
{
switch (col)
{
case 0: return “Name”;
case 1: return “System”;
case 2: return “Genre”;
case 3: return “Completion Status”;
case 4: return “Finish Year”;
case 5: return “Start Year”;
default: return “”;
}
}
void GridStringTableGames::SetGames(std::vector<Game> g)
{
games = g;
}
std::vector<Game> GridStringTableGames::GetGames()
{
return games;
}
Game GridStringTableGames::GetGame(int position)
{
return games[position];
}
void GridStringTableGames::SetGame(int position, Game game)
{
games[position] = game;
}
wxString GridStringTableGames::GetCompletionStatusString(CompletionStatus status)
{
switch (status)
{
case CompletionStatus::Unplayed: return “Unplayed”;
case CompletionStatus::Playing: return “Playing”;
case CompletionStatus::Completed: return “Completed”;
case CompletionStatus::Played: return “Played”;
case CompletionStatus::OnHold: return “OnHold”;
case CompletionStatus::Dropped: return “Dropped”;
default: return “”;
}
}
CompletionStatus GridStringTableGames::GetCompletionStatusFromString(wxString status)
{
if (status == “Unplayed”)
{
return CompletionStatus::Unplayed;
}
else if (status == “Playing”)
{
return CompletionStatus::Playing;
}
else if (status == “Completed”)
{
return CompletionStatus::Completed;
}
else if (status == “Played”)
{
return CompletionStatus::Played;
}
else if (status == “OnHold”)
{
return CompletionStatus::OnHold;
}
else if (status == “Dropped”)
{
return CompletionStatus::Dropped;
}
else
{
return CompletionStatus::Unplayed;
}
}
int GridStringTableGames::GetIntFromString(wxString value)
{
long l = 0;
value.ToLong(&l);
return static_cast<int>(l);
}
and it is giving me an error in the frame, when assigning the table:
gridGames->SetTable(table, true);
the error it gives is Process terminated with status -1073740940 (0 minute(s), 1 second(s))
and debugging shows an error inside the OnPaint method:
void wxGrid::DrawRowLabel( wxDC& dc, int row )
{
if ( GetRowHeight(row) <= 0 || m_rowLabelWidth <= 0 )
return;
wxGridCellAttrProvider * const
attrProvider = m_table ? m_table->GetAttrProvider() : NULL;
// notice that an explicit static_cast is needed to avoid a compilation
// error with VC7.1 which, for some reason, tries to instantiate (abstract)
// wxGridRowHeaderRenderer class without it
const wxGridRowHeaderRenderer&
rend = attrProvider ? attrProvider->GetRowHeaderRenderer(row) : static_cast<const wxGridRowHeaderRenderer&>(gs_defaultHeaderRenderers.rowRenderer); <-- ERROR
…
}
The call stack is this:
#0 0x6cfd76cb wxGrid::DrawRowLabel(this=0x29b5230, dc=…, row=0) (…/…/src/generic/grid.cpp:6740)
#1 0x6cfd7632 wxGrid::DrawRowLabels(this=0x29b5230, dc=…, rows=…) (…/…/src/generic/grid.cpp:6724)
#2 0x6cfc7afd wxGridRowLabelWindow::OnPaint(this=0x29b5a50) (…/…/src/generic/grid.cpp:2002)
#3 0x698c3946 wxAppConsoleBase::HandleEvent (this=0x2993490, handler=0x29b5a50, func=(void (wxEvtHandler::*)(wxEvtHandler * const, wxEvent &) (…/…/src/common/appbase.cpp:657)
#4 0x698c39c7 wxAppConsoleBase::CallEventHandler(this=0x2993490, handler=0x29b5a50, functor=…, event=…) (…/…/src/common/appbase.cpp:669)
#5 0x6999a7d2 wxEvtHandler::ProcessEventIfMatchesId(entry=…, handler=0x29b5a50, event=…) (…/…/src/common/event.cpp:1425)
#6 0x69999655 wxEventHashTable::HandleEvent(this=0x6d4bb8c0 <wxGridRowLabelWindow::sm_eventHashTable>, event=…, self=0x29b5a50) (…/…/src/common/event.cpp:1033)
#7 0x6999ac8a wxEvtHandler::TryHereOnly(this=0x29b5a50, event=…) (…/…/src/common/event.cpp:1622) | 3b90f0bae19d2ec441f382ae32bba608 | {
"intermediate": 0.3820652663707733,
"beginner": 0.40339136123657227,
"expert": 0.21454337239265442
} |
16,937 | pcap/pcap.h: No such file or directory | 80317de208e308878bcdad5c1a894a11 | {
"intermediate": 0.3017744719982147,
"beginner": 0.386860728263855,
"expert": 0.3113648295402527
} |
16,938 | I want to send data to my server by Arduino mega 2560 serial interface with ESP 8266 temprature data please write the code | e668a7ac7a9a888a0cb1dbb2708fb80a | {
"intermediate": 0.5288248658180237,
"beginner": 0.1647549718618393,
"expert": 0.3064201772212982
} |
16,939 | Summarize how to use Sqlite via Java. | 1ff3ba8b27f38d48e227ef3c6d426a5b | {
"intermediate": 0.836829662322998,
"beginner": 0.08516333997249603,
"expert": 0.07800692319869995
} |
16,940 | write an article on beginning PHP programming | 51a5c64740225c6ca4f3a55d2b18dfda | {
"intermediate": 0.2175227552652359,
"beginner": 0.6487597227096558,
"expert": 0.13371749222278595
} |
16,941 | openOrders: Record<string, Record<string, AccountOpenOrder>>;
export interface AccountOpenOrder {
apiKeyId: string;
apiKeyName: string;
id: string;
symbol: string;
type: string;
price: number;
quantity: number;
side: string;
status: string;
}
создай такой обхект где будет 3 ордера с ценой от 29140 до 29230 символ BTCUSDT | 57a567973cbfa0f7c2546f77b0aaadf2 | {
"intermediate": 0.4179459512233734,
"beginner": 0.30100324749946594,
"expert": 0.28105080127716064
} |
16,942 | I am getting a Type mismatch error with this code: Sub HighlightIncorrectSeries()
' Define the range to search
Dim rng As Range
Set rng = Range("B3:B1000")
' Get the starting day from cell B3
Dim startDay As String
startDay = Range("B3").Value
' Define the series pattern
Dim seriesPattern As Variant
seriesPattern = Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
' Find the position of the starting day in the series pattern
Dim startDayIndex As Integer
startDayIndex = Application.Match(startDay, seriesPattern, 0)
' Define the expected next day
Dim expectedNextDay As String
' Loop through each cell in the range
Dim cell As Range
For Each cell In rng
' Check if the cell has a value
If Not IsEmpty(cell) Then
' Get the value of the cell
Dim cellValue As String
cellValue = cell.Value
' Get the index of the cell value in the series pattern
Dim cellValueIndex As Integer
cellValueIndex = Application.Match(cellValue, seriesPattern, 0)
' Check if the cell value is equal to the expected next day
If cellValue = expectedNextDay Then
' Reset the expected next day to the next day in the series pattern
expectedNextDay = seriesPattern((cellValueIndex + 1) - 1)
Else
' Highlight the cell in yellow
cell.Interior.Color = RGB(255, 255, 0)
End If
End If
Next cell
End Sub | 8980d223cb335e31e5be19e87498191a | {
"intermediate": 0.3774905204772949,
"beginner": 0.45592451095581055,
"expert": 0.1665850281715393
} |
16,943 | list_for_each_entry用法 | 705b0f469d311597c3a6003f5577bfc4 | {
"intermediate": 0.3507764935493469,
"beginner": 0.24746406078338623,
"expert": 0.4017593562602997
} |
16,944 | Uncaught ReferenceError: proj4 is not defined
at potree.js:71643:2
at potree.js:4:28
at potree.js:5:2如何解决 | 80f5cf2260a678bcc3e1e03f8098878f | {
"intermediate": 0.35259464383125305,
"beginner": 0.38801679015159607,
"expert": 0.2593885660171509
} |
16,945 | How to Get a List of dev.to Posts From the API using login and api key | e33c92dc3cadda56ddbaa8840e4f127c | {
"intermediate": 0.4905630052089691,
"beginner": 0.21996165812015533,
"expert": 0.28947538137435913
} |
16,946 | aarch64-none-linux-gnu-gcc test_get_l4_packet.c -o test_l4
test_get_l4_packet.c:3:10: fatal error: pcap/pcap.h: No such file or directory
3 | #include <pcap/pcap.h>
| ^~~~~~~~~~~~~
compilation terminated. | 9028644da5a842d09b644ebbc1628239 | {
"intermediate": 0.3807589113712311,
"beginner": 0.34429365396499634,
"expert": 0.2749474048614502
} |
16,947 | rust AES/ECB/NoPadding example | dbd514e06494e3cfc2b00036d92e3d0e | {
"intermediate": 0.32035622000694275,
"beginner": 0.40834784507751465,
"expert": 0.2712958753108978
} |
16,948 | 帮我缩减以下英文学术论文:
We optimized the SWDNet by adjusting different parameter values and conducting comparative experiments to determine the optimal values of each parameter under the best performance of the model.
Comparison of Iteration Counts. During the experiment, we alternated between training and testing. We trained the model for 50 epochs and monitored its progress through the training loss curve and performance curve, illustrated in Fig.~\ref{fig4} and Fig.~\ref{fig5}. As the number of training epochs increased, the loss decreased, indicating improved performance of the model with each epoch. The performance curve further demonstrated the above description, showing that at around the 12th epoch, the accuracy and F1 score approached 90\%, after which they tended to stabilize.
The length of the opcode index vector. We conducted a statistical analysis of the opcode lengths among three types of data: small web shell, benign files, and stealth web shells, as shown in Fig.~\ref{fig66}. The opcode lengths of most malware were within 300, while those of nomal files and stealth web shells had longer opcode lengths that were primarily within 1000. Therefore, we experimented with different opcode length thresholds of 500, 800, 1000 and 1200. The results were presented in Fig.~\ref{fig9}, which showed that an opcode length threshold of 1000 yielded superior results in terms of accuracy, Recall, Precision and F1-score values.
The dimensionality of opcode word vector. The embedding layer is a crucial component in converting opcodes into t-dimensional vectors, where the dimensionality of t plays a significant role in the effectiveness of word vectorization and classification results. In our study, we investigated the impact of varying vector dimensions, specifically 50, 100, and 150. Our findings, depicted in Fig.~\ref{fig10}, demonstrated that a vector dimension of 100 yielded the most favorable results. This highlights the importance of selecting an appropriate length for word vectors to ensure optimal feature representation. | 1c2b14021d51403856bcc9fde77bc7b4 | {
"intermediate": 0.1145111471414566,
"beginner": 0.12257993966341019,
"expert": 0.762908935546875
} |
16,949 | <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="viewzjyj">{{ value }}</a> | 5b1d4198c156f4e8f61b717888e3dd00 | {
"intermediate": 0.2911703586578369,
"beginner": 0.3897051215171814,
"expert": 0.3191245496273041
} |
16,950 | java code for 1 min repeated interval duckduckgo search for "cheap cars" and display result as swing newsticker line on top of screen as 5mm text line from left to right | 7bd82c02af466636b1784b0462bfb22a | {
"intermediate": 0.42110973596572876,
"beginner": 0.22747012972831726,
"expert": 0.35142019391059875
} |
16,951 | java code for websearch with duckduckgo with links as results, take care of mimic mozilla agent | 510337009153253c81f1a7d6a649c9b3 | {
"intermediate": 0.6208887100219727,
"beginner": 0.1466466188430786,
"expert": 0.23246468603610992
} |
16,952 | I used your code: def set_stop_loss(symbol, entry_price, mark_price):
mark_price = client.ticker_price(symbol=symbol)
lookback = 1
df = get_klines(symbol, interval, lookback)
# Get the open price of the previous candle
prev_open = float(df.iloc[-2]['Open'])
# Set stop loss price
stop_loss_price = prev_open
if mark_price > entry_price * (1 - 0.002):
stop_loss_price = entry_price * (1 - 0.002)
return stop_loss_price
while True:
lookback = 10080
df = get_klines(symbol, interval, lookback)
if df is not None:
mark_price = client.ticker_price(symbol=symbol)
signals = signal_generator(df)
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} Price:{mark_price} - Signals: {signals}")
if signals == 'buy':
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=0.1)
print("Long order executed!")
mark_price = float(client.ticker_price(symbol=symbol))
stop_loss_price = mark_price - (mark_price * 0.002 * 0.1)
print(f"Stop loss set at: {stop_loss_price}")
try:
client.new_order(
symbol=symbol,
side='SELL',
type='STOP_MARKET',
quantity=0.1,
stopPrice=stop_loss_price
)
print("Stop loss order placed!")
except binance.error.ClientError as e:
print(f"Error placing stop loss order: {e}")
time.sleep(1)
except binance.error.ClientError as e:
print(f"Error executing long order: {e}")
time.sleep(1)
if signals == 'sell':
try:
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=0.1)
print("Short order executed!")
mark_price = float(client.ticker_price(symbol=symbol))
stop_loss_price = mark_price + (mark_price * 0.002 * 0.1)
print(f"Stop loss set at: {stop_loss_price}")
try:
client.new_order(
symbol=symbol,
side='BUY',
type='STOP_MARKET',
quantity=0.1,
stopPrice=stop_loss_price
)
print("Stop loss order placed!")
except binance.error.ClientError as e:
print(f"Error placing stop loss order: {e}")
time.sleep(1)
except binance.error.ClientError as e:
print(f"Error executing short order: {e}")
time.sleep(1)
time.sleep(1)
But it didn't place stop loss order | 60ac98344b4f4a078c4e44cd69b7b708 | {
"intermediate": 0.27090197801589966,
"beginner": 0.5725021958351135,
"expert": 0.15659581124782562
} |
16,953 | What is the error? 2023-08-04, 11:54:29 MSK] {taskinstance.py:1776} ERROR - Task failed with exception
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/operators/python.py", line 175, in execute
return_value = self.execute_callable()
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/operators/python.py", line 192, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/opt/airflow/dags/gs_clients_lists.py", line 219, in scloud_write_leads
print(data_all[data_all["Номер события"]])
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/core/frame.py", line 3464, in __getitem__
indexer = self.loc._get_listlike_indexer(key, axis=1)[1]
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/core/indexing.py", line 1314, in _get_listlike_indexer
self._validate_read_indexer(keyarr, indexer, axis)
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/core/indexing.py", line 1374, in _validate_read_indexer
raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Int64Index([ 66661, 22, 22, 22, 66661, 22, 66661, 66661,\n 22, 66661,\n ...\n 22, 66661, 777771, 777771, 777771, 22, 777771, 22,\n 777771, 66661],\n dtype='int64', length=460)] are in the [columns]" | c4fa60f1e64d00a5b303f553f955aade | {
"intermediate": 0.5902020335197449,
"beginner": 0.23296673595905304,
"expert": 0.1768312305212021
} |
16,955 | interface Ticker {
price: number;
percent: number;
usdVolume: number;
}
const ticker = useSelector((state: AppState) => state.binanceTicker.futures); //futures: {[key: string]: Ticker}; // 1INCHUSDT: {price: 0.306, percent: -1.671, usdVolume: 25744127.004} //1000FLOKIUSDT: {price: 0.0218, percent: -0.502, usdVolume: 4052385.7154} ....
const [coins, setCoins] = useState<Ticker[]>([]);
useEffect(() => {
const interval = setInterval(() => {
// напиши код для выбора 20 монет с наибольшим usdVolume и его нужно сетать в usestate coins
}, 60000); // 60 000 миллисекунд = 60 секунд
return () => clearInterval(interval); // Очистка интервала при размонтировании компонента
}, [])
потом этот сте | 03b86431ca24c52f8fdc5b7ddea3d810 | {
"intermediate": 0.37274032831192017,
"beginner": 0.3440393805503845,
"expert": 0.28322023153305054
} |
16,956 | interface Ticker {
price: number;
percent: number;
usdVolume: number;
}
const ticker = useSelector((state: AppState) => state.binanceTicker.futures); //futures: {[key: string]: Ticker}; // 1INCHUSDT: {price: 0.306, percent: -1.671, usdVolume: 25744127.004} //1000FLOKIUSDT: {price: 0.0218, percent: -0.502, usdVolume: 4052385.7154} …
const [coins, setCoins] = useState<symbol[]>([]);
useEffect(() => {
const interval = setInterval(() => {
const selectedCoins = Object.values(ticker).sort((a, b) => b.usdVolume - a.usdVolume).slice(0, 20);
setCoins(selectedCoins);
}, 60000); // 60 000 миллисекунд = 60 секунд
return () => clearInterval(interval); // Очистка интервала при размонтировании компонента
}, [])
selectedCoins должен быть массивом symbol осортированных по usdvolume | 95d39975e5ac5622b2431175c8745997 | {
"intermediate": 0.37246832251548767,
"beginner": 0.3395407199859619,
"expert": 0.2879909574985504
} |
16,957 | This document requires 'TrustedScript' assignment.
(анонимный) @ print-preview.bundle.js:15
print-preview.bundle.js:15 The JavaScript Function constructor does not accept TrustedString arguments. See https://github.com/w3c/webappsec-trusted-types/wiki/Trusted-Types-for-function-constructor for more information. | a6d7458ca325ce7b1bcc0547026f3856 | {
"intermediate": 0.26583513617515564,
"beginner": 0.549534261226654,
"expert": 0.18463057279586792
} |
16,958 | When I create a python project in pycharm, it creates with it a virtual environment. How to use pip such that it installs in that virtual environment instead of using the global environment? | a073ed783e31f9584b5187a7c2f2d729 | {
"intermediate": 0.5487760305404663,
"beginner": 0.20240455865859985,
"expert": 0.24881938099861145
} |
16,959 | const BinanceLive = () => {
const [symbols, setSymbols] = useState<{symbol: string, price: number}[]>([]);
const ticker = useSelector((state: AppState) => state.binanceTicker.futures);
useEffect(() => {
if (symbols.length > 0) return;
const fetchData = () => {
const selectedCoins = Object.keys(ticker).sort((a, b) => ticker[b].usdVolume - ticker[a].usdVolume).slice(0, 15);
const symbolsWithPrices = selectedCoins.map((symbol) => ({
symbol,
price: ticker[symbol].price,
}));
setSymbols(symbolsWithPrices);
};
fetchData();
const interval = setInterval(fetchData, 60);
return () => clearInterval(interval);
}, []);
проблема в том, что при отрисовке компонента срабатывает UseEffect, а ticker еще пустой. Если в зависимости поставить ticker, то useEffect будет срабатывать всегда когда тикер меняется, а мне нужно, чтобы UseEffect сработал как тикер появился, а потом уже работал только setInterval | cdf5db6f5fbf5ac69fbddd38800576b8 | {
"intermediate": 0.40046241879463196,
"beginner": 0.38656219840049744,
"expert": 0.212975412607193
} |
16,960 | Create jest unit tests for the following block of code
/*
Flag setting example:
const featureFlags = window.omnia?.featureFlags ?? {
setFlag: (name, value) => {
featureFlags.flags[name] = value;
featureFlags.flagChangeListeners?.[name]?.(value)
},
flagChangeListeners: {},
flags: {}
}
window.omnia = {
...window.omnia ?? {},
featureFlags
}
window.omnia.featureFlags.setFlag('newFeatureFlag', true);
*/
const featureFlag = <T>(key: string, defaultValue: T) => {
const getValue = () => {
if (typeof window === 'undefined' || !window.omnia?.featureFlags)
return undefined;
const { flags } = window.omnia.featureFlags;
if (!(key in flags)) flags[key] = defaultValue;
return flags[key] as T;
};
const setListener = (listener: (value: T) => void) => {
if (!window.omnia?.featureFlags)
throw new Error('Failed to set a feature flag listener.');
window.omnia.featureFlags.flagChangeListeners[key] = listener;
};
const removeListener = () => {
if (!window.omnia?.featureFlags)
throw new Error('Failed to remove a feature flag listener.');
delete window.omnia.featureFlags.flagChangeListeners[key];
};
return {
getValue,
setListener,
removeListener,
};
};
export default featureFlag; | 4db32d37be94ce2f20504e46824d9952 | {
"intermediate": 0.3281068205833435,
"beginner": 0.4165153205394745,
"expert": 0.2553778290748596
} |
16,961 | I used your code: while True:
lookback = 10080
df = get_klines(symbol, interval, lookback)
if df is not None:
signals = signal_generator(df)
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signals: {signals}")
mark_price = client.ticker_price(symbol=symbol)
if signals == 'buy':
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=0.1)
print("Long order executed!")
stop_loss_price = mark_price - (mark_price * 0.002)
print(f"Stop loss set at: {stop_loss_price}")
try:
client.new_order(
symbol=symbol,
side='SELL',
type='STOP_MARKET',
quantity=0.1,
stopPrice=stop_loss_price
)
print("Stop loss order placed!")
except binance.error.ClientError as e:
print(f"Error placing stop loss order: {e}")
time.sleep(1)
except binance.error.ClientError as e:
print(f"Error executing long order: {e}")
time.sleep(1)
if signals == 'sell':
try:
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=0.1)
print("Short order executed!")
stop_loss_price = mark_price + (mark_price * 0.002)
print(f"Stop loss set at: {stop_loss_price}")
try:
client.new_order(
symbol=symbol,
side='BUY',
type='STOP_MARKET',
quantity=0.1,
stopPrice=stop_loss_price
)
print("Stop loss order placed!")
except binance.error.ClientError as e:
print(f"Error placing stop loss order: {e}")
time.sleep(1)
except binance.error.ClientError as e:
print(f"Error executing short order: {e}")
time.sleep(1)
time.sleep(1)
But it still doesn;t place stop loss order | bc194f978f9846c52cb3a248ebcc8bcc | {
"intermediate": 0.2939588725566864,
"beginner": 0.45267781615257263,
"expert": 0.2533632516860962
} |
16,962 | Uncaught TypeError: THREE.OrbitControls is not a constructor
at qiehuan.js:78:17
(anonymous) @ qiehuan.js:78
怎么解决 | 38c8e6dda875c409bc989f1481980338 | {
"intermediate": 0.359446257352829,
"beginner": 0.3650481402873993,
"expert": 0.27550560235977173
} |
16,963 | {coin.map((symbol, index) => {
const replacedSymbol = symbol.symbol.replace("USDT", "").replace("BUSD", "").replace("BTC", "");
console.log(replacedSymbol);
return <div key={index} style={{minWidth: 80 + (((replacedSymbol.length * 5) + (${symbol.price}.length) * 12))}}>
<BinanceLiveCoin key={index} symbol={symbol.symbol.toLocaleLowerCase()} name={replacedSymbol} />
</div>;
}
)}
replace по BTC должен быть только если в слове больше 3 символов | 30c998126e472723551f7423c17e4e59 | {
"intermediate": 0.30800774693489075,
"beginner": 0.4105382263660431,
"expert": 0.28145402669906616
} |
16,964 | I have this code: while True:
lookback = 10080
df = get_klines(symbol, interval, lookback)
if df is not None:
signals = signal_generator(df)
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signals: {signals}")
mark_price = client.ticker_price(symbol=symbol)
if signals == 'buy':
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=0.1)
print("Long order executed!")
stop_loss_price = mark_price - (mark_price * 0.002)
print(f"Stop loss set at: {stop_loss_price}")
try:
client.new_order(
symbol=symbol,
side='SELL',
type='STOP_MARKET',
quantity=0.1,
stopPrice=stop_loss_price
)
print("Stop loss order placed!")
except binance.error.ClientError as e:
print(f"Error placing stop loss order: {e}")
time.sleep(1)
except binance.error.ClientError as e:
print(f"Error executing long order: {e}")
time.sleep(1)
if signals == 'sell':
try:
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=0.1)
print("Short order executed!")
stop_loss_price = mark_price + (mark_price * 0.002)
print(f"Stop loss set at: {stop_loss_price}")
try:
client.new_order(
symbol=symbol,
side='BUY',
type='STOP_MARKET',
quantity=0.1,
stopPrice=stop_loss_price
)
print("Stop loss order placed!")
except binance.error.ClientError as e:
print(f"Error placing stop loss order: {e}")
time.sleep(1)
except binance.error.ClientError as e:
print(f"Error executing short order: {e}")
time.sleep(1)
time.sleep(1)
But it didn't place stop loss order , and Tell me please how does working stop loss system in this code ? | d1031fb49535737a4c08f19023f42e79 | {
"intermediate": 0.2569917142391205,
"beginner": 0.5195460915565491,
"expert": 0.22346222400665283
} |
16,965 | I am having problems writing a VBA code so I need your help building it up in stages.
The first stage is described as below:
Range B3:B1000 is mostly made up of empty cells.
Some of the cells in the range contain a text value that are part of a repeating pattern as you move down the range.
The revolving repeating pattern of values is ‘Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday’.
B3 always has a text value of one of the values in the repeating series.
The code must first check the value in B3, identify the position of the value in the repeating series and then search for the next cell with a value and determine if the next cell is the expected next value in the series.
The code must ignore all empty cells and continue the series pattern check until it gets to B1000 then it should stop the loop.
If the code finds a next cell with a value and the expected value does not match the expected value in the pattern of the series, then the cell should be highlighted Yellow.
Can you please write a VBA code to do this using this concept in the code to determine the next expected value.
If current cell value is "Monday" then next cell value is "Tuesday"
If current cell value is "Tuesday" then next cell value is "Wednesday"
If current cell value is "Wednesday" then next cell value is "Thursday"
If current cell value is "Thursday" then next cell value is "Friday"
If current cell value is "Friday" then next cell value is "Saturday"
If current cell value is "Saturday" then next cell value is "Sunday"
If current cell value is "Sunday" then next cell value is "Monday" | e22061f3d99452d51d86a78d60f12b74 | {
"intermediate": 0.3596740663051605,
"beginner": 0.2932824194431305,
"expert": 0.3470434844493866
} |
16,966 | Uncaught SyntaxError: Cannot use import statement outside a module | 87f3b4fe55cb41e6af466c1531ff094d | {
"intermediate": 0.29423701763153076,
"beginner": 0.5093165636062622,
"expert": 0.19644644856452942
} |
16,967 | Fix this roblox code | eb4be612a3912070c1181d10f233795d | {
"intermediate": 0.2557418942451477,
"beginner": 0.5643897652626038,
"expert": 0.17986831068992615
} |
16,968 | In golang, write a hello world qndroid app | 14b7bc65d6f56dfcb3a0e6369d958b06 | {
"intermediate": 0.43842312693595886,
"beginner": 0.24577799439430237,
"expert": 0.31579893827438354
} |
16,969 | мне нужно сделать такой же класс только без провала квеста и чтобы не было дублежа кода так как мне нужно использовать этот и новый класс
public class VehicleStartState : IPayloadState<IQuest>
{
private readonly SessionQuestStateMachine stateMachine;
private readonly FatalFailureConditionHandler fatalFailureConditionHandler;
private readonly CompletionConditionHandler completionConditionHandler;
private readonly IPublisher publisher;
private List<IFailureCondition> conditionsForStartingCar;
private IQuest quest;
[Inject]
private StatisticsProvider statisticsProvider;
[Inject]
private User user;
public VehicleStartState(
SessionQuestStateMachine stateMachine,
FatalFailureConditionHandler fatalFailureConditionHandler,
CompletionConditionHandler completionConditionHandler,
IPublisher publisher)
{
this.stateMachine = stateMachine;
this.fatalFailureConditionHandler = fatalFailureConditionHandler;
this.completionConditionHandler = completionConditionHandler;
this.publisher = publisher;
}
public void Enter(IQuest quest)
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.InProgress);
Debug.Log($"Ожидание запуска двигателя автомобиля");
this.quest = quest;
var completionConditions = quest.IsCarNeedReadyToMove
? new List<ICompletionCondition>() { new CarIsReadyToMove() }
: new List<ICompletionCondition>();
conditionsForStartingCar = new List<IFailureCondition>
{
new DrivingWithoutSeatBelt(),
new LowBeamHeadlightsNotIncluded(),
new GearboxIsNotInNeutralPosition()
};
fatalFailureConditionHandler.Start(conditionsForStartingCar, CompleteQuestWithFailure);
completionConditionHandler.Start(completionConditions, CompleteQuestWithSuccess);
}
private void CompleteQuestWithFailure()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Failed);
Debug.Log($"Квест завершен неудачей");
publisher.Publish(new QuestWithFailureMessage());
stateMachine.Enter<OutputOfQuestResultsState, IQuest>(quest);
}
private void CompleteQuestWithSuccess()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Completed);
switch (quest)
{
case QuestComposite quest:
stateMachine.Enter<StartCompositeQuestState, QuestComposite>(quest);
break;
case Quest quest:
stateMachine.Enter<StartQuestState, IQuest>(quest);
break;
default:
break;
}
}
public void Exit()
{
fatalFailureConditionHandler.Stop();
completionConditionHandler.Stop();
}
} | 9da095d96bd8c8e715f88ae6c79f1fd2 | {
"intermediate": 0.3464662730693817,
"beginner": 0.5324995517730713,
"expert": 0.12103425711393356
} |
16,970 | jak naprawić ten błąd: package command-line-arguments
imports github.com/golang/sys
imports github.com/golang/sys: import cycle not allowed | 6ca2b50274d7174993e4b0668ea7a8d4 | {
"intermediate": 0.3399808406829834,
"beginner": 0.4588424265384674,
"expert": 0.20117676258087158
} |
16,971 | помоги с этим классом, мне нужно сделать точно такой же класс только без провала квеста и я бы хотел избежать дуближа кода так как мне нужно использовать этот и новый класс
public class VehicleStartState : IPayloadState<IQuest>
{
private readonly SessionQuestStateMachine stateMachine;
private readonly FatalFailureConditionHandler fatalFailureConditionHandler;
private readonly CompletionConditionHandler completionConditionHandler;
private readonly IPublisher publisher;
private List<IFailureCondition> conditionsForStartingCar;
private IQuest quest;
[Inject]
private StatisticsProvider statisticsProvider;
[Inject]
private User user;
public VehicleStartState(
SessionQuestStateMachine stateMachine,
FatalFailureConditionHandler fatalFailureConditionHandler,
CompletionConditionHandler completionConditionHandler,
IPublisher publisher)
{
this.stateMachine = stateMachine;
this.fatalFailureConditionHandler = fatalFailureConditionHandler;
this.completionConditionHandler = completionConditionHandler;
this.publisher = publisher;
}
public void Enter(IQuest quest)
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.InProgress);
Debug.Log($"Ожидание запуска двигателя автомобиля");
this.quest = quest;
var completionConditions = quest.IsCarNeedReadyToMove
? new List<ICompletionCondition>() { new CarIsReadyToMove() }
: new List<ICompletionCondition>();
conditionsForStartingCar = new List<IFailureCondition>
{
new DrivingWithoutSeatBelt(),
new LowBeamHeadlightsNotIncluded(),
new GearboxIsNotInNeutralPosition()
};
fatalFailureConditionHandler.Start(conditionsForStartingCar, CompleteQuestWithFailure);
completionConditionHandler.Start(completionConditions, CompleteQuestWithSuccess);
}
private void CompleteQuestWithFailure()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Failed);
Debug.Log($"Квест завершен неудачей");
publisher.Publish(new QuestWithFailureMessage());
stateMachine.Enter<OutputOfQuestResultsState, IQuest>(quest);
}
private void CompleteQuestWithSuccess()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Completed);
switch (quest)
{
case QuestComposite quest:
stateMachine.Enter<StartCompositeQuestState, QuestComposite>(quest);
break;
case Quest quest:
stateMachine.Enter<StartQuestState, IQuest>(quest);
break;
default:
break;
}
}
public void Exit()
{
fatalFailureConditionHandler.Stop();
completionConditionHandler.Stop();
}
} | 0af6f1a73c2b186a64dd90f8a522774d | {
"intermediate": 0.379519522190094,
"beginner": 0.5064369440078735,
"expert": 0.11404355615377426
} |
16,972 | Make an android qpp in react native that checks and asks for vpn permissions on startup | e095c659ea9d32c18924c7486119db30 | {
"intermediate": 0.5831978917121887,
"beginner": 0.1500125676393509,
"expert": 0.2667895555496216
} |
16,973 | помоги с этим классом, мне нужно сделать точно такой же класс только без провала квеста и я бы хотел избежать дуближа кода так как мне нужно использовать этот и новый класс
public class VehicleStartState : IPayloadState<IQuest>
{
public void Enter(IQuest quest)
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.InProgress);
Debug.Log($"Ожидание запуска двигателя автомобиля");
this.quest = quest;
var completionConditions = quest.IsCarNeedReadyToMove
? new List<ICompletionCondition>() { new CarIsReadyToMove() }
: new List<ICompletionCondition>();
conditionsForStartingCar = new List<IFailureCondition>
{
new DrivingWithoutSeatBelt(),
new LowBeamHeadlightsNotIncluded(),
new GearboxIsNotInNeutralPosition()
};
fatalFailureConditionHandler.Start(conditionsForStartingCar, CompleteQuestWithFailure);
completionConditionHandler.Start(completionConditions, CompleteQuestWithSuccess);
}
private void CompleteQuestWithFailure()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Failed);
Debug.Log($"Квест завершен неудачей");
publisher.Publish(new QuestWithFailureMessage());
stateMachine.Enter<OutputOfQuestResultsState, IQuest>(quest);
}
private void CompleteQuestWithSuccess()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Completed);
switch (quest)
{
case QuestComposite quest:
stateMachine.Enter<StartCompositeQuestState, QuestComposite>(quest);
break;
case Quest quest:
stateMachine.Enter<StartQuestState, IQuest>(quest);
break;
default:
break;
}
}
} | 1c3333a84a7ca70765f2e67e67e4633c | {
"intermediate": 0.35961654782295227,
"beginner": 0.5780841708183289,
"expert": 0.06229927018284798
} |
16,974 | помоги с этим классом, мне нужно сделать точно такой же класс только без провала квеста и я бы хотел избежать дуближа кода так как мне нужно использовать этот и новый класс
public class VehicleStartState : IPayloadState<IQuest>
{
public void Enter(IQuest quest)
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.InProgress);
Debug.Log($"Ожидание запуска двигателя автомобиля");
this.quest = quest;
var completionConditions = quest.IsCarNeedReadyToMove
? new List<ICompletionCondition>() { new CarIsReadyToMove() }
: new List<ICompletionCondition>();
conditionsForStartingCar = new List<IFailureCondition>
{
new DrivingWithoutSeatBelt(),
new LowBeamHeadlightsNotIncluded(),
new GearboxIsNotInNeutralPosition()
};
fatalFailureConditionHandler.Start(conditionsForStartingCar, CompleteQuestWithFailure);
completionConditionHandler.Start(completionConditions, CompleteQuestWithSuccess);
}
private void CompleteQuestWithFailure()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Failed);
Debug.Log($"Квест завершен неудачей");
publisher.Publish(new QuestWithFailureMessage());
stateMachine.Enter<OutputOfQuestResultsState, IQuest>(quest);
}
private void CompleteQuestWithSuccess()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Completed);
switch (quest)
{
case QuestComposite quest:
stateMachine.Enter<StartCompositeQuestState, QuestComposite>(quest);
break;
case Quest quest:
stateMachine.Enter<StartQuestState, IQuest>(quest);
break;
default:
break;
}
}
} | 950193029d203506811ed74aaab877b5 | {
"intermediate": 0.37996187806129456,
"beginner": 0.5191139578819275,
"expert": 0.10092417895793915
} |
16,975 | помоги с этим классом, мне нужно сделать точно такой же класс только без провала квеста и я бы хотел избежать дуближа кода так как мне нужно использовать этот и новый класс
public class VehicleStartState : IPayloadState<IQuest>
{
public void Enter(IQuest quest)
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.InProgress);
var completionConditions = quest.IsCarNeedReadyToMove
? new List<ICompletionCondition>() { new CarIsReadyToMove() }
: new List<ICompletionCondition>();
conditionsForStartingCar = new List<IFailureCondition>
{
new DrivingWithoutSeatBelt(),
new LowBeamHeadlightsNotIncluded(),
new GearboxIsNotInNeutralPosition()
};
fatalFailureConditionHandler.Start(conditionsForStartingCar, CompleteQuestWithFailure);
completionConditionHandler.Start(completionConditions, CompleteQuestWithSuccess);
}
private void CompleteQuestWithFailure()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Failed);
publisher.Publish(new QuestWithFailureMessage());
stateMachine.Enter<OutputOfQuestResultsState, IQuest>(quest);
}
private void CompleteQuestWithSuccess()
{
SessionResultsPuller.SetQuestResult(statisticsProvider, user, QuestResultType.Completed);
switch (quest)
{
case QuestComposite quest:
stateMachine.Enter<StartCompositeQuestState, QuestComposite>(quest);
break;
case Quest quest:
stateMachine.Enter<StartQuestState, IQuest>(quest);
break;
}
}
} | e3006865b0c71a28469d53aa184d67a9 | {
"intermediate": 0.3376302123069763,
"beginner": 0.40348416566848755,
"expert": 0.2588856816291809
} |
16,976 | import random
import fractions
import math
from sympy import *
def generator_random_point():
random_point = random.randint(1, 10)
return random_point
"Задача № 13274"
def derivative_of_tangent_in_random_point():
random_point = generator_random_point()
x = Symbol('x')
expr = (1 + (tan(2*x))**2)**3
prime = expr.diff(x)
result = simplify(prime)
answer = result.subs(x, pi/random_point)
task = f'Вычислите: \(diff_{expr}; x={pi/random_point}\)'
return answer, task Что делает данный код? | c4537cedb853b635baf69198cdc104c4 | {
"intermediate": 0.33573418855667114,
"beginner": 0.46918773651123047,
"expert": 0.19507811963558197
} |
16,977 | как сделать все по центру и опустить кнопку чуть ниже от message
<body>
<div class="app">
<main class="main">
<h1>Ошибка</h1>
<p class="shop-error">${message}</p>
<a href="${backUrl}" class="ui-btn ui-btn--primary"
data-ripple>Перевести еще раз</a>
</main>
</div>
</body> | dfdf0849910dcf754aeb7015abf1441e | {
"intermediate": 0.3008051812648773,
"beginner": 0.44185420870780945,
"expert": 0.25734058022499084
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.