row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
21,802 | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Spawns spawnCount (e.g., 40) objects within the Random.Range(-spawnRange, spawnRange)
/// and sets their localScale to Vector3.one * Random.Range(scaleMin, scaleMax).
/// You can also add a random Y rotation if you want, so they aren't all oriented the
/// same way.
/// Note that this is attached to the same GameObject multiple times!
/// </summary>
public class SpawnWorldObjects : MonoBehaviour
{
[Header("Inscribed")]
[Tooltip("The number of these objects to spawn")]
public int spawnCount = 40;
[Tooltip( "The maximum x, y, & z position for spawned GameObjects" )]
public Vector3 spawnRangeMax = new Vector3( 512, 0, 512 );
[Tooltip( "The minimum x, y, & z position for spawned GameObjects" )]
public Vector3 spawnRangeMin = new Vector3( -512, 0, -512 );
[Tooltip( "The maximum uniform localScale for spawned GameObjects" )]
public float scaleMax = 80;
[Tooltip("The minimum uniform localScale for spawned GameObjects")]
public float scaleMin = 20;
[Tooltip( "The List of prefabs that can be spawned by this script" )]
public List<GameObject> prefabs;
// Start is called before the first frame update
void Start() {
// for i from =0 to <spawnCount
for ( i = 0; i <spawnCount; i++)
{
// Instantiate a random GameObject gObj from the prefabs List
// Set x, y, and z values of a Vector3 pos from spawnRange values
// Set the position of gObj to pos
// Set the localScale of gObj to be betweeb scaleMin and scaleMax
}
}
}
Fill out the code for the comments under the start function in this script | 24d72209208ff480654fd29dc3fa7c9f | {
"intermediate": 0.40959835052490234,
"beginner": 0.31860390305519104,
"expert": 0.271797776222229
} |
21,803 | puzzle = [
[1,None,1,0,None,None],
[0,None,0,0,1,1],
[1,0,0,1,0,1],
[0,None,None,1,None,None],
[0,0,None,1,None,None],
[1,1,0,None,0,0]
]
judge if there are three consecutive zeros or ones in a row or column | 29389710a74b38733efecb6c2e7aa81a | {
"intermediate": 0.3604293763637543,
"beginner": 0.2972765564918518,
"expert": 0.3422940969467163
} |
21,804 | // Get value of the Horizontal Input axis
// Create a float boostU local variable to hold the amount of boost that should
// be applied right now.
// Set boostU to (time since lastBoostTime) / boostDuration so that the boost
// lasts boostDuration seconds.
// Clamp that boostU value so that it never goes above 1
Fill out the code for these comments | a1e1bd671af0ff897125c78c17931937 | {
"intermediate": 0.25675374269485474,
"beginner": 0.4769991934299469,
"expert": 0.26624706387519836
} |
21,805 | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Spawns spawnCount (e.g., 40) objects within the Random.Range(-spawnRange, spawnRange)
/// and sets their localScale to Vector3.one * Random.Range(scaleMin, scaleMax).
/// You can also add a random Y rotation if you want, so they aren't all oriented the
/// same way.
/// Note that this is attached to the same GameObject multiple times!
/// </summary>
public class SpawnWorldObjects : MonoBehaviour
{
[Header("Inscribed")]
[Tooltip("The number of these objects to spawn")]
public int spawnCount = 40;
[Tooltip( "The maximum x, y, & z position for spawned GameObjects" )]
public Vector3 spawnRangeMax = new Vector3( 512, 0, 512 );
[Tooltip( "The minimum x, y, & z position for spawned GameObjects" )]
public Vector3 spawnRangeMin = new Vector3( -512, 0, -512 );
[Tooltip( "The maximum uniform localScale for spawned GameObjects" )]
public float scaleMax = 80;
[Tooltip("The minimum uniform localScale for spawned GameObjects")]
public float scaleMin = 20;
[Tooltip( "The List of prefabs that can be spawned by this script" )]
public List<GameObject> prefabs;
// Start is called before the first frame update
void Start() {
// for i from =0 to <spawnCount
for ( i = 0; i <spawnCount; i++)
{
// Instantiate a random GameObject gObj from the prefabs List
GameObject gObj = Instantiate(prefabs[Random.Range(0, prefabs.Count)]);
// Set x, y, and z values of a Vector3 pos from spawnRange values
float x = Random.Range(spawnRangeMin.x, spawnRangeMax.x);
float y = Random.Range(spawnRangeMin.y, spawnRangeMax.y);
float z = Random.Range(spawnRangeMin.z, spawnRangeMax.z);
// Set the position of gObj to pos
gObj.transform.position = pos;
// Set the localScale of gObj to be betweeb scaleMin and scaleMax
float scale = Random.Range(scaleMin, scaleMax);
gObj.transform.localScale = Vector3.one * scale;
}
}
}
Compiler Error in unity (Assets\__Scripts\SpawnWorldObjects.cs(31,15): error CS0103: The name 'i' does not exist in the current context) | ef061ff50b1f79f952450fcf9266a9c5 | {
"intermediate": 0.4267408549785614,
"beginner": 0.3225327134132385,
"expert": 0.2507264018058777
} |
21,806 | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Spawns spawnCount (e.g., 40) objects within the Random.Range(-spawnRange, spawnRange)
/// and sets their localScale to Vector3.one * Random.Range(scaleMin, scaleMax).
/// You can also add a random Y rotation if you want, so they aren't all oriented the
/// same way.
/// Note that this is attached to the same GameObject multiple times!
/// </summary>
public class SpawnWorldObjects : MonoBehaviour
{
[Header("Inscribed")]
[Tooltip("The number of these objects to spawn")]
public int spawnCount = 40;
[Tooltip( "The maximum x, y, & z position for spawned GameObjects" )]
public Vector3 spawnRangeMax = new Vector3( 512, 0, 512 );
[Tooltip( "The minimum x, y, & z position for spawned GameObjects" )]
public Vector3 spawnRangeMin = new Vector3( -512, 0, -512 );
[Tooltip( "The maximum uniform localScale for spawned GameObjects" )]
public float scaleMax = 80;
[Tooltip("The minimum uniform localScale for spawned GameObjects")]
public float scaleMin = 20;
[Tooltip( "The List of prefabs that can be spawned by this script" )]
public List<GameObject> prefabs;
// Start is called before the first frame update
void Start() {
// for i from =0 to <spawnCount
for ( int i = 0; i <spawnCount; i++)
{
// Instantiate a random GameObject gObj from the prefabs List
GameObject gObj = Instantiate(prefabs[Random.Range(0, prefabs.Count)]);
// Set x, y, and z values of a Vector3 pos from spawnRange values
float x = Random.Range(spawnRangeMin.x, spawnRangeMax.x);
float y = Random.Range(spawnRangeMin.y, spawnRangeMax.y);
float z = Random.Range(spawnRangeMin.z, spawnRangeMax.z);
// Set the position of gObj to pos
gObj.transform.position = pos;
// Set the localScale of gObj to be betweeb scaleMin and scaleMax
float scale = Random.Range(scaleMin, scaleMax);
gObj.transform.localScale = Vector3.one * scale;
}
}
}
Compiler error in unity editor (Assets\__Scripts\SpawnWorldObjects.cs(40,39): error CS0103: The name 'pos' does not exist in the current context) | e8d341d99b2834a81d94fe685c6b1c1b | {
"intermediate": 0.4398339092731476,
"beginner": 0.3302810788154602,
"expert": 0.22988495230674744
} |
21,807 | I want random messages to appear on place of this "xXx" randomly that indicaing AI model progress in calculation and functioning description. is it possible for these and more messages to appear while in processing or this progressbar is active through some small random timeouts but with small fixed time initial time within message length? also need to make sure that previous message got removed.: setTimeout(() => {
const startTime = Date.now();
const timeLeft = Math.floor(estimatedTime / 1000);
progressBarFilled.style.background = 'linear-gradient(90deg, rgba(1,1,48,0.9) 25%, rgba(0,14,255,0.65) 35%, rgba(0,126,255,0.9) 40%, rgba(1,1,48,1) 45%, rgba(1,1,48,1) 55%, rgba(0,126,255,0.9) 60%, rgba(0,14,255,0.65) 65%, rgba(1,1,48,0.9) 75%)';
progressBarFilled.style.backgroundSize = "100%, 10px";
progressBarFilled.style.backgroundPosition = 'center';
const doneSpanElem=document.createElement("span");
doneSpanElem.innerText="xXx";
doneSpanElem.style.fontSize="14px";
doneSpanElem.style.fontWeight="bold";
doneSpanElem.style.letterSpacing="2px";
// Apply styles to center text horizontally
doneSpanElem.style.position= "absolute";
doneSpanElem.style.left= "50%";
doneSpanElem.style.top= "50%";
doneSpanElem.style.transform= "translate(-50%, -50%)";
// Add Done! element as child of progress bar
progressBarFilled.appendChild(doneSpanElem);
//Remove processing text
const processingTextNode=document.querySelector('.progress-bar .processing-text')
if (processingTextNode) {
progressBarFilled.removeChild(processingTextNode)
}
const interval = setInterval(function() {
if (isGenerating) {
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
const progress = Math.floor((elapsedTime / timeLeft) * 1000);
progressBarFilled.style.width = progress + '%';
}
}, 1000); | 42f0bf4d645606bce12ffdee7130afa0 | {
"intermediate": 0.3826029598712921,
"beginner": 0.19265039265155792,
"expert": 0.42474663257598877
} |
21,808 | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Manages the BoostSlider. This should connect to the Slider component and set
/// its value based on PlaneControls.BOOST_RECHARGE_U.
/// You should also set the color of the slider based on its value.
/// </summary>
[RequireComponent(typeof(Slider))]
[DisallowMultipleComponent]
public class BoostSlider : MonoBehaviour
{
[Header("Inscribed")]
public Color rechargeColor = Color.red;
public Color readyColor = Color.green;
public Image fillImage;
Slider slid;
void Start()
{
// Set slid to the Slider component attached to this GameObject
slid = GetComponent<Slider>();
}
void FixedUpdate()
{
// Set slid.value to PlaneControls.BOOST_RECHARGE_U
slid.value = PlaneControls.BOOST_RECHARGE_U;
// Set fillImage.color to readyColor if BOOST_RECHARGE_U == 1
// Otherwise, set fillImage.color to rechargeColor
// Try using a "ternary operator": e.g., bool b = (u==1) ? true : false;
fillImage.color = (PlaneControls.BOOST_RECHARGE_U == 1) ? readyColor : rechargeColor;
}
}
Why is the boost bar not filling up? | 5743b07185ea97cd8d08ddba240e6f85 | {
"intermediate": 0.6261369585990906,
"beginner": 0.20484836399555206,
"expert": 0.16901467740535736
} |
21,809 | Vue 3 GoogleLogin component styling | d5b54cb24510932601cb7207a1b14973 | {
"intermediate": 0.38621869683265686,
"beginner": 0.23205356299877167,
"expert": 0.3817276954650879
} |
21,810 | setup() {
const app = initializeApp(this.firebaseConfig);
const db = getFirestore(app);
return {
db
}
},
methods:
{
// Get a list of cities from your database
getCities: async function () {
const citiesCol = collection(this.db, ‘cities’);
const citySnapshot = await getDocs(citiesCol);
const cityList = citySnapshot.docs.map(doc => doc.data());
return cityList;
},
}
Is the above code right?
Is it possible to use the const variable `db` returned from the `setup()` as `this.db` in `getCities()` function of the `methods`?
I don't need code. Explain more details. | a3aabc54a3313e694cb8082e41d36b47 | {
"intermediate": 0.4307360053062439,
"beginner": 0.4271802008152008,
"expert": 0.1420838087797165
} |
21,811 | I want random messages to appear on place of this "xXx" randomly that indicaing AI model progress in calculation and functioning description. is it possible for these and more messages to appear while in processing or this progressbar is active through some small random timeouts but with small fixed time initial time within message length? also need to make sure that previous message got removed.: setTimeout(() => {
const startTime = Date.now();
const timeLeft = Math.floor(estimatedTime / 1000);
progressBarFilled.style.background = 'linear-gradient(90deg, rgba(1,1,48,0.9) 25%, rgba(0,14,255,0.65) 35%, rgba(0,126,255,0.9) 40%, rgba(1,1,48,1) 45%, rgba(1,1,48,1) 55%, rgba(0,126,255,0.9) 60%, rgba(0,14,255,0.65) 65%, rgba(1,1,48,0.9) 75%)';
progressBarFilled.style.backgroundSize = "100%, 10px";
progressBarFilled.style.backgroundPosition = 'center';
const doneSpanElem=document.createElement("span");
doneSpanElem.innerText="xXx";
doneSpanElem.style.fontSize="14px";
doneSpanElem.style.fontWeight="bold";
doneSpanElem.style.letterSpacing="2px";
// Apply styles to center text horizontally
doneSpanElem.style.position= "absolute";
doneSpanElem.style.left= "50%";
doneSpanElem.style.top= "50%";
doneSpanElem.style.transform= "translate(-50%, -50%)";
// Add Done! element as child of progress bar
progressBarFilled.appendChild(doneSpanElem);
//Remove processing text
const processingTextNode=document.querySelector('.progress-bar .processing-text')
if (processingTextNode) {
progressBarFilled.removeChild(processingTextNode)
}
const interval = setInterval(function() {
if (isGenerating) {
const elapsedTime = Math.floor((Date.now() - startTime) / 1000);
const progress = Math.floor((elapsedTime / timeLeft) * 1000);
progressBarFilled.style.width = progress + '%';
}
}, 1000); | 8979084aa961fb6feea504c7ea46bd3f | {
"intermediate": 0.3826029598712921,
"beginner": 0.19265039265155792,
"expert": 0.42474663257598877
} |
21,812 | Разработай библиотеку, работающей с множествами, на языке Python, не используя стандартный класс, с комментариями в коде | f65516e8526fd126eb3cd6ab8405f174 | {
"intermediate": 0.3506816029548645,
"beginner": 0.23934471607208252,
"expert": 0.40997371077537537
} |
21,813 | How to disable calico from automatically generating host routes | 04fd69cd4a322e793bf7ffad9a63e5e2 | {
"intermediate": 0.36762604117393494,
"beginner": 0.1789320558309555,
"expert": 0.45344194769859314
} |
21,814 | python报错TypeError: Population must be a sequence. For dicts or sets, use sorted(d).如何解决 | 04b8dd992cc66c483a6eff4735fdc2bb | {
"intermediate": 0.3353501260280609,
"beginner": 0.4326046407222748,
"expert": 0.23204518854618073
} |
21,815 | The bridge does not send ping relay to the interface under the bridge | 7b48faa81ba34c1b5dc6354f09eabd2a | {
"intermediate": 0.3671666383743286,
"beginner": 0.2679552435874939,
"expert": 0.3648781478404999
} |
21,816 | GENERAL ARRANGEMENT DRAWINGS OF DOOR NO. EMF-R-0001 (14M*15M)
FOR MOTORIZED SLIDING DOOR
P.O. NO. BSE-EMF-GOV-PO-0009
DUMMY P.O. NO. EMCI-956-12-A009-DA
NMR 601
what's meaning in Chinese | 0ff9abc4f4fb0f2008ddf4218c9461ca | {
"intermediate": 0.30963924527168274,
"beginner": 0.27118009328842163,
"expert": 0.41918063163757324
} |
21,817 | Put the packets of the specific network card IP into the specified nfqueue | 67cf6a87874f5dbe00a9225f342bf392 | {
"intermediate": 0.3234759271144867,
"beginner": 0.24538381397724152,
"expert": 0.4311402440071106
} |
21,818 | var = "01234567" what python statement would print out only the odd elements? | 27b413eda092ddcaebdfa14741098f60 | {
"intermediate": 0.1713305562734604,
"beginner": 0.6614823341369629,
"expert": 0.16718712449073792
} |
21,819 | for n in range(0,2):print(file.readline()), what would File1 output | b6ab1a2e055c1e3da0fd07fa772364de | {
"intermediate": 0.17369957268238068,
"beginner": 0.7210029363632202,
"expert": 0.10529746860265732
} |
21,820 | A container class is a data type that is capable of holding a collection of items and provides
functions to access them. Bag is an example of a container class. It is an unordered collection of
items that may have duplicates.
In this assignment, you are asked to design and develop an abstract Bag class, called
BagInterface, with the following fixed collection of operations:
Insert an item of any type into a bag
Query the bag contents: two queries
Is an item in the bag?
How many copies of an item is in the bag?
Remove an item from the bag
clear the bag
Get the size of the bag
How many items are there in the bag?
Check if the bag is empty
Check if the bag is full
Assume the bag capacity is 20
In addition to BagInterface, you are asked to implement two classes of bag
implementations: PlainBag and MagicChangeBag.
PlainBag is a simple container that holds items of any type using an array implementation.
MagicChangeBag is also very similar to PlainBag, with two exceptions. When an item is inserted into a magic change bag, it’ll magically disappear, and bag looks empty. Whenever a remove operation is invoked, all the items, except the one is removed will appear. | 453e69d9781f3a536f228e90e86a4042 | {
"intermediate": 0.2834409773349762,
"beginner": 0.5632179975509644,
"expert": 0.15334101021289825
} |
21,821 | TypeError: 'int' object is not iterable如上是在pycharm中运行python文件报错,如何解决 | 8239009e653d9ad0dfb7f71ce2723e44 | {
"intermediate": 0.34809747338294983,
"beginner": 0.35219496488571167,
"expert": 0.2997076213359833
} |
21,822 | Traceback (most recent call last):
File “C:\Users\umbrella\PycharmProjects\pythonProject1\bilstm_for_validation.py”, line 209, in <module>
for key in random.sample(train_data.keys(), int(parameters[‘Sample_num’])):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\umbrella\anaconda3\envs\py3115\Lib\random.py”, line 439, in sample
raise TypeError("Population must be a sequence. “
TypeError: Population must be a sequence. For dicts or sets, use sorted(d).以上是报错内容,以下是代码,如何修改?total_loss = 0.
for epoch in range(int(parameters[‘EPOCH’])):
total_loss = train_loop(train_dataloader, model=calibration_model, optimizer=optimizer, epoch=epoch, total_loss=total_loss, loss_fn=loss_fn)
print(“epoch:”, epoch, " loss:”, total_loss/((epoch + 1) * len(train_dataloader)), flush=True)
# Start predicting
mse_list = []
# in_threshold = out_threshold = 0
TP = FP = FN = TN = count = 0
# ave_mse = {}
calibration_model.eval()
sum_mse = 0
for key in random.sample(train_data.keys(), int(parameters[‘Sample_num’])):
current_train_data = train_data[key]
test_x = []
test_y = []
for i in range(int(parameters[‘Step_num’]) - window_size):
current_x = []
for j in range(i, i + window_size):
current_x.extend(current_train_data[‘data’][j])
current_y = current_train_data[‘data’][i + window_size]
test_x.append(current_x)
test_y.append(current_y)
input_x = torch.tensor(test_x, dtype=torch.float32).reshape(int(parameters[‘Step_num’]) - window_size, window_size, lstm_config.input_size)
predict = calibration_model(input_x)
predict_y = predict.tolist()
for i in range(len(test_y)):
for j in range(len(test_y[i])):
sum_mse += (test_y[i][j] - predict_y[i][j]) ** 2 | e5b9cabb5497b453c5d4769723229851 | {
"intermediate": 0.3708413541316986,
"beginner": 0.35871782898902893,
"expert": 0.27044084668159485
} |
21,823 | This assignment will help you get practice with:
Abstract Data Types
Inheritance
Polymorphism
C++ pointers
C++ Classes
C++ virtual and pure virtual functions
C++ Class Templates
C++ Arrays
Task:
A container class is a data type that is capable of holding a collection of items and provides
functions to access them. Bag is an example of a container class. It is an unordered collection of
items that may have duplicates.
In this assignment, you are asked to design and develop an abstract Bag class, called
BagInterface, with the following fixed collection of operations:
Insert an item of any type into a bag
Query the bag contents: two queries
Is an item in the bag?
How many copies of an item is in the bag?
Remove an item from the bag
clear the bag
Get the size of the bag
How many items are there in the bag?
Check if the bag is empty
Check if the bag is full
Assume the bag capacity is 20
In addition to BagInterface, you are asked to implement two classes of bag
implementations: PlainBag and MagicChangeBag.
PlainBag is a simple container that holds items of any type using an array implementation.
MagicChangeBag is also very similar to PlainBag, with two exceptions. When an item is inserted into a magic change bag, it’ll magically disappear, and bag looks empty. Whenever a remove operation is invoked, all the items, except the one is removed will appear.
do this question in C++ and in 3 different files. BagInterface.h
PlainBag.h and PlaingBag.cpp
MagicChangeBag.h and MagicChangeBag.cpp | f4d11f84c4979c705a039b99e4cb80c2 | {
"intermediate": 0.37432703375816345,
"beginner": 0.37310704588890076,
"expert": 0.2525658905506134
} |
21,824 | unsched_pk<-TRUE
if(unsched_pk){
# assume ADA and nab unscheduled are not relevant
unsched_data<-pk_frame5 %>%
filter(rowid %in% round(runif(sample(c(1,2),1),min=1,max=bign6),0)) %>%
rename(temp_final_dt=final_dt)
unsched_data<-unsched_data%>%
mutate(
final_dt=as.POSIXct(ifelse(
PSCHHOUR>0|PSCHMIN>0 & PSCHDAY!=1,
ifelse(
is.na(last_finaldt),
temp_final_dt %m+% days(-2),
(4*as.numeric(temp_final_dt)+as.numeric(last_finaldt))/5
),
ifelse(
is.na(next_finaldt),
temp_final_dt %m+% days(2),
(4*as.numeric(temp_final_dt)+as.numeric(next_finaldt))/5
)
), origin="1970-01-01", tz="UTC"),
VISITTYP=2
#2=Unscheduled
) %>%
select(-temp_final_dt)
# pk_frame6<-rbind(pk_frame5,unsched_data)
} how to fix this code | fe016908f6927401d6419365dc64f625 | {
"intermediate": 0.4968584477901459,
"beginner": 0.27047231793403625,
"expert": 0.23266921937465668
} |
21,825 | Is pd.datetime.now() - train.Date_time_of_event correct statement in Python | 32d3a8327035c054bf4ffd9b1b855e7d | {
"intermediate": 0.3426443338394165,
"beginner": 0.17915035784244537,
"expert": 0.4782053530216217
} |
21,826 | pyton как разделить вывод команды subprocess.check_output(['nmcli', '-f', 'SSID,SECURITY', 'device', 'wifi']) на две переменных, в одной содержится ssid а в другой security | 92c7a91ed7da30b9b39b83c691cea714 | {
"intermediate": 0.3451939821243286,
"beginner": 0.3761393427848816,
"expert": 0.278666615486145
} |
21,827 | class Connection extends DataSource_1.DataSource {
^
TypeError: Class extends value undefined is not a constructor or null | 5981b085e1126f0ee8aecc1a854b8616 | {
"intermediate": 0.34135866165161133,
"beginner": 0.492838978767395,
"expert": 0.16580237448215485
} |
21,828 | Do StarTech docks tend to successfully transfer S.M.A.R.T. data of drives that are docked? | 7bb3d57c793d5d427429d57f6bafe3e6 | {
"intermediate": 0.4070458710193634,
"beginner": 0.24754753708839417,
"expert": 0.3454066812992096
} |
21,829 | I have a column
column = [[481448145555, 601148145555, 481460114444, 601160114444, 541160114444, 531154115555, 481453113333, 531148144444, 601153113333, 601060100000],[601060100000,481448145555, 601148145555, 481460114444, 601160114444, 541160114444, 531154115555, 481453113333, 531148144444, 601153113333]]
I need to get new columns where each values is splitted by four digits. And the new list conatins only 10 elements. So I need
column = [[4814, 4814, 5555, 6011, 4814, 5555, 4814, 6011, 4444, 6011],[6010, 6010, 0000, 4814, 4814, 5555, 6011, 4814, 5555, 4814]]
Provide a Python script | 6178b1f118fa0089a3460fc5f69983f1 | {
"intermediate": 0.3733283281326294,
"beginner": 0.3761771619319916,
"expert": 0.25049448013305664
} |
21,830 | if there are severals records, how to generate one record , the visit_date based on original records date +2 day or -2day , and the proschday !=1 | d5c62f7b4baf799ae9d225fc3be0364e | {
"intermediate": 0.3877609372138977,
"beginner": 0.15993720293045044,
"expert": 0.4523018002510071
} |
21,831 | import {TradeItem} from “…/…/…/store/orderClusterSlice”;
import {OrderFeedProps} from “./OrderFeed.props”;
у меня в проекте идет отрисовка через canvasRef.current?.getContext("2d"); CanvasRenderingContext2D, нужно сделать отрисовку более производительнее на WebGL
какая из библиотек на react будет самая быстрая и произвожительная
const OrderFeed = ({workerRef, symbol, settings}: OrderFeedProps) => {
const cupParams = useSelector((state: AppState) => state.cupSlice);
const [dpiScale, setDpiScale] = useState(Math.ceil(window.devicePixelRatio));
const [canvasSize, setCanvasSize] = useState<CanvasSize>({height: 0, width: 0});
const containerRef = useRef<HTMLDivElement|null>(null);
const canvasRef = useRef<HTMLCanvasElement|null>(null);
const theme = useTheme();
const draw = (trades: TradeItem[], camera: number) => {
if (null === canvasRef || !Array.isArray(trades)) return;
const context = canvasRef.current?.getContext(“2d”);
if (context) {
orderFeedDrawer.clear(context, canvasSize);
orderFeedDrawer.drawLine(
context,
canvasSize,
trades,
camera,
cupParams.aggregatedPriceStep,
cupParams.cellHeight,
cupParams.quantityDivider,
!settings.minQuantity ? 0 : parseFloat(settings.minQuantity),
dpiScale,
theme,
);
orderFeedDrawer.drawChain(
context,
canvasSize,
trades,
camera,
cupParams.aggregatedPriceStep,
cupParams.cellHeight,
cupParams.quantityDivider,
cupParams.priceDivider,
!settings.minQuantity ? 0 : parseFloat(settings.minQuantity),
dpiScale,
theme,
settings.volumeAsDollars,
);
}
};
useEffect(() => {
if (!workerRef.current) return;
draw(event.data.trades, event.data.camera)
}, [workerRef.current, canvasRef.current, canvasSize, symbol
]);
return <Box ref={containerRef} className={${styles.canvasWrapper} scroll-block}>
<canvas
ref={canvasRef}
className={styles.canvas}
width={canvasSize?.width}
height={canvasSize?.height}
/>
</Box>;
};
export default OrderFeed;
const orderFeedDrawer = {
clear: (ctx: WebGLRenderingContext, size: CanvasSize) => {
ctx.clearRect(0, 0, size.width, size.height);
},
drawLine: (
ctx: CanvasRenderingContext2D,
canvasSize: CanvasSize,
trades: TradeItem[],
camera: number,
aggregatedPriceStep: number,
cupCellHeight: number,
quantityDivider: number,
minQuantity: number,
dpiScale: number,
theme: Theme,
) => {
let startX = canvasSize.width - 10 * dpiScale;
const fullHeightRowsCount = parseInt((canvasSize.height / cupCellHeight).toFixed(0));
const startY = (fullHeightRowsCount % 2 ? fullHeightRowsCount - 1 : fullHeightRowsCount) / 2 * cupCellHeight;
const halfCupCellHeight = cupCellHeight / 2;
ctx.beginPath();
ctx.strokeStyle = orderFeedOptions(theme).line.color;
ctx.lineWidth = (dpiScale) => 2 * dpiScale;
trades.forEach(trade => {
const yModifier = (trade.price - (trade.price - (trade?.secondPrice || trade.price)) / 2 - camera) / aggregatedPriceStep * cupCellHeight + halfCupCellHeight;
const width = 1.75 * clamp((trade.quantity / quantityDivider < minQuantity ? 0 : trade.radius), 5, 50) * dpiScale;
ctx.lineTo(startX - width / 2, startY - yModifier);
startX = startX - width;
});
ctx.stroke();
},
какие есть варианты библиотеки? | 81462583627e654b472c05edded483c2 | {
"intermediate": 0.3148425221443176,
"beginner": 0.5543992519378662,
"expert": 0.1307581663131714
} |
21,832 | I'm using write.xlsx command from openxlsx package in R. My data contains NA values and when I open the xlsx file on Excel, those NA-s are replaced with #NUM!. But I need them to be empty cells. Any solution to the problem? | c4f8af76d37bd194739dc9fecb828a02 | {
"intermediate": 0.6006287336349487,
"beginner": 0.1691528558731079,
"expert": 0.2302183359861374
} |
21,833 | give a inheritance java code that relates to the is-a relationship with three subclasses | b035b095815ba9409a18dd8101c31522 | {
"intermediate": 0.3028663992881775,
"beginner": 0.4623326063156128,
"expert": 0.23480099439620972
} |
21,834 | import {TradeItem} from “…/…/…/store/orderClusterSlice”;
import {OrderFeedProps} from “./OrderFeed.props”;
const OrderFeed = ({workerRef, symbol, settings}: OrderFeedProps) => {
const cupParams = useSelector((state: AppState) => state.cupSlice);
const [dpiScale, setDpiScale] = useState(Math.ceil(window.devicePixelRatio));
const [canvasSize, setCanvasSize] = useState<CanvasSize>({height: 0, width: 0});
const containerRef = useRef<HTMLDivElement|null>(null);
const canvasRef = useRef<HTMLCanvasElement|null>(null);
const theme = useTheme();
const draw = (trades: TradeItem[], camera: number) => {
if (null === canvasRef || !Array.isArray(trades)) return;
const context = canvasRef.current?.getContext(“2d”);
if (context) {
orderFeedDrawer.clear(context, canvasSize);
orderFeedDrawer.drawLine(
context,
canvasSize,
trades,
camera,
cupParams.aggregatedPriceStep,
cupParams.cellHeight,
cupParams.quantityDivider,
!settings.minQuantity ? 0 : parseFloat(settings.minQuantity),
dpiScale,
theme,
);
orderFeedDrawer.drawChain(
context,
canvasSize,
trades,
camera,
cupParams.aggregatedPriceStep,
cupParams.cellHeight,
cupParams.quantityDivider,
cupParams.priceDivider,
!settings.minQuantity ? 0 : parseFloat(settings.minQuantity),
dpiScale,
theme,
settings.volumeAsDollars,
);
}
};
useEffect(() => {
if (!workerRef.current) return;
draw(event.data.trades, event.data.camera)
}, [workerRef.current, canvasRef.current, canvasSize, symbol
]);
return <Box ref={containerRef} className={${styles.canvasWrapper} scroll-block}>
<canvas
ref={canvasRef}
className={styles.canvas}
width={canvasSize?.width}
height={canvasSize?.height}
/>
</Box>;
};
export default OrderFeed;
const orderFeedDrawer = {
clear: (ctx: WebGLRenderingContext, size: CanvasSize) => {
ctx.clearRect(0, 0, size.width, size.height);
},
drawLine: (
ctx: CanvasRenderingContext2D,
canvasSize: CanvasSize,
trades: TradeItem[],
camera: number,
aggregatedPriceStep: number,
cupCellHeight: number,
quantityDivider: number,
minQuantity: number,
dpiScale: number,
theme: Theme,
) => {
let startX = canvasSize.width - 10 * dpiScale;
const fullHeightRowsCount = parseInt((canvasSize.height / cupCellHeight).toFixed(0));
const startY = (fullHeightRowsCount % 2 ? fullHeightRowsCount - 1 : fullHeightRowsCount) / 2 * cupCellHeight;
const halfCupCellHeight = cupCellHeight / 2;
ctx.beginPath();
ctx.strokeStyle = orderFeedOptions(theme).line.color;
ctx.lineWidth = (dpiScale) => 2 * dpiScale;
trades.forEach(trade => {
const yModifier = (trade.price - (trade.price - (trade?.secondPrice || trade.price)) / 2 - camera) / aggregatedPriceStep * cupCellHeight + halfCupCellHeight;
const width = 1.75 * clamp((trade.quantity / quantityDivider < minQuantity ? 0 : trade.radius), 5, 50) * dpiScale;
ctx.lineTo(startX - width / 2, startY - yModifier);
startX = startX - width;
});
ctx.stroke();
},
полностью напиши функцию orderFeedDrawer и OrderFeed на библиотеку regl | 811a576bde07754ae56b921c83fe3188 | {
"intermediate": 0.36546725034713745,
"beginner": 0.453662633895874,
"expert": 0.18087011575698853
} |
21,835 | Please give me a link that i can use to generate GEFCO order tracking link by pasting tracking number and zip code | 16bd2b8be0c8486cf5340c7235f36bcc | {
"intermediate": 0.4968016445636749,
"beginner": 0.18057262897491455,
"expert": 0.32262569665908813
} |
21,836 | I have a powerbi line chart visualization that displays three distinct lines (years 2020, 2021, 2022). The visualization uses only one measure. I want to color code the lines as follows 2020 - blue, 2021 - red, 2022 -black. Now when user selects years 2021, 2022, 2023 I want the visualization to show colors as 2021 - blue, 2022 - red, 2023 - black. Same logic if user selects years 2022 (blue), 2023 (red), 2024 (black). How do I accomplish this automated color coding? | fb31d9872038296a9afbb2cc8e4e48d7 | {
"intermediate": 0.4290136396884918,
"beginner": 0.20578759908676147,
"expert": 0.3651987612247467
} |
21,837 | if dat <- (2021-10-25 06:01:00) how to calculate the dat+2 or dat-2 in R | 4c525e0d0e11fe74ef631d6d7f2a6f4c | {
"intermediate": 0.4119161069393158,
"beginner": 0.15181449055671692,
"expert": 0.4362694323062897
} |
21,838 | This assignment will help you get practice with:
Abstract Data Types
Inheritance
Polymorphism
C++ pointers
C++ Classes
C++ virtual and pure virtual functions
C++ Class Templates
C++ Arrays
Task:
A container class is a data type that is capable of holding a collection of items and provides
functions to access them. Bag is an example of a container class. It is an unordered collection of
items that may have duplicates.
In this assignment, you are asked to design and develop an abstract Bag class, called
BagInterface, with the following fixed collection of operations:
Insert an item of any type into a bag(use void insert and I don't need the frequency)
Query the bag contents: two queries
Is an item in the bag?
How many copies of an item is in the bag?
Remove an item from the bag
clear the bag
Get the size of the bag
How many items are there in the bag?
Check if the bag is empty
Check if the bag is full
Assume the bag capacity is 20
In addition to BagInterface, you are asked to implement two classes of bag
implementations: PlainBag and MagicChangeBag.
PlainBag is a simple container that holds items of any type using an array implementation.
MagicChangeBag is also very similar to PlainBag, with two exceptions. When an item is inserted into a magic change bag, it’ll magically disappear, and bag looks empty. Whenever a remove operation is invoked, all the items, except the one is removed will appear. answer in 3 files. BagInterface.h
PlainBag.h and PlaingBag.cpp
MagicChangeBag.h and MagicChangeBag.cpp | cc554f6b88cd34bee202d2962a5e78f2 | {
"intermediate": 0.37046101689338684,
"beginner": 0.41742390394210815,
"expert": 0.2121151238679886
} |
21,839 | if it is non setup vue component in vue 3 project, how can I get changing of store using watch features of vue3 framework. | a2f3efa83527556ee803687ce8b6bb6e | {
"intermediate": 0.8203456401824951,
"beginner": 0.11199264973402023,
"expert": 0.06766175478696823
} |
21,840 | My Btrfs device just died, and I was never notified of any malfunctioning before it died (by the Xfce GUI, at least). Why not? I'm using Debian. Was could I have been on the lookout for using the CLI to try to determine that the drive was going to die before it died? (Imagine no access to S.M.A.R.T. data. If there was access to S.M.A.R.T. data, would Debian have notified me via the Xfce GUI by default (in Debian)?) | d65d122065bcbc01cf5d017c0c158d33 | {
"intermediate": 0.616439700126648,
"beginner": 0.21566949784755707,
"expert": 0.16789086163043976
} |
21,841 | What could be causing this?:
virsh net-start default
error: Failed to start network default
error: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/local/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) unexpected exit status 1: Error: PATH environment variable not set | a95db78467bc4fa44b531e95049dc8cf | {
"intermediate": 0.45844706892967224,
"beginner": 0.39372649788856506,
"expert": 0.14782650768756866
} |
21,842 | async function checkColumnString(elem, string) {
console.log(await registrationsPage.elemsWithValute.getCount())
for (let i=0; i < await registrationsPage.elemsWithValute.getCount(); i++) {
console.log(String(await $$(elem)[i].getText()))
console.log((String(await $$(elem)[i].getText()).includes(string)))
if (!(String(await $$(elem)[i].getText())) == string) {
return false
}
}
return true
} почему функция при if == true не возвращает false | 5bcebf91f6c64bfe08a718660ede00a9 | {
"intermediate": 0.3408701717853546,
"beginner": 0.45831170678138733,
"expert": 0.20081810653209686
} |
21,843 | how to drop a variable in R | ba111ad7ad077211bbeb2b8086506a94 | {
"intermediate": 0.2984801232814789,
"beginner": 0.4110816717147827,
"expert": 0.290438175201416
} |
21,844 | //получить сенд файл
$send_content = file_get_contents("modules/templates/admin/sendMsg.txt");
if (strlen($send_content) > 0){
$send_action = explode(" ",$send_content);
if (isset($send_action[1])) {
file_put_contents("modules/templates/admin/sendMsg.txt", "");
if($send_action[0] == "send_one"){
$this->DelMessageText(ADMIN_CHAT_ID, $send_action[2]);
$user = R::findOne("users", "id = '{$send_action[1]}'");
file_put_contents("modules/templates/admin/sendMsgTempl.txt",$text);
$template = new Template("admin/sendMsgTempl");
$template = $template->Load();
$template->LoadButtons();
$this->sendMessage($user["chat_id"], $template->text, $template->buttons);
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
return;
} elseif ($send_action[0] == "send_all"){
$this->DelMessageText(ADMIN_CHAT_ID, $send_action[1]);
$users = R::findAll("users");
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
file_put_contents("modules/templates/admin/sendMsgTemplAll.txt",$text);
$template = new Template("admin/sendMsgTemplAll");
$template = $template->Load();
$template->LoadButtons();
foreach ($users as $user) {
$this->sendMessage($user["chat_id"], $template->text, $template->buttons);
}
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено всем пользоваетлям");
return;
}
}
}
switch ($command[0]) {
case "/reply":
file_put_contents("modules/templates/admin/user_voice_reply.txt", "$command[1] $message_id");
$this->sendMessage(ADMIN_CHAT_ID, "Для ответа запишите голосове сообщение");
return;
case "/send_voice":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_voice_reply.txt");
$full = explode(" ", $reply_to);
$this->sendVoice($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
case "/1":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$statuses = R::findAll( 'refbuffer' , ' ORDER BY id ASC ' );
$stats = array();
foreach($statuses as $status){
array_push($stats, $status["buffer"]);
}
$template = new Template("admin/status_stat", [
new TemplateData(":red", $stats[0]),
new TemplateData(":orange", $stats[1]),
new TemplateData(":yellow",$stats[2]),
new TemplateData(":green", $stats[3]),
new TemplateData(":blue", $stats[4]),
new TemplateData(":darkblue", $stats[5]),
new TemplateData(":purple", $stats[6])
]);
$template = $template->Load();
$this->sendMessage(ADMIN_CHAT_ID, $template->text);
return;
case "/aphrodite_morning_process_purchase_success":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$orderId = (int)$command[1];
//$username = $command[3];
$aphroditeMorning = R::findOne("aphroditemorning", "id = $orderId");
if ($aphroditeMorning) {
$aphroditeMorning["status"] = 2;
R::store($aphroditeMorning);
$aphroditeMorningUser = R::findOne("users", "id = {$aphroditeMorning["user_id"]}");
$aphroditeMorningUser["action"] = "";
R::store($aphroditeMorningUser);
$this->DelMessageText($aphroditeMorningUser["chat_id"], $command[2]);
$templateUser = new Template("aphrodite_morning/order_payment_success");
$templateUser = $templateUser->Load();
$this->sendMessage($aphroditeMorningUser["chat_id"], $templateUser->text);
//Создать файл с номерам заказа
file_put_contents("modules/templates/admin/cur_order.txt", "aphr $orderId");
$templateAdmin = new Template("admin/aphrodite_morning/process_purchase_success", [
new TemplateData(":aphroditeMorningId", $aphroditeMorning["id"]),
new TemplateData(":username", $aphroditeMorningUser["username"]),
//new TemplateData(":username", $username)
]);
$templateAdmin = $templateAdmin->Load();
$this->sendPhoto(ADMIN_CHAT_ID,"https://katyasatorinebot.online/bot/{$aphroditeMorning["check_photo"]}", $templateAdmin->text);
//$response = $this->sendMessage(ADMIN_CHAT_ID,$templateAdmin->text);
}
return;
case "/aphrodite_morning_process_purchase_deny":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$orderId = (int)$command[1];
//$username = $command[3];
$aphroditeMorning = R::findOne("aphroditemorning", "id = $orderId");
if ($aphroditeMorning) {
$aphroditeMorning["status"] = 2;
R::store($aphroditeMorning);
$aphroditeMorningUser = R::findOne("users", "id = {$aphroditeMorning["user_id"]}");
$templateUser = new Template("order_payment_deny_utro");
$templateUser = $templateUser->Load();
//$this->DelMessageText($aphroditeMorningUser["chat_id"], $command[2]);
$this->sendMessage($aphroditeMorningUser["chat_id"], $templateUser->text);
$templateAdmin = new Template("admin/aphrodite_morning/process_purchase_deny", [
new TemplateData(":aphroditeMorningId", $aphroditeMorning["id"]),
new TemplateData(":username", $aphroditeMorningUser["username"]),
//new TemplateData(":username", $username)
]);
$templateAdmin = $templateAdmin->Load();
$this->sendMessage(ADMIN_CHAT_ID, $templateAdmin->text);
}
return;
case "/daoss_magick_process_purchase_success":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$orderId = (int)$command[1];
//$username = $command[3];
$daossmagick = R::findOne("daossmagick", "id = $orderId");
if ($daossmagick) {
$daossmagick["status"] = 2;
R::store($daossmagick);
$daossmagickUser = R::findOne("users", "id = {$daossmagick["user_id"]}");
$daossmagickUser["action"] = "";
R::store($daossmagickUser);
$this->DelMessageText($daossmagickUser["chat_id"], $command[2]);
$templateUser = new Template("daoss_magick/order_payment_success");
$templateUser = $templateUser->Load();
$this->sendMessage($daossmagickUser["chat_id"], $templateUser->text);
//Создать файл с номерам заказа
file_put_contents("modules/templates/admin/cur_order.txt", "daoss $orderId");
$templateAdmin = new Template("admin/daoss_magick/process_purchase_success", [
new TemplateData(":daossMagickId", $daossmagick["id"]),
new TemplateData(":username", $daossmagickUser["username"]),
//new TemplateData(":username", $username)
]);
$templateAdmin = $templateAdmin->Load();
$this->sendPhoto(ADMIN_CHAT_ID,"https://katyasatorinebot.online/bot/{$daossmagick["check_photo"]}", $templateAdmin->text);
//$response = $this->sendMessage(ADMIN_CHAT_ID,$templateAdmin->text);
}
return;
case "/daoss_magick_process_purchase_deny":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$orderId = (int)$command[1];
//$username = $command[3];
$daossmagick = R::findOne("daossmagick", "id = $orderId");
if ($daossmagick) {
$daossmagick["status"] = 2;
R::store($daossmagick);
$daossmagickUser = R::findOne("users", "id = {$daossmagick["user_id"]}");
$templateUser = new Template("order_payment_deny_daoss");
$templateUser = $templateUser->Load();
//$this->DelMessageText($daossmagickUser["chat_id"], $command[2]);
$this->sendMessage($daossmagickUser["chat_id"], $templateUser->text);
$templateAdmin = new Template("admin/daoss_magick/process_purchase_deny", [
new TemplateData(":daossMagickId", $daossmagick["id"]),
new TemplateData(":username", $daossmagickUser["username"]),
//new TemplateData(":username", $username)
]);
$templateAdmin = $templateAdmin->Load();
$this->sendMessage(ADMIN_CHAT_ID, $templateAdmin->text);
}
return;
case "/process_purchase_success":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$orderId = (int)$command[1];
$username = $command[2];
$order = R::findOne("orders", "id = $orderId");
if ($order) {
$order["status"] = 2;
R::store($order);
//тот, кто оплатил
$user = R::findOne("users", "id = {$order["user_id"]}");
$user["action"] = "";
R::store($user);
if ($order["marathon_stage"] > 0){
switch ($order["marathon_stage"]) {
case 1:
$templateUser = new Template("order_payment_success", [
new TemplateData(":stage", "/message_18 1"),
]);
break;
case 2:
$templateUser = new Template("order_payment_success", [
new TemplateData(":stage", "/message_19 1"),
]);
break;
case 3:
$templateUser = new Template("order_payment_success", [
new TemplateData(":stage", "/message_20 1"),
]);
break;
}
$templateUser = $templateUser->Load();
$templateUser->LoadButtons();
$this->sendMessage($user["chat_id"], $templateUser->text, $templateUser->buttons);
}
//Создать файл с номерам заказа
file_put_contents("modules/templates/admin/cur_order.txt", "order $orderId");
$templateAdmin = new Template("admin/process_purchase_success", [
new TemplateData(":orderId", $order["id"]),
new TemplateData(":username", $username)
]);
$templateAdmin = $templateAdmin->Load();
$this->sendPhoto(ADMIN_CHAT_ID, "https://katyasatorinebot.online/bot/{$order["check_photo"]}", $templateAdmin->text);
//$response = $this->sendMessage(ADMIN_CHAT_ID, $templateAdmin->text);
}
return;
case "/process_purchase_deny":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$orderId = (int)$command[1];
$username = $command[2];
$order = R::findOne("orders", "id = $orderId");
if ($order) {
$order["status"] = 2;
R::store($order);
$user = R::findOne("users", "id = {$order["user_id"]}");
$templateUser = new Template("order_payment_deny_extaz");
$templateUser = $templateUser->Load();
$this->sendMessage($user["chat_id"], $templateUser->text);
$templateAdmin = new Template("admin/process_purchase_deny", [
new TemplateData(":orderId", $order["id"]),
new TemplateData(":username", $username)
]);
$templateAdmin = $templateAdmin->Load();
$this->sendMessage(ADMIN_CHAT_ID, $templateAdmin->text);
}
return;
case "/send_one":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$response = $this->sendMessage(ADMIN_CHAT_ID, "Введите текст для отправки пользователю");
$send_id = $command[1];
file_put_contents("modules/templates/admin/sendMsg.txt", "send_one {$send_id} {$response["result"]["message_id"]}");
return;
case "/send_all":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$response = $this->sendMessage(ADMIN_CHAT_ID, "Введите текст для рассылки всем пользователям");
file_put_contents("modules/templates/admin/sendMsg.txt", "send_all {$response["result"]["message_id"]}");
return;
case ((bool)preg_match("~^[0-9]+$~", $command[0])):
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$price = $command[0];
$fileOrder = file_get_contents("modules/templates/admin/cur_order.txt");
$orderParams = explode(" ", $fileOrder);
//$orderId = file_get_contents("modules/templates/admin/cur_order.txt");
//$order = R::findOne("orders", "id = $orderId");
$order = "";
switch ($orderParams[0]){
case "aphr":
$order = R::findOne("aphroditemorning", "id = $orderParams[1]");
break;
case "order":
$order = R::findOne("orders", "id = $orderParams[1]");
break;
case "daoss":
$order = R::findOne("daossmagick", "id = $orderParams[1]");
break;
}
$user = R::findOne("users", "id = {$order["user_id"]}");
привет, мне нужно сделать так, чтобы админу отображался юзер, оплативший заказ (айди и ник, если имеется). Это телеграм-бот на пхп | fcf1971a16bb9776562c2535fd7d24d8 | {
"intermediate": 0.41000354290008545,
"beginner": 0.4311460852622986,
"expert": 0.15885034203529358
} |
21,845 | • Install R package carData.
• After attaching package carData (with library("carData")) the data.frame Salaries is available.
• Use R code to solve the following problems (i.e., do not only read the documentation):
4. Create a new data.frame, salaries_f, that only contains the data from the Female professor at a
rank of AssocProf. How many of those are in discipline A, how many in discipline B? | c850807ba53217ba204cc2098cb6cc42 | {
"intermediate": 0.8203513622283936,
"beginner": 0.06457159668207169,
"expert": 0.11507704108953476
} |
21,846 | //получить сенд файл
$send_content = file_get_contents("modules/templates/admin/sendMsg.txt");
if (strlen($send_content) > 0){
$send_action = explode(" ",$send_content);
if (isset($send_action[1])) {
file_put_contents("modules/templates/admin/sendMsg.txt", "");
if($send_action[0] == "send_one"){
$this->DelMessageText(ADMIN_CHAT_ID, $send_action[2]);
$user = R::findOne("users", "id = '{$send_action[1]}'");
file_put_contents("modules/templates/admin/sendMsgTempl.txt",$text);
$template = new Template("admin/sendMsgTempl");
$template = $template->Load();
$template->LoadButtons();
$this->sendMessage($user["chat_id"], $template->text, $template->buttons);
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
return;
} elseif ($send_action[0] == "send_all"){
$this->DelMessageText(ADMIN_CHAT_ID, $send_action[1]);
$users = R::findAll("users");
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
file_put_contents("modules/templates/admin/sendMsgTemplAll.txt",$text);
$template = new Template("admin/sendMsgTemplAll");
$template = $template->Load();
$template->LoadButtons();
foreach ($users as $user) {
$this->sendMessage($user["chat_id"], $template->text, $template->buttons);
}
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено всем пользоваетлям");
return;
}
}
}
switch ($command[0]) {
case "/reply":
file_put_contents("modules/templates/admin/user_voice_reply.txt", "$command[1] $message_id");
$this->sendMessage(ADMIN_CHAT_ID, "Для ответа запишите голосове сообщение");
return;
case "/send_voice":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_voice_reply.txt");
$full = explode(" ", $reply_to);
$this->sendVoice($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
case "/1":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$statuses = R::findAll( 'refbuffer' , ' ORDER BY id ASC ' );
$stats = array();
foreach($statuses as $status){
array_push($stats, $status["buffer"]);
}
$template = new Template("admin/status_stat", [
new TemplateData(":red", $stats[0]),
new TemplateData(":orange", $stats[1]),
new TemplateData(":yellow",$stats[2]),
new TemplateData(":green", $stats[3]),
new TemplateData(":blue", $stats[4]),
new TemplateData(":darkblue", $stats[5]),
new TemplateData(":purple", $stats[6])
]);
$template = $template->Load();
$this->sendMessage(ADMIN_CHAT_ID, $template->text);
return;
case "/aphrodite_morning_process_purchase_success":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$orderId = (int)$command[1];
//$username = $command[3];
$aphroditeMorning = R::findOne("aphroditemorning", "id = $orderId");
if ($aphroditeMorning) {
$aphroditeMorning["status"] = 2;
R::store($aphroditeMorning);
$aphroditeMorningUser = R::findOne("users", "id = {$aphroditeMorning["user_id"]}");
$aphroditeMorningUser["action"] = "";
R::store($aphroditeMorningUser);
$this->DelMessageText($aphroditeMorningUser["chat_id"], $command[2]);
$templateUser = new Template("aphrodite_morning/order_payment_success");
$templateUser = $templateUser->Load();
$this->sendMessage($aphroditeMorningUser["chat_id"], $templateUser->text);
//Создать файл с номерам заказа
file_put_contents("modules/templates/admin/cur_order.txt", "aphr $orderId");
$templateAdmin = new Template("admin/aphrodite_morning/process_purchase_success", [
new TemplateData(":aphroditeMorningId", $aphroditeMorning["id"]),
new TemplateData(":username", $aphroditeMorningUser["username"]),
//new TemplateData(":username", $username)
]);
$templateAdmin = $templateAdmin->Load();
$this->sendPhoto(ADMIN_CHAT_ID,"https://katyasatorinebot.online/bot/{$aphroditeMorning["check_photo"]}", $templateAdmin->text);
//$response = $this->sendMessage(ADMIN_CHAT_ID,$templateAdmin->text);
}
return;
привет, мне нужно, чтобы админ видел информацию и пользователе (айди и ник, если есть). Это телеграм-бот на php. Если кода недостаточно, то могу скинуть еще, это неполная версия | 17ebca3477ba80e09f200c7321a97285 | {
"intermediate": 0.41000354290008545,
"beginner": 0.4311460852622986,
"expert": 0.15885034203529358
} |
21,847 | shifted_time = collection_time1 + lubridate::minutes(random_minutes)shifted_time = collection_time1 + lubridate::minutes(random_minutes)`.
x CCTZ: Invalid timezone of the input vector: ":/etc/localtime" how to fix this | 32f708059f05c139261c4eccc414965c | {
"intermediate": 0.4640725553035736,
"beginner": 0.1946590095758438,
"expert": 0.3412684202194214
} |
21,848 | //получить сенд файл
$send_content = file_get_contents("modules/templates/admin/sendMsg.txt");
if (strlen($send_content) > 0){
$send_action = explode(" ",$send_content);
if (isset($send_action[1])) {
file_put_contents("modules/templates/admin/sendMsg.txt", "");
if($send_action[0] == "send_one"){
$this->DelMessageText(ADMIN_CHAT_ID, $send_action[2]);
$user = R::findOne("users", "id = '{$send_action[1]}'");
file_put_contents("modules/templates/admin/sendMsgTempl.txt",$text);
$template = new Template("admin/sendMsgTempl");
$template = $template->Load();
$template->LoadButtons();
$this->sendMessage($user["chat_id"], $template->text, $template->buttons);
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
return;
} elseif ($send_action[0] == "send_all"){
$this->DelMessageText(ADMIN_CHAT_ID, $send_action[1]);
$users = R::findAll("users");
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
file_put_contents("modules/templates/admin/sendMsgTemplAll.txt",$text);
$template = new Template("admin/sendMsgTemplAll");
$template = $template->Load();
$template->LoadButtons();
foreach ($users as $user) {
$this->sendMessage($user["chat_id"], $template->text, $template->buttons);
}
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено всем пользоваетлям");
return;
}
}
}
привет, мне нужно, чтобы админ видел информацию и пользователе (айди и ник, если есть). Это телеграм-бот на php. Если кода недостаточно, то могу скинуть еще, это неполная версия | 590419dcbd29cd14bc1734a48e7852ec | {
"intermediate": 0.40153443813323975,
"beginner": 0.42282527685165405,
"expert": 0.1756402999162674
} |
21,849 | tell me how ul tag in html works | 17e03af490458b3c328449b52fc2ae5c | {
"intermediate": 0.5023974180221558,
"beginner": 0.3029634654521942,
"expert": 0.1946391612291336
} |
21,850 | from keras.utils.np_utils import to_categorical
BATCH_SIZE=32 ModuleNotFoundError: No module named 'keras.utils.np_utils' | 8a66f9f38b1b7d09b1233839fea26fc6 | {
"intermediate": 0.4125954508781433,
"beginner": 0.2816295623779297,
"expert": 0.3057749271392822
} |
21,851 | "2.2. Devices Requiring Firmware
Besides the availability of a device driver, some hardware also requires so-called firmware or microcode to be loaded into the device before it can become operational. This is most common for network interface cards (especially wireless NICs), but for example some USB devices and even some hard disk controllers also require firmware.
With many graphics cards, basic functionality is available without additional firmware, but the use of advanced features requires an appropriate firmware file to be installed in the system.
On many older devices which require firmware to work, the firmware file was permanently placed in an EEPROM/Flash chip on the device itself by the manufacturer. Nowadays most new devices do not have the firmware embedded this way anymore, so the firmware file must be uploaded into the device by the host operating system every time the system boots.
In most cases firmware is non-free according to the criteria used by the Debian GNU/Linux project and thus cannot be included in the main distribution. If the device driver itself is included in the distribution and if Debian GNU/Linux legally can distribute the firmware, it will often be available as a separate package from the non-free-firmware section of the archive (prior to Debian GNU/Linux 12.0: from the non-free section).
However, this does not mean that such hardware cannot be used during installation. Starting with Debian GNU/Linux 12.0, following the 2022 General Resolution about non-free firmware, official installation images can include non-free firmware packages. By default, debian-installer will detect required firmware (based on kernel logs and modalias information), and install the relevant packages if they are found on an installation medium (e.g. on the netinst). The package manager gets automatically configured with the matching components so that those packages get security updates. This usually means that the non-free-firmware component gets enabled, in addition to main.
Users who wish to disable firmware lookup entirely can do so by setting the firmware=never boot parameter. It's an alias for the longer hw-detect/firmware-lookup=never form.
Unless firmware lookup is disabled entirely, debian-installer still supports loading firmware files or packages containing firmware from a removable medium, such as a USB stick. See Section 6.4, “Loading Missing Firmware” for detailed information on how to load firmware files or packages during the installation. Note that debian-installer is less likely to prompt for firmware files now that non-free firmware packages can be included on installation images.
If the debian-installer prompts for a firmware file and you do not have this firmware file available or do not want to install a non-free firmware file on your system, you can try to proceed without loading the firmware. There are several cases where a driver prompts for additional firmware because it may be needed under certain circumstances, but the device does work without it on most systems (this e.g. happens with certain network cards using the tg3 driver)."
Where do I put "firmware-never"? | 6796c04106547294c5d7f38b108d513f | {
"intermediate": 0.34685006737709045,
"beginner": 0.371319055557251,
"expert": 0.28183090686798096
} |
21,852 | Since we're analyzing a full sequence, it's legal for us to look into future data.
A simple way to achieve that is to go both directions at once, making a bidirectional RNN.
In Keras you can achieve that both manually (using two LSTMs and Concatenate) and by using keras.layers.Bidirectional.
This one works just as TimeDistributed we saw before: you wrap it around a recurrent layer (SimpleRNN now and LSTM/GRU later) and it actually creates two layers under the hood.
Your first task is to use such a layer our POS-tagger. #Define a model that utilizes bidirectional SimpleRNN
model = keras.models.Sequential()
<Your code here!>
model.compile('adam','categorical_crossentropy')
model.fit_generator(generate_batches(train_data),len(train_data)/BATCH_SIZE,
callbacks=[EvaluateAccuracy()], epochs=5,) | 721b1806faf5daea2d2bc738e0eeece2 | {
"intermediate": 0.2447369396686554,
"beginner": 0.12894175946712494,
"expert": 0.6263213157653809
} |
21,853 | Kameleoon SDK Log: Scheduled job to fetch configuration is started | 2dd2297682e97c4746695f9bb4446f2e | {
"intermediate": 0.5353688597679138,
"beginner": 0.16258926689624786,
"expert": 0.3020418882369995
} |
21,854 | How to fix this error:
Error C2664 'void RGN::Modules::Wallets::WalletsModule::CreateWalletAsync(std::string &,const std::function<void (RGN::Modules::Wallets::CreateWalletResponseData &)> &,const std::function<void (int,std::string)> &)': cannot convert argument 1 from 'std::string' to 'std::string &'
void UBP_WalletsModule::CreateWallet(const FString& password,
FCreateWalletSuccessResponse successEvent, FWalletsFailResponse failEvent) {
WalletsModule::CreateWalletAsync(std::string(TCHAR_TO_UTF8(*password)),
[successEvent](CreateWalletResponseData response) {
json responseJson = response;
FString responseJsonString = FString(responseJson.dump().c_str());
FBP_CreateWalletResponseData bpResponse;
FJsonObjectConverter::JsonObjectStringToUStruct<FBP_CreateWalletResponseData>(responseJsonString, &bpResponse, 0, 0);
successEvent.ExecuteIfBound(bpResponse);
},
[failEvent](int code, std::string message) {
failEvent.ExecuteIfBound(static_cast<int32>(code), FString(message.c_str()));
}
);
} | 54009fe859e599846635a64eea8c8b8a | {
"intermediate": 0.5431938767433167,
"beginner": 0.3544461727142334,
"expert": 0.10235989838838577
} |
21,855 | how to use tandem-straight in Matlab to create a continuum | 82bbcdc482b0ee6795583a7e984871b1 | {
"intermediate": 0.2024516612291336,
"beginner": 0.22851067781448364,
"expert": 0.5690376162528992
} |
21,856 | I am learning to use matlab and trying to use this programme called STRAIGHT from this page: https://github.com/HidekiKawahara/legacy_STRAIGHT can you tell me from the start, what doesa it mean to "Set MATLAB path to "src" directory." | 024150cca45a00450c6f9d3f4352a065 | {
"intermediate": 0.5050926804542542,
"beginner": 0.2036779671907425,
"expert": 0.2912294268608093
} |
21,857 | what can we understand from these 2 linear mixed models and from the anova between them? > summary(model1)
Linear mixed model fit by REML ['lmerMod']
Formula: RT ~ distractor + (1 | subject) + (1 | item)
Data: data
REML criterion at convergence: 694565.8
Scaled residuals:
Min 1Q Median 3Q Max
-3.05423 -0.69050 -0.00048 0.68735 3.06582
Random effects:
Groups Name Variance Std.Dev.
item (Intercept) 28.82 5.368
subject (Intercept) 8239.54 90.772
Residual 135260.17 367.777
Number of obs: 47390, groups: item, 200; subject, 40
Fixed effects:
Estimate Std. Error t value
(Intercept) 1166.585 14.554 80.16
distractoryes 66.405 3.379 19.65
Correlation of Fixed Effects:
(Intr)
distractrys -0.116
> summary(model2)
Linear mixed model fit by REML ['lmerMod']
Formula: RT ~ distractor * trialnr_session + (1 | subject) + (1 | item)
Data: data
REML criterion at convergence: 694387.8
Scaled residuals:
Min 1Q Median 3Q Max
-3.13560 -0.69212 -0.00176 0.69000 3.05968
Random effects:
Groups Name Variance Std.Dev.
item (Intercept) 26.55 5.153
subject (Intercept) 8236.18 90.753
Residual 134726.80 367.051
Number of obs: 47390, groups: item, 200; subject, 40
Fixed effects:
Estimate Std. Error t value
(Intercept) 1214.40350 15.12137 80.310
distractoryes 49.26056 6.73402 7.315
trialnr_session -0.23942 0.02062 -11.611
distractoryes:trialnr_session 0.08557 0.02921 2.930
Correlation of Fixed Effects:
(Intr) dstrct trlnr_
distractrys -0.222
trilnr_sssn -0.272 0.612
dstrctrys:_ 0.192 -0.866 -0.706
> #summary(model3)
> #summary(model4)
>
> anova(model1, model2)
refitting model(s) with ML (instead of REML)
Data: data
Models:
model1: RT ~ distractor + (1 | subject) + (1 | item)
model2: RT ~ distractor * trialnr_session + (1 | subject) + (1 | item)
npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
model1 5 694587 694631 -347289 694577
model2 7 694401 694463 -347194 694387 189.82 2 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | d85bfcf51e9a7c654ba89d5845f43303 | {
"intermediate": 0.4682350158691406,
"beginner": 0.30014172196388245,
"expert": 0.23162326216697693
} |
21,858 | Going bidirectional
Since we're analyzing a full sequence, it's legal for us to look into future data.
A simple way to achieve that is to go both directions at once, making a bidirectional RNN.
In Keras you can achieve that both manually (using two LSTMs and Concatenate) and by using keras.layers.Bidirectional.
This one works just as TimeDistributed we saw before: you wrap it around a recurrent layer (SimpleRNN now and LSTM/GRU later) and it actually creates two layers under the hood.
Your first task is to use such a layer our POS-tagger. Этот код можно использовать в данных целях? embed_dim = 256
lstm_out = 196
model = tf.keras.Sequential()
model.add(tf.keras.layers.Embedding(max_features, embed_dim, input_length = X.shape[1]))
model.add(tf.keras.layers.SpatialDropout1D(0.4))
model.add(tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(lstm_out, dropout=0.05, recurrent_dropout=0.2)))
model.add(tf.keras.layers.Dense(2, activation='softmax'))
model.compile(loss = 'categorical_crossentropy', optimizer='adam', metrics = ['accuracy']) | 527cbfbd52b15ea19e186bc1f1e2e490 | {
"intermediate": 0.22010751068592072,
"beginner": 0.16382764279842377,
"expert": 0.6160648465156555
} |
21,859 | Данный код в классе Race считает target необъявленным идентификатором. Исправь его. Код: class Race {
protected:
string race;//Название расы
string ability;//название способности
int racephysicalvalue;//Бонус к физ урону
int racemagicvalue;//Бонус к маг урону
int racehpvalue;//Бонус к hp
int racempvalue;//Бонус к mp
public:
Race(const string& race, const string& ability, int racephysicalvalue, int racemagicvalue, int racehpvalue, int racempvalue)
: race(race), ability(ability), racephysicalvalue(racephysicalvalue), racemagicvalue(racemagicvalue), racehpvalue(racehpvalue), racempvalue(racempvalue) {}
string getrace() {
return race;
}
string getability() {
return ability;
}
virtual void useraceability(Character* target) = 0;
int getrpv() {
return racephysicalvalue;
}
int getrmv() {
return racemagicvalue;
}
int getrhp() {
return racehpvalue;
}
int getrmp() {
return racempvalue;
}
virtual ~Race() {}
};
class Human :public Race {
public:
Human(): Race("Человек","",0,0,0,0) {}
void useraceability(Character* target) override {}
~Human(){}
};
class Orc :public Race {
public:
Orc(): Race("Орк", "Исступление", 5, -10, 20, -10) {}
void useraceability(Character* target) override {
target->takeDamage(10);
target->attackbonus = 5;
}
~Orc(){}
};
class Elf :public Race {
public:
Elf() : Race("Эльф", "Восстановление маны", 0, 10, -10, 10) {}
void useraceability(Character* target) override {
target->restoreMana(20 + racemagicvalue);
}
~Elf(){}
};
class Undead :public Race {
public:
Undead() : Race("Нежить", "Восстановление ", -5, 5, -20,5 ) {}
void useraceability(Character* target) override {
}
~Undead(){}
};
class Demon :public Race {
public:
Demon() : Race("Демон", "Огненная плеть", 10, -5, 0, -5) {}
void useraceability(Character* target) {
}
~Demon(){}
};
//Место для класса trait
class Character {
protected:
string name;
Race* race;
string specialization;
string trait;//Черты + изъяны
int hp;
int mp;
public:
Character(const string& name, Race* race, const string& specialization, const string& trait, int maxhp, int maxmp)
: name(name), race(race), specialization(specialization), trait(trait), hp(maxhp+race->getrhp()), mp(maxmp+race->getrmp()) {}
int maxhp = hp;
int maxmp = mp;
int attackbonus = 0;
virtual void useAbility(Character* target) = 0;
virtual void useAbility(Mob* target) = 0;
bool isalive() {
return hp >= 0;
}
void status() {
cout << "Имя: " << getName() << endl;
cout << "Раса: " << race->getrace() << endl;
cout << "Класс: " << specialization << endl;
cout << "Черта: " << trait << endl;
cout << "HP: " << hp << "/" << maxhp << endl;
cout << "MP: " << mp << "/" << maxmp << endl;
}
virtual void attack(Character* target) = 0;
virtual void attack(Mob* target) = 0;
void takeDamage(int damage) {
hp -= damage;
cout << name << " получает " << damage << " урона" << endl;
}
void restoreHealth(int amount) {
if (!isalive())
return;
if (hp + amount > maxhp)
hp = maxhp;
else
hp += amount;
cout << name << " восстанавливает " << amount << " здоровья" << endl;
}
void useMana(int amount) {
mp -= amount;
cout << name << " использует " << amount << " маны" << endl;
}
void restoreMana(int amount) {
if (!isalive())
return;
if (mp + amount > maxmp)
mp = maxmp;
else
mp += amount+race->getrmp();
cout << name << " восполняет " << amount << " маны" << endl;
}
string getName(){
if (!isalive())
return name + "(мёртв)";
return name;
}
virtual ~Character(){}
};
class Knight : public Character {
public:
Knight(const string& name, Race* race, const string& trait, int hp, int mp) : Character(name, race, "Рыцарь", trait, hp, mp) {}
void useAbility(Character* target) override {
if (isalive()) {
if (mp >= 30) {
useMana(30);
cout << "Способность : Удар Щитом" << endl;
target->takeDamage(20+race->getrpv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName()<<endl;
}
void useAbility(Mob* target) override {
if (isalive()) {
if (mp >= 30) {
useMana(30);
cout << "Способность : Удар Щитом" << endl;
target->takeDamage(20 + race->getrpv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName() << endl;
}
void attack(Mob* target) override {
if (isalive()) {
cout << name << " рубит мечом " << target->getName() << endl;
target->takeDamage(50 + race->getrpv());
}
else
cout << name << " мёртв и не может атаковать" << target->getName() << endl;
}
void attack(Character* target) override {
if (isalive()) {
cout << name << " рубит мечом " << target->getName() << endl;
target->takeDamage(50 + race->getrpv());
}
else
cout << name<<" мёртв и не может атаковать"<<target->getName() << endl;
}
~Knight(){}
};
class Cleric : public Character {
public:
Cleric(const string& name, Race* race, const string& trait, int hp, int mp) : Character(name, race, "Клирик", trait, hp, mp){}
void useAbility(Character * target) override {
if (isalive()) {
if (mp >= 20) {
useMana(20);
cout << "Способность : Лечение" << endl;
target->restoreHealth(30 + race->getrmv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName() << endl;
}
void useAbility(Mob* target) override {
if (isalive()) {
if (mp >= 20) {
useMana(20);
cout << "Способность : Лечение" << endl;
target->restoreHealth(30 + race->getrmv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName() << endl;
}
void attack(Character* target) override {
if (isalive()) {
cout << name << " тыкает жезлом " << target->getName() << " в глаз" << endl;
target->takeDamage(5);
}
else
cout << name << " мёртв и не может атаковать" << target->getName() << endl;
}
void attack(Mob* target) override {
if (isalive()) {
cout << name << " тыкает жезлом " << target->getName()<< " в глаз" << endl;
target->takeDamage(5);
}
else
cout << name << " мёртв и не может атаковать" << target->getName() << endl;
}
~Cleric(){}
};
class Paladin : public Character {
public:
Paladin(const string& name, Race* race, const string& trait, int hp, int mp) : Character(name, race, "Паладин", trait, hp, mp) {}
void useAbility(Character* target) override {
if (isalive()) {
if (mp >= 40) {
useMana(40);
cout << "Способность : Удар Света" << endl;
target->takeDamage(40+race->getrmv() + race->getrpv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName() << endl;
}
void useAbility(Mob* target) override {
if (isalive()) {
if (mp >= 40) {
useMana(40);
cout << "Способность : Удар Света" << endl;
target->takeDamage(40 + race->getrmv() + race->getrpv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName() << endl;
}
void attack(Character* target) override {
if (isalive()) {
cout << name << " размахивается и бьёт молотом " << target->getName() << endl;
target->takeDamage(40 + race->getrpv());
}
else
cout << name << " мёртв и не может атаковать" << target->getName() << endl;
}
void attack(Mob* target) override {
if (isalive()) {
cout << name << " размахивается и бьёт молотом " << target->getName() << endl;
target->takeDamage(40 + race->getrpv());
}
else
cout << name << " мёртв и не может атаковать" << target->getName() << endl;
}
~Paladin(){}
};
class Mage : public Character {
public:
Mage(const string& name, Race* race, const string& trait, int hp, int mp) : Character(name, race, "Маг", trait, hp, mp) {}
void useAbility(Character* target) override {
if (isalive()) {
if (mp >= 40) {
useMana(40);
cout << "Способность : Огненный Шар" << endl;
target->takeDamage(50+race->getrmv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName() << endl;
}
void useAbility(Mob* target) override {
if (isalive()) {
if (mp >= 40) {
useMana(40);
cout << "Способность : Огненный Шар" << endl;
target->takeDamage(50 + race->getrmv());
}
else {
cout << "Не хватает маны" << endl;
}
}
else
cout << name << " мёртв и не может использовать способности на " << target->getName() << endl;
}
void attack(Character* target) override {
if (isalive()) {
cout<<name<<" бьёт посохом " << target->getName() << endl;
target->takeDamage(10+race->getrpv());
}
else
cout << name << " мёртв и не может атаковать" << target->getName() << endl;
}
void attack(Mob* target) override {
if (isalive()) {
cout << name << " бьёт посохом " << target->getName() << endl;
target->takeDamage(10+race->getrpv());
}
else
cout << name << " мёртв и не может атаковать" << target->getName() << endl;
}
~Mage(){}
}; | 1ddbfd19bde08fdb1588dd12b2f95e31 | {
"intermediate": 0.24643109738826752,
"beginner": 0.5821687579154968,
"expert": 0.17140011489391327
} |
21,860 | How to translate BLOB data to string from SQLite database using C++ | 02b5ef95a36a9b216877b437c2227bf0 | {
"intermediate": 0.5731669068336487,
"beginner": 0.2217356562614441,
"expert": 0.20509742200374603
} |
21,861 | I use sympy and python to solve some kind of equation. I have equation a1*u + a2*u_x and fucntions f1 and f2 that depend on x and y. Coefficients a1 and a2 can be constants or also functions that depend on x and y. I want to express these coeffiecients a1 and a2 throught function f1 and f2, so that my equation looks like g(f1,f2)*u + h(f1,f2)*u_x. I want to be able to solve this for general case but here is concrete example. Let's say we have equation x*y*u + 5*u_x ; f1=x*y^2; f2=1/y. We don't have to anythin with coefficient a2 that equals to 5 because it is constant. But we need to express coeffiecient a1 that equalt to x*y throuth function f1 and f2. Since f1*f2 = x*y we get an equation f1*f2*u + 5*u_x. How do i implement this functionality in sympy? | fe95acd77b57a6e72b9464248547b790 | {
"intermediate": 0.4935911297798157,
"beginner": 0.23081979155540466,
"expert": 0.27558907866477966
} |
21,862 | Imagine you're a tutor for programming websites in HTML. You need to explain how to create a toolbar at the top of the site that contains several interactive menu items with links to other pages. Show an example code, and explain step-by-step how you would solve this problem. | a1857e825152b611cdd709268b152ce7 | {
"intermediate": 0.3693114221096039,
"beginner": 0.36281517148017883,
"expert": 0.2678734064102173
} |
21,863 | write me a shopify store theme on python | 6f699dc3c55ad1cb2e55b7f5a6440343 | {
"intermediate": 0.39186832308769226,
"beginner": 0.3286519944667816,
"expert": 0.2794796824455261
} |
21,864 | I have a Java interface thats implemented by many enums. How can I get all the enums that implement my interface? | 2ac6a56cfed864f28ff7e8d019de3f37 | {
"intermediate": 0.5293779969215393,
"beginner": 0.17292311787605286,
"expert": 0.2976989150047302
} |
21,865 | I have an interface thats implemented across 4 enum classes. Each enum class has many individual enums. How can I get every enum class that implements the interface (this is in java)? | c6fa0814b1b3cfc98cf9bcb3563bb05b | {
"intermediate": 0.4686698913574219,
"beginner": 0.2631695866584778,
"expert": 0.26816046237945557
} |
21,866 | how to using PBKDF2_HMAC on C++ | f2fe9c67dcd65f80dccc84d6f594b0d3 | {
"intermediate": 0.44297850131988525,
"beginner": 0.1782614290714264,
"expert": 0.37876003980636597
} |
21,867 | Show how to refactor this JQuery code:
if (this.checkedTypeArray.length > 0) {
$("#types-count").html("(" + this.checkedTypeArray.length + ")");
} else {
$("#types-count").html("");
}
if (this.checkedMaterialArray.length > 0) {
$("#materials-count").html("(" + this.checkedMaterialArray.length + ")");
} else {
$("#materials-count").html("");
}
if (this.checkedColorArray.length > 0) {
$("#colors-count").html("(" + this.checkedColorArray.length + ")");
} else {
$("#colors-count").html("");
} | 38c7cf8c405bb845eec05f7c2f585ee2 | {
"intermediate": 0.6171188354492188,
"beginner": 0.19691646099090576,
"expert": 0.18596476316452026
} |
21,868 | Locate profiles and extract “password-check” data on FireFox using C++ | aa96320a06dc1d15e0f9cdfc491c3d1f | {
"intermediate": 0.6007788181304932,
"beginner": 0.11942964792251587,
"expert": 0.2797915041446686
} |
21,869 | Locate profiles and extract password-check data on FireFox using C++ and sqlite | b7b6628bf908dccad97d9a73e29d2c42 | {
"intermediate": 0.6275975108146667,
"beginner": 0.16154181957244873,
"expert": 0.2108607143163681
} |
21,870 | help me do a jest file for
/* eslint-disable no-tabs */
/* eslint-disable sort-keys */
/* eslint-disable react/function-component-definition */
import * as React from 'react';
import {
ChangeEvent,
useState,
ReactNode,
useEffect,
} from 'react';
import { useMsal, useAccount } from '@azure/msal-react';
import { RadioChangeEvent, Skeleton } from 'antd';
import { useTranslation } from 'react-i18next';
import 'presentation/styles/Restrictions.css';
import { SentenceCase } from 'data/utils/functions';
import { MPLQuality } from 'domain/models/PLQuality';
import PLQualityService from 'domain/services/PLQualityService';
import ModalRow from 'presentation/components/ModalRow/ModalRow';
import ModalCustom from 'presentation/components/Modal/Modal';
interface QualityInterface {
month: number,
errorMessage:() => void,
saveMessage:() => void,
setVisibleQuality: (b: boolean) => void,
visibleQuality: boolean
}
const ModalQuality: React.FC<QualityInterface> = ({
month, errorMessage, saveMessage, setVisibleQuality, visibleQuality,
}) => {
const { t } = useTranslation();
const { accounts } = useMsal();
const userAccountInfo = useAccount(accounts[0]);
const [ saving, setSaving ] = useState(false);
const [ isLoading, setIsLoading ] = useState(true);
const [ emptyFields, setEmptyFields ] = useState(true);
const [ plQuality, setPLQuality ] = useState<MPLQuality>();
const [ fieldsLimitErrors, setFieldsLimitErrors ] = useState<string[]>([]);
const commonProps = {
placeholder: '%',
};
const items = React.useMemo(() => [
{
nameLabel: t('Label', { context: 'Raw_Material', ns: 'weekly' }),
subTitle: t('Semilla Argentina'),
children: [ {
...commonProps,
descLabel: t('Protein'),
key: 'materialProtein',
maxLimit: 40,
minLimit: 28,
value: plQuality !== undefined ? plQuality.materialProtein : undefined,
},
{
...commonProps,
descLabel: t('Grease'),
key: 'materialFat',
maxLimit: 25,
minLimit: 15,
value: plQuality !== undefined ? plQuality.materialFat : undefined,
},
{
...commonProps,
descLabel: t('Humidity'),
key: 'materialMoisture',
maxLimit: 25,
minLimit: 6,
value: plQuality !== undefined ? plQuality.materialMoisture : undefined,
} ],
},
{
children: [ {
...commonProps,
descLabel: t('Fibers'),
key: 'materialFiber',
maxLimit: 7,
minLimit: 3,
value: plQuality !== undefined ? plQuality.materialFiber : undefined,
},
],
},
{
nameLabel: t('Label', { context: 'Temp_Seed_Import', ns: 'weekly' }),
children: [ {
...commonProps,
descLabel: t('Protein'),
key: 'temporalProteina',
maxLimit: 40,
minLimit: 28,
value: plQuality !== undefined ? plQuality.temporalProteina : undefined,
},
{
...commonProps,
descLabel: t('Grease'),
key: 'temporalFat',
maxLimit: 25,
minLimit: 15,
value: plQuality !== undefined ? plQuality.temporalFat : undefined,
},
{
...commonProps,
descLabel: t('Humidity'),
key: 'temporalMoisture',
maxLimit: 25,
minLimit: 6,
value: plQuality !== undefined ? plQuality.temporalMoisture : undefined,
} ],
},
{
children: [
{
...commonProps,
descLabel: t('Fibers'),
key: 'temporalFiber',
maxLimit: 7,
minLimit: 3,
value: plQuality !== undefined ? plQuality.temporalFiber : undefined,
},
],
},
], [ t, plQuality ]);
const checkforEmtpyFields = React.useCallback((comm: MPLQuality): boolean => {
const values = Object.values(comm);
const emptyItems = values.some(val => val === undefined || val === '');
setEmptyFields(emptyItems);
return emptyItems;
}, []);
const handleChange = React.useCallback((
event: ChangeEvent<HTMLInputElement> | RadioChangeEvent,
key: string,
line: number | undefined,
action?: boolean,
) => {
const parseValue = (value: string) => {
if (Number.isNaN(parseFloat(value))) {
return undefined;
}
return parseFloat(value);
};
let qualityItem: MPLQuality = plQuality || {
materialProtein: undefined,
materialFat: undefined,
materialMoisture: undefined,
materialFiber: undefined,
temporalProteina: undefined,
temporalFat: undefined,
temporalMoisture: undefined,
temporalFiber: undefined,
month,
};
qualityItem.month = month;
switch (key) {
case 'materialProtein':
qualityItem = {
...qualityItem,
materialProtein: parseValue(event.target.value),
};
break;
case 'materialFat':
qualityItem = {
...qualityItem,
materialFat: parseValue(event.target.value),
};
break;
case 'materialMoisture':
qualityItem = {
...qualityItem,
materialMoisture: parseValue(event.target.value),
};
break;
case 'materialFiber':
qualityItem = {
...qualityItem,
materialFiber: parseValue(event.target.value),
};
break;
case 'temporalProteina':
qualityItem = {
...qualityItem,
temporalProteina: parseValue(event.target.value),
};
break;
case 'temporalFat':
qualityItem = {
...qualityItem,
temporalFat: parseValue(event.target.value),
};
break;
case 'temporalMoisture':
qualityItem = {
...qualityItem,
temporalMoisture: parseValue(event.target.value),
};
break;
case 'temporalFiber':
qualityItem = {
...qualityItem,
temporalFiber: parseValue(event.target.value),
};
break;
default:
break;
}
checkforEmtpyFields(qualityItem);
setPLQuality(qualityItem);
if (action === true) {
setFieldsLimitErrors(prevArray => [ ...prevArray, key ]);
} else {
setFieldsLimitErrors(prevArray => prevArray?.filter(m => m !== key));
}
}, [ plQuality, setPLQuality ]);
const handleSaveResponse = (response: any, onSuccess: () => void, onError: () => void) => {
if (response?.success) {
onSuccess();
} else {
onError();
}
};
const cleanPLQuality = () => {
setVisibleQuality(false);
};
const submitPLQuality = async (): Promise<void> => {
try {
if (!plQuality) {
return;
}
setSaving(true);
const plQualityService = new PLQualityService();
plQuality.user = userAccountInfo?.username || '';
const response = await plQualityService.SaveQuality(plQuality);
handleSaveResponse(response, () => {
saveMessage();
cleanPLQuality();
}, errorMessage);
} catch (e) {
errorMessage();
}
setSaving(false);
};
useEffect(() => {
if (
(
fieldsLimitErrors !== undefined ? fieldsLimitErrors?.length > 0 : false
) === true || emptyFields
) {
setEmptyFields(true);
} else {
setEmptyFields(false);
}
}, [ fieldsLimitErrors ]);
const onFetch = async (): Promise<void> => {
try {
const qualityService = new PLQualityService();
const response = await qualityService.GetQuality();
if (response.data) {
const data = (response.data as MPLQuality);
setPLQuality(data);
checkforEmtpyFields(data);
}
setIsLoading(false);
} catch (e) {
setVisibleQuality(false);
errorMessage();
}
};
useEffect(() => {
if (plQuality === undefined) {
onFetch();
}
}, []);
return (
<ModalCustom
className="profitModal"
disableOkButton={emptyFields}
onCancel={() => cleanPLQuality()}
onOk={submitPLQuality}
saving={saving}
title={t('Quality')}
visible={visibleQuality}
>
{ isLoading
? <Skeleton loading paragraph={{ rows: items.length }} style={{ width: '450px' }} />
: (
<div className="container">
{items.map((item, index) => (
<div className="group-container">
{item.nameLabel && (
<div className="itemTile">
{SentenceCase(t(item.nameLabel))}
</div>
)}
{item.subTitle && (
<div className="subtitleLabel">
{SentenceCase(t(item.subTitle))}
</div>
)}
<div className="group-inputs">
{item.children && item.children.map(childrens => (
<ModalRow
key={childrens.key}
dataTest={childrens.key}
descLabel={childrens.descLabel}
handleChange={handleChange}
item={childrens.key}
maxLimit={childrens.maxLimit}
minLimit={childrens.minLimit}
nameLabel=""
placeholder={childrens.placeholder}
subTitle=""
value={childrens.value}
/>
))}
</div>
</div>
))}
</div>
)}
</ModalCustom>
);
};
export default ModalQuality;
lets try to hit a coverage of 90% | 20fd04a97638f0b662082114b81d15e3 | {
"intermediate": 0.28559380769729614,
"beginner": 0.38241440057754517,
"expert": 0.3319918215274811
} |
21,871 | c# | bcd82a9818e20998e48930873b63493e | {
"intermediate": 0.3179325759410858,
"beginner": 0.31199467182159424,
"expert": 0.37007272243499756
} |
21,872 | как повысить timeout при выполнении docker push в registry gitlab? | 5c80bc75787f419ae29d1fc90f8fa120 | {
"intermediate": 0.5555920004844666,
"beginner": 0.2075013816356659,
"expert": 0.23690661787986755
} |
21,873 | Use an object-oriented approach to create an application that allows an administrator to add, search, update,
and delete applications for a career-training institution. Currently, the application form is shown below, and you
must categorize all of the information into one or more classes.It should be highlighted that different applicants
may know more than two languages and are not limited to Spanish and English, and the same goes to
educational background; they may have more than two certificates.
Your application should include a user-friendly menu that allows the administrator to manage the list of
applications. Along with your Python source files, you'll also need to use the "drawio" tool to create a UML
class diagram. | 1607354116baa51801efed5f636f2a81 | {
"intermediate": 0.2837224304676056,
"beginner": 0.41846680641174316,
"expert": 0.29781079292297363
} |
21,874 | write a phash implementation in python, do not use a library that just hands it out, build it actually.
i wanna modify it, | aeac4a878b4aa88bb6bb333c4bfa905e | {
"intermediate": 0.5711740851402283,
"beginner": 0.11061587929725647,
"expert": 0.31821006536483765
} |
21,875 | Create a class shape that consists of member variables such as length, breadth, height and radius. The
class should consist of member functions such as setLength(), setBreadth(), setHeight(), and setRadius().
Derive classes such as box, triangle, circle, cylinder, and square from the class shape. Create member
functions such as getVolume(), getArea(), getSurfaceArea(), getCircumference(), and getPerimeter()
for each of the derived classes, where applicable. Apply function overloading with respect to the
getVolume() function.
For each of the derived classes create at least two objects and, where applicable, compute their area,
surface area, perimeter, circumference, and volume.
Using operator overloading create a rectangle whose dimensions are equal to the sum of the respective
dimensions of the two objects of type square. Compute the circumference and area of the rectangle | f7f31ea027cc27509e3db4bc517b970d | {
"intermediate": 0.28786739706993103,
"beginner": 0.4400133788585663,
"expert": 0.2721192240715027
} |
21,876 | why does this code doesnt | b83a62d0701c3f5368b0b3fdd10d0978 | {
"intermediate": 0.19492019712924957,
"beginner": 0.4879705011844635,
"expert": 0.31710922718048096
} |
21,877 | Write a MATLAB script for this prompt. Consider a radioactive decay problem involving two types of nuclei, A and B, with populations Na(t) and Nb(t). Suppose that type A nuclei decay to form type B nuclei, which then decay, according to the differential equations:
dNa(t) / dt = -Na(t) / Ta
and
dNb(t) / dt = (Na(t) / Ta) - (Nb(t) / Tb)
where Ta and Tb are the decay time constants for each type of nucleus. Specify the units of time that you are using. Although these decay time constants are arbitrary, for you to specify, they should have the correct order of magnitude. You can find this by doing a quick search over the internet. Next, use the Euler method to solve these coupled equations for Na and Nb as a function of time. Plot the results. | b9225d5aa521c629f3c0a2f337a36a2a | {
"intermediate": 0.3964417576789856,
"beginner": 0.33004286885261536,
"expert": 0.27351534366607666
} |
21,878 | I'm running a groupby and can't group by 2 columns and received this error: ValueError: No axis named role_code for object type DataFrame. what does this mean? | bef665cb5e68a17c3dc13e0fb63355eb | {
"intermediate": 0.5409421920776367,
"beginner": 0.14898253977298737,
"expert": 0.3100752532482147
} |
21,879 | create a method in java which I can use in replit which slows the rate of printing text in the terminal/console | 9e7704d05d46eda41885974fc4040dc9 | {
"intermediate": 0.6826819181442261,
"beginner": 0.13146311044692993,
"expert": 0.185854971408844
} |
21,880 | I want you to write a VBA code for ppt about six best strategies to students project proposal achievement. you are to fill in all the text with your own knowledge,no place holder.I need 10 slides | b092c8e4c18a2ec15f344fef48848162 | {
"intermediate": 0.34329983592033386,
"beginner": 0.3495143949985504,
"expert": 0.30718573927879333
} |
21,881 | given this experiment: In this study we're interested in the influence of alcohol on people's susceptibility to distractions. Subjects are tested in three sessions; one where they drank beer, one where they drank malt beer, and one where they drank lemonade. and given a txt data file with these columns: subject,age,session,trialnr_session,trialnr_total,distractor,item,RT,error and given this question: Do people generally exhibit task practice within each session? Do people exhibit task practice across all sessions? Again, provide all relevant statistics and given this output: Linear mixed model fit by REML ['lmerMod']
Formula: RT ~ trialnr_session + (1 | subject) + (1 | item)
Data: data
REML criterion at convergence: 559252.6
Scaled residuals:
Min 1Q Median 3Q Max
-3.05239 -0.69333 -0.00662 0.68774 3.00061
Random effects:
Groups Name Variance Std.Dev.
item (Intercept) 129.1 11.36
subject (Intercept) 8348.7 91.37
Residual 135761.4 368.46
Number of obs: 38144, groups: item, 200; subject, 40
Fixed effects:
Estimate Std. Error t value
(Intercept) 1237.10745 14.95314 82.73
trialnr_session -0.19829 0.01638 -12.11
Correlation of Fixed Effects:
(Intr)
trilnr_sssn -0.218
> summary(model52)
Linear mixed model fit by REML ['lmerMod']
Formula: RT ~ trialnr_total + (1 | subject) + (1 | item)
Data: data
REML criterion at convergence: 558289.6
Scaled residuals:
Min 1Q Median 3Q Max
-3.2806 -0.6919 -0.0074 0.6861 3.1769
Random effects:
Groups Name Variance Std.Dev.
item (Intercept) 146 12.08
subject (Intercept) 8450 91.92
Residual 132347 363.80
Number of obs: 38144, groups: item, 200; subject, 40
Fixed effects:
Estimate Std. Error t value
(Intercept) 1.306e+03 1.503e+01 86.91
trialnr_total -1.814e-01 5.402e-03 -33.58
Correlation of Fixed Effects:
(Intr)
trialnr_ttl -0.216 please answer the question and explain the relevant outputs | 105ded3a297e7409cfa70c83a9d4066f | {
"intermediate": 0.27891772985458374,
"beginner": 0.48044392466545105,
"expert": 0.2406383603811264
} |
21,882 | using jest how to apply jest.resetAllMocks() to all test files in typescript | 73f572cdd59456a5e9d52d5755308164 | {
"intermediate": 0.574926495552063,
"beginner": 0.17653457820415497,
"expert": 0.24853894114494324
} |
21,883 | Привет! Можешь расписать код для создания Telegram бота на Python с помощью pyTelegramBotAPI с использованием паттерна MVC | 1e81ea29424713e8d0fe541af94d8857 | {
"intermediate": 0.7303279042243958,
"beginner": 0.10524163395166397,
"expert": 0.16443045437335968
} |
21,884 | i have current location Lat lng i like to search my nearest lat lng using Google map api 100mile 200mille 500mile option ( php code i needed) | 90633fee747471ee2c499a1a6239ebc6 | {
"intermediate": 0.5107496380805969,
"beginner": 0.23554201424121857,
"expert": 0.2537083327770233
} |
21,885 | make a python script to rename every file in a folder to x(i+1).7z | 9878f92ae03eee538488c2fca3a7f0be | {
"intermediate": 0.36911988258361816,
"beginner": 0.26062247157096863,
"expert": 0.3702576458454132
} |
21,886 | x is an one-dim array with 5267 size. I want to cut non-overlap samples from x with the length 1000, how do I WIRTE THE CODE | e14a0d84fa20d60e302cd1f66c980a78 | {
"intermediate": 0.5357220768928528,
"beginner": 0.15440168976783752,
"expert": 0.3098762631416321
} |
21,887 | #Define a model that utilizes bidirectional SimpleRNN
model = keras.models.Sequential()
#<Your code here!>
max_features =128
embed_dim = 32
lstm_out = 32
model.add(keras.layers.Embedding(max_features, embed_dim, input_length = 14))
model.add(keras.layers.SpatialDropout1D(0.4))
model.add(keras.layers.Bidirectional(keras.layers.LSTM(lstm_out, dropout=0.05, recurrent_dropout=0.2)))
model.add(keras.layers.Dense(2, activation='softmax'))
model.compile('adam','categorical_crossentropy')
model.fit_generator(generate_batches(train_data),len(train_data)/BATCH_SIZE,
callbacks=[EvaluateAccuracy()], epochs=5,) Node: 'categorical_crossentropy/remove_squeezable_dimensions/Squeeze'
Can not squeeze dim[2], expected a dimension of 1, got 14
[[{{node categorical_crossentropy/remove_squeezable_dimensions/Squeeze}}]] [Op:__inference_train_function_47968] | 44ee732a94fafcf41e2a099a1384ea2d | {
"intermediate": 0.24001829326152802,
"beginner": 0.13999289274215698,
"expert": 0.6199887990951538
} |
21,888 | hi there | 364398fc7be701b3e18ee971094ac9be | {
"intermediate": 0.32885003089904785,
"beginner": 0.24785484373569489,
"expert": 0.42329514026641846
} |
21,889 | how to make a pong game in processing | 631ed957775e9c73bf073dfa81f7692f | {
"intermediate": 0.17186297476291656,
"beginner": 0.24094387888908386,
"expert": 0.5871931910514832
} |
21,890 | read the case study. Case Study: "Unspoken Barriers: Gender and Politics in the Workplace"
Background
Sarah, a 37-year-old liberal Democrat, leads a marketing firm specializing in
sustainability and environmental solutions. She recently hired John, a 53-year-old
conservative Republican, for his expertise in data analytics. Both are highly skilled in
their respective fields, but unknown to Sarah, John holds traditional views about gender
roles and is, subconsciously, conflicted about working for a woman.
The Issue
The firm secures a contract to promote a clean energy initiative, which includes
advocating for regulations of fossil fuel industries. Sarah assigns John to a high-profile
clean energy project. She notices that John seems less engaged during team meetings
concerning this project, but attributes it to the newness of his role.
Eventually, an internal team discussion arises about embedding messaging into the
campaign that implicitly criticizes conservative approaches to energy policy. John falls
silent, and his discomfort becomes apparent to the team, leading to awkwardness and
speculative chatter among his colleagues.
Sarah ignores the situation, hoping that John can still fulfill his role as a data analyst.
She hopes that since he is not part of the actual marketing campaign creation, he can
work around what is bothering him.
As time goes on, however, she picks up on other subtle cues—John's hesitancy to take
direction from her, his tendency to more openly collaborate with male colleagues—that
suggest a deeper issue.
During team meetings, Sarah observes that John often questions her decisions, though
he doesn't do the same with male supervisors on other projects.
Cherie, an outspoken woman on the team who has been observing John’s behavior
with dislike, openly challenges him by asking if he thinks women shouldn’t be working,
but instead be home having babies.
John denies the accusation angrily, saying he is not “that kind of man.” He further says,
“I don’t have any problems with women working the same jobs men do.”
“Well, then act like you don’t, buddy,” Cherie replies.
Sarah intervenes at this point and redirects the team back to the task.
The Dilemma
Sarah is faced with the challenge of addressing an issue that has come to a point of
conflict and is affecting team dynamics and work output. John, while professionally
competent, struggles to report to a female leader, further complicated by his possible
ideological differences with the work the team is doing. He is also now defensive and
angry at Cherie, who is also angry with him. | 6a6559a1f5c31b3549050c49bdcba86b | {
"intermediate": 0.2591579854488373,
"beginner": 0.32399022579193115,
"expert": 0.41685181856155396
} |
21,891 | create a class called DynamicStringArray that includes
member functions that allow it to emulate the behavior of a vector of strings.
The class should have the following:
• A private member variable called dynamicArray that references a dynamic array of type string.
• A private member variable called size that holds the number of entries in the array.
• A default constructor that sets the dynamic array to nullptr and sets size to 0.
• A function that returns size.
• A function named addEntry that takes a string as input. The function should create a new
dynamic array one element larger than dynamicArray, copy all elements from dynamicArray into
the new array, add the new string onto the end of the new array, increment size, delete the old
dynamicArray, and then set dynamicArray to the new array.
• A function named deleteEntry that takes a string as input. The function should search
dynamicArray for the string. If not found, it returns false. If found, it creates a new dynamic
array one element smaller than dynamicArray. It should copy all elements except the input
string into the new array, delete dynamicArray, decrement size, and return true.
• A function named getEntry that takes an integer as input and returns a pointer that references
to the string at that index in dynamicArray. It should return nullptr if the index is out of
dynamicArray’s bounds.
• A copy constructor that makes a copy of the input object’s dynamic array.
• Overload the copy assignment operator so that the dynamic array is properly copied to the
target object.
• A destructor that frees up the memory allocated to the dynamic array. | a74b1e01e4007c0649a9a5dc3b73bde3 | {
"intermediate": 0.31993192434310913,
"beginner": 0.4305884838104248,
"expert": 0.24947959184646606
} |
21,892 | write code in c++ for the question.
A container class is a data type that is capable of holding a collection of items and provides
functions to access them. Bag is an example of a container class. It is an unordered collection of
items that may have duplicates.
In this assignment, you are asked to design and develop an abstract Bag class, called
BagInterface, with the following fixed collection of operations:
Insert an item of any type into a bag
Query the bag contents: two queries
Is an item in the bag?
How many copies of an item is in the bag?
Remove an item from the bag
clear the bag
Get the size of the bag
How many items are there in the bag?
Check if the bag is empty
Check if the bag is full
Assume the bag capacity is 20
In addition to BagInterface, you are asked to implement two classes of bag
implementations: PlainBag and MagicChangeBag.
PlainBag is a simple container that holds items of any type using an array implementation.
MagicChangeBag is also very similar to PlainBag, with two exceptions. When an item is inserted into a magic change bag, it’ll magically disappear, and bag looks empty. Whenever a remove operation is invoked, all the items, except the one is removed will appear. | 182dc6b6cb36494f726ec79b9577ec4a | {
"intermediate": 0.2760244905948639,
"beginner": 0.5503891110420227,
"expert": 0.17358636856079102
} |
21,893 | #include<iostream>
using namespace std;
int main(){
int i=1,n,a,sum=0;
cin >> n;
while (i<=10 && i<=n) {
cin >> a;
if (a==-1)
break;
else if ((a % 3 == 0 || a % 5 == 0) && a < 1000 ) {
sum += a;
i++;
}
}
cout << sum << endl;
return 0;
}为什么超时 | 3308661ac7f09972e529bee1d630a960 | {
"intermediate": 0.36133724451065063,
"beginner": 0.3965049684047699,
"expert": 0.24215780198574066
} |
21,894 | I'm gonna find the best answer to question about sklearn library in python
The Iris dataset being very common, scikit-learn offers a native function to load it into
memory:
from sklearn.datasets import load_iris
iris = load_iris()
X, y = iris.data, iris.target
Question 1: Calculate the statistics (mean and standard deviation) of the four explanatory
variables: sepal length, sepal width, petal length and petal width. | b016a24745b2154eed75e04ecc6cc1d0 | {
"intermediate": 0.769558846950531,
"beginner": 0.08001336455345154,
"expert": 0.15042775869369507
} |
21,895 | from lxml import etree
import requests
url="https://www.baodu.com"
headers={"use-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.60"}
resp=requests.get(url,headers=headers).text
html=etree.html(resp)
print(html)
h1=html.xpath('//*[@id="s-top-left"]/a[1]/text()')
print(h1) 有什么问题 | ea197c55f51a1dcc160188d8b6a0069b | {
"intermediate": 0.42910686135292053,
"beginner": 0.22901037335395813,
"expert": 0.34188273549079895
} |
21,896 | Explain to a beginner what a navigable string is and how it works in python | 1e74397ff22bc35188085d3e212c4fd5 | {
"intermediate": 0.5338990092277527,
"beginner": 0.27172043919563293,
"expert": 0.19438053667545319
} |
21,897 | in vscode i want to check if the punctuations in a sentence is a full stop | 2bfc273aa388b1b72ed88914ea4f5c18 | {
"intermediate": 0.44434893131256104,
"beginner": 0.24200841784477234,
"expert": 0.313642680644989
} |
21,898 | On my system the PARTUUID seem much shorter than the UUIDs, unlike the article. What's going on?:
The guide below is simplified in a way that preparing the boot partition is not covered.
Software based btrfs RAID1 requires two devices, which conceptually don’t even need to be on different disks. But for obvious reasons, it’s a good idea if they are…
Having mirroring against encrypted storage brings its own set of challenges: It’s easy to encrypt a mirrored device (e.g. using md whereby each device has exactly the same data blocks), then use LVM and file systems on top. It’s not so easy to have this done if the mirroring is done at a layer “higher” than the encryption, since it is necessary to deal with multiple individually encrypted devices. Which is fine. More complicated but certainly not impossible.
This post aims to guide through implementing btrfs mirroring on two encrypted storage devices.
Disk partitioning
The basic requirement for btrfs RAID1 is having two partitions, ideally in different disks, as described below:
# fdisk -l /dev/sda
Disk /dev/sda: 978.1 GiB, 1050214588416 bytes, 2051200368 sectors
Disk model: Crucial_CT1050MX
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D2E25ADE-25A7-F056-9982-F40C48B55D53
Device Start End Sectors Size Type
/dev/sda1 2048 526335 524288 256M EFI System
/dev/sda2 526336 1574911 1048576 512M BIOS boot
/dev/sda3 1574912 2623487 1048576 512M Linux filesystem
/dev/sda4 2623488 935856127 933232640 445G Linux filesystem
Similarly, there was a /dev/sdb4 on the second disk which had the same size. For btrfs, it is not a requirement that both devices have the same size, since the RAID setup will take as much space as the smallest device allows. Since LVM2 will be in place, all components of the system will live under /dev/sda4 and /dev/sdb4 as logical volumes sitting on encrypted physical volumes.
The disks in this example were partitioned with a GPT label. This is helpful but not required for the purpose of this howto.
Lastly the boot partitions (/dev/sda3 and /dev/sdb3) were equally configured in a btrfs raid1 layout, except these were not under LUKS2 encryption.
LUKS2 encryption and boot tricks
Before considering the file system, the partitions need encrypting using cryptsetup to implement luks2.
For the purpose of this tutorial, and for the boot process to be simple, both devices are encrypted with the same passphrase. This means the actual keys are unique per device but the passphrase used to decrypt the storage encryption keys is the same on both devices. This is optional, just makes life easier.
Volume names ‘crypt-d1’ and ‘crypt-d2’ were chosen, which will tie in with /etc/crypttab’s content.
# cryptsetup luksFormat /dev/sda4 --type luks2
# cryptsetup luksOpen /dev/sda4 crypt-d1
# cryptsetup luksFormat /dev/sdb4 --type luks2
# cryptsetup luksOpen /dev/sdb4 crypt-d2
At this point, it’s worth noting down the respective partition UUIDs and creating /etc/crypttab
# echo "crypt-d1 PARTUUID=$(lsblk /dev/sda4 -o partuuid -n) btrfs_r1 luks,keyscript=/lib/cryptsetup/scripts/decrypt_keyctl > /etc/crypttab
# echo "crypt-d2 PARTUUID=$(lsblk /dev/sdb4 -o partuuid -n) btrfs_r1 luks,keyscript=/lib/cryptsetup/scripts/decrypt_keyctl >> /etc/crypttab
Beyond the automation, here’s what /etc/crypttab looks like:
# cat /etc/crypttab
crypt-d1 PARTUUID=ab4f59d1-8e44-2839-8e8f-3b42e2db5192 btrfs_r1 luks,keyscript=/lib/cryptsetup/scripts/decrypt_keyctl
crypt-d2 PARTUUID=aa3a4e05-84b7-b758-b66f-bbafa1271f6a btrfs_r1 luks,keyscript=/lib/cryptsetup/scripts/decrypt_keyctl
The above lines under /etc/crypttab have the following impact:
labels crypt-d1 and crypt-d2 as ‘btrfs_r1’ for the purpose of handling by cryptsetup tools;
Once the passphrase has been entered for crypt-d1, it’s handled by the decrypt_keyctl to assign transparently to crypt-d2 (and any other device matching the ‘btrfs_r1’ label);
LVM2
Now that the encrypted volumes exist and are available, LVM is used to manage the encrypted space. Each encrypted device will become a physical volume (PV) and hold its own volume group (VG) and logical volumes (LV).
# pvcreate /dev/mapper/crypt-d1
# vgcreate disk1 /dev/mapper/crypt-d1
# lvcreate -l 90%VG -n root disk1
# lvcreate -l 100%VG -n swap disk1
### repeat for PV crypt-d2 into a VG 'disk2' ###
After setting up, the layout should be similar to the following:
...
├─sda4 8:4 0 445G 0 part
│ └─crypt-d1 253:0 0 445G 0 crypt
│ ├─disk1-swap 253:1 0 16G 0 lvm [SWAP]
│ └─disk1-root 253:2 0 429G 0 lvm /
...
└─sdb4 8:20 0 445G 0 part
| └─crypt-d2 253:3 0 445G 0 crypt
| ├─disk2-swap 253:4 0 16G 0 lvm [SWAP]
| └─disk2-root 253:5 0 429G 0 lvm
...
You will notice that until this point both disks have been setup individually, each with their own encrypted space and LVM layout.
# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/crypt-d1 disk1 lvm2 a-- 444.98g 0
/dev/mapper/crypt-d2 disk2 lvm2 a-- 444.98g 0
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root disk1 -wi-ao---- 428.98g
swap disk1 -wi-ao---- 16.00g
root disk2 -wi-ao---- 428.98g
swap disk2 -wi-ao---- 16.00g
btrfs RAID1 filesystem
It is at this point that btrfs makes an appearance. First by being created under /dev/mapper/disk1–root, then by being extended under RAID1 into /dev/mapper/disk2-root.
# mkfs.btrfs /dev/disk1/root
# mount /dev/disk1/root /mnt/root
# btrfs device add /dev/disk2/root /mnt/root
# btrfs filesystem label /mnt/root root-r1
# btrfs filesystem balance start -dconvert=raid1 -mconvert=raid2 /mnt/root
The above sequence of commands creates a btrfs filesystem under /dev/disk1/root, labels it as ‘root-r1’, adds the device /dev/disk2/root and balances the file system across the two devices in a raid1 configuration.
Checking the btrfs RAID filesystem can be done using btrfs filesystem usage and btrfs device usage as shown below:
# btrfs filesystem usage /
Overall:
Device size: 857.96GiB
Device allocated: 258.06GiB
Device unallocated: 599.90GiB
Device missing: 0.00B
Used: 248.08GiB
Free (estimated): 303.13GiB (min: 303.13GiB)
Data ratio: 2.00
Metadata ratio: 2.00
Global reserve: 138.28MiB (used: 0.00B)
Data,RAID1: Size:127.00GiB, Used:123.82GiB
/dev/mapper/disk1-root 127.00GiB
/dev/mapper/disk2-root 127.00GiB
Metadata,RAID1: Size:2.00GiB, Used:226.30MiB
/dev/mapper/disk1-root 2.00GiB
/dev/mapper/disk2-root 2.00GiB
System,RAID1: Size:32.00MiB, Used:48.00KiB
/dev/mapper/disk1-root 32.00MiB
/dev/mapper/disk2-root 32.00MiB
Unallocated:
/dev/mapper/disk1-root 299.95GiB
/dev/mapper/disk2-root 299.95GiB
# btrfs device usage /
/dev/mapper/disk1-root, ID: 1
Device size: 428.98GiB
Device slack: 0.00B
Data,RAID1: 127.00GiB
Metadata,RAID1: 2.00GiB
System,RAID1: 32.00MiB
Unallocated: 299.95GiB
/dev/mapper/disk2-root, ID: 2
Device size: 428.98GiB
Device slack: 0.00B
Data,RAID1: 127.00GiB
Metadata,RAID1: 2.00GiB
System,RAID1: 32.00MiB
Unallocated: 299.95GiB
Local fstab
For the purpose of fstab, both /dev/disk1/root and /dev/disk2/root will have the same file system UUID so either can be mounted. However, using the UUID will solve the problem transparently.
Conceptually, after swap space has been created under /dev/disk1/swap and /dev/disk2/swap (not RAID), then root and swap entries on fstab can be created as follows:
echo "
UUID=$(lsblk /dev/disk1/root -o uuid -n) / btrfs defaults 0 0
UUID=$(lsblk /dev/disk1/swap -o uuid -n) none swap sw 0 0
" >> /etc/fstab
Notice that under fstab UUID is used, whereas under /etc/crypttab PARTUUID was used instead. Only one UUID was necessary to reference the root file system (not both). Also notice that since PARTUUID and UUIDs are used, there’s no fiddling with device names or locations – if you’re not using UUIDs instead of device paths, do it, it will change your life. Here’s what fstab looks like:
# cat /etc/fstab
UUID= /boot btrfs defaults 00
UUID= /boot/efi vfat defaults,noatime 0 0
UUID=e76a6d38-096c-301b-f56b-ab0d7170f725 / btrfs defaults 00
UUID=ad711836-473e-2449-2bde-5419c7cef40f none swap sw 0 0
UUID=316d8414-371f-6910-3b5f-cce6b1dd0bf9 none swap sw 0 0
Boot loader and initramfs
Ensuring that the boot loader and initramfs are setup correctly are not entirely trivial matters. If the above has been done on a running system
with existing /boot partition (with bootloader files)
with correctly labelled LUKS2 volumes (crypt-d1 and crypt-d2)
with correct LVM names (disk1 and disk2)
with correctly constructed /etc/fstab and /etc/crypttab,
then running the following sequence of commands should enable preparation of the initramfs with the correct cryptsetup binaries and helper scripts (decrypt_keyctl) as well as correctly constructed grub.conf.
# update-initramfs -u
# update-grub
# grub-install /dev/sda
# grub-install /dev/sdb | a8f72585705f7187b66c6ff2d5400eae | {
"intermediate": 0.44748345017433167,
"beginner": 0.41503095626831055,
"expert": 0.1374855786561966
} |
21,899 | import cvxpy as cp
import numpy as np
n=2
x=cp.Variable(n,integer =False)
A=np.array([[1,0.8,0,1],[0,1,1,0]])
B=np.array([1,1.6,0,0])
A1=np.array([[1.0,0.0],[0.0,1.0]])
B1=np.array([2.0,1.4])
c=np.array([1000,800])
#prob=cp.Problem(cp.Minimize(c.T @ x),[A @x <= B,A1 @x >=B1])
写完代码 | e41cea039c626ee429bba97f65f8b467 | {
"intermediate": 0.3779875338077545,
"beginner": 0.3055060803890228,
"expert": 0.31650635600090027
} |
21,900 | how to config a ipv6 dns server in linux | 7a0e48822bc5155906dff904738b59b9 | {
"intermediate": 0.3648395240306854,
"beginner": 0.3554072976112366,
"expert": 0.279753178358078
} |
21,901 | vec3_t p, Position, Light2;
Vector(0.f, 0.f, 0.f, p);
Vector(1.f, 0.154f, 0.06f, Light2);
b->TransformPosition(BoneTransform[1], p, Position, true);
CreateParticle(32002, Position, o->Angle, Light2, 1); | 4ee939cec76f65f8698d98fab48393ad | {
"intermediate": 0.31141573190689087,
"beginner": 0.30762195587158203,
"expert": 0.3809623122215271
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.