row_id int64 0 48.4k | init_message stringlengths 1 342k | conversation_hash stringlengths 32 32 | scores dict |
|---|---|---|---|
14,270 | blank space 5 questions with answer based php of “Use Conditionals and Operators
Validate Form Data
Send Values to a Script Manually
Work with Forms and arrays of data
Use For and While Loops
Create a Simple Form using PHP
Receive Data from a Form in PHP” | 5f5610e93132a4dd108026b970c7860e | {
"intermediate": 0.6351215839385986,
"beginner": 0.30266526341438293,
"expert": 0.062213148921728134
} |
14,271 | int case_17_wra()
{
video_buffer_attr attr = {0};
attr.buf_blks[0].size = 600;
attr.buf_blks[0].cnt = 40;
attr.buf_blks[1].size = 300;
attr.buf_blks[1].cnt = 20;
attr.buf_blks[2].size = 500;
attr.buf_blks[2].cnt = 20;
attr.cnt = 3;
int ipid = 0;
int j =0;
s32 ret =-1;
int i=0;
vrb_config_test(&attr, &comm_hdl2);
if(comm_hdl2 == NULL){
printf("pool null pid[%d]",getpid());
return 0;
}
for(;j<3;j++){
ipid=fork();
}
vrb_init();
buffer_pool_init();
pthread_attr_t attrp;
pthread_attr_init(&attrp);
pthread_attr_setstacksize(&attrp, THREAD_STACK_DEPTH);
for( i=0; i<10; i++) {
pthread_create(&thread_ids[i], &attrp, case17_vrb, NULL);
}
/*
while(1) {
printf("Press \'q\' to exit\n");
i = getchar();
if (i == 'q') {
break;
}
}
*/
for( i=0; i<10; i++) {
pthread_join(thread_ids[i], NULL);
}
buffer_pool_deinit();
vrb_deinit();
return 0;
}这段代码的pthread_create和prthread_join是不是应该在case_17_wra函数的外贸 | cfe801d9252f0c202c098d1e076ecf4d | {
"intermediate": 0.3323269188404083,
"beginner": 0.4699109196662903,
"expert": 0.19776217639446259
} |
14,272 | hello | f282c67bf00c681db7f68a2e9d4422c8 | {
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
} |
14,273 | #include <pthread.h>
#include <stdio.h>
typedef struct param{
int a;
int b;
int c;
}param;
size_t THREAD_STACK_DEPTH;
pthread_t thread_ids[10];
int i = 0;
void plus(void *agr){
param* agrs = (param*)agr;
agrs->c = agrs->b + agrs->a;
printf("the test result is %d\n",agrs->c);
}
int main(){
pthread_attr_t attrp;
pthread_attr_init(&attrp);
pthread_attr_setstacksize(&attrp, THREAD_STACK_DEPTH);
param *useagrs;
for( i=0; i<10; i++) {
useagrs->a = i;
useagrs->b = i+1;
pthread_create(&thread_ids[i], &attrp, plus, (void*)useagrs);
}
for( i=0; i<10; i++) {
pthread_join(thread_ids[i], NULL);
}
}这段代码执行出现段错误 | fca03080ca550b96914272a8b873b948 | {
"intermediate": 0.334914892911911,
"beginner": 0.4623669385910034,
"expert": 0.2027180790901184
} |
14,274 | how can I control the width of a column in a datagridview in vb.net | c04626d1aaebb49e8aafb2ce87afd3e7 | {
"intermediate": 0.39278823137283325,
"beginner": 0.16511642932891846,
"expert": 0.4420953392982483
} |
14,275 | implement the print function in kernel abstraction layer of linux | 2245ed833c034207a60e5ea7539dbe3e | {
"intermediate": 0.2525283098220825,
"beginner": 0.39871975779533386,
"expert": 0.34875187277793884
} |
14,276 | implement printf() in the kernel abstraction layer of standard version of freertos | 465f232862160d0c54f2cefa65d5b5de | {
"intermediate": 0.37098440527915955,
"beginner": 0.32396429777145386,
"expert": 0.30505135655403137
} |
14,277 | Hi there! | 02a89b163c107d2daf27b45a5941414b | {
"intermediate": 0.32267293334007263,
"beginner": 0.25843358039855957,
"expert": 0.4188934564590454
} |
14,278 | printk() | 45645a96292914fcb53090b96560e47a | {
"intermediate": 0.18582846224308014,
"beginner": 0.49919402599334717,
"expert": 0.3149775266647339
} |
14,279 | use printk() to implement a kal_print() in kernel abstraction layer of linux | 7be5ba4a03fd3a85b45ba4b24bca9fdc | {
"intermediate": 0.4146820604801178,
"beginner": 0.2831847071647644,
"expert": 0.3021332025527954
} |
14,280 | peut-on optimiser cette fonction ? "function setWordToGuess(uint64 _gameId, string memory _wordToGuess) public inProgress(_gameId) {
require(_gameId > 0 && _gameId <= playerManagement.gameIdCounter(), "Identifiant de jeu invalide");
require(games[_gameId].status == GameStatus.inProgress, "Le jeu doit etre en cours");
address activePlayerAddress = playerManagement.getActivePlayer(_gameId);
require(msg.sender == activePlayerAddress, "Vous n'etes pas le joueur dans ce jeu.");
address otherPlayer;
string memory filteredWordToGuess = filterCharacterWord(_wordToGuess);
_wordToGuess = filteredWordToGuess;
if (keccak256(abi.encodePacked(_wordToGuess)) == keccak256(abi.encodePacked(games[_gameId].word))) {
require(bytes(_wordToGuess).length == wordLength, "il n y a pas le bon nombre de lettres");
gameWords[msg.sender][games[_gameId].playerMove] = _wordToGuess;
emit WordWin(_gameId, activePlayerAddress, otherPlayer, _wordToGuess);
games[_gameId].status = GameStatus.finished;
uint256 currentPot = gameBets[_gameId][msg.sender].pot;
gameBets[_gameId][msg.sender].pot = 0;
gameBalances[_gameId][msg.sender] += currentPot;
playerManagement.endGame(_gameId);
emit GameEnded(_gameId, msg.sender, otherPlayer);
emit PotWon(_gameId, msg.sender, currentPot);
} else {
if (msg.sender == games[_gameId].player1) {
otherPlayer = games[_gameId].player2;
} else if (msg.sender == games[_gameId].player2) {
otherPlayer = games[_gameId].player1;
}
gameWords[msg.sender][_gameId] = _wordToGuess;
emit WordGuessed(_gameId, activePlayerAddress, otherPlayer, _wordToGuess);
playerManagement.playersSwitched(_gameId);
}
}" | b96bbb450f5e5aa8be50347d32220512 | {
"intermediate": 0.2666885256767273,
"beginner": 0.4479104280471802,
"expert": 0.2854011058807373
} |
14,281 | how to set cpu frequence in qemu | cf6e8d62093d1984651baf085b7b0b3b | {
"intermediate": 0.23695439100265503,
"beginner": 0.24159719049930573,
"expert": 0.5214484333992004
} |
14,282 | fflush(stdout); | 4102e7a4d9ac8dd9268638e1613b2ef7 | {
"intermediate": 0.3378722369670868,
"beginner": 0.33060088753700256,
"expert": 0.33152684569358826
} |
14,283 | what is the poisson error of 120 | 9c1b86aa14b95ba3c4226c2c0c1de8ab | {
"intermediate": 0.3675345778465271,
"beginner": 0.29883691668510437,
"expert": 0.3336285650730133
} |
14,284 | implement kal_print() in freertos | cb752b99fef497404cf9d4b163d4c53a | {
"intermediate": 0.3243753910064697,
"beginner": 0.25236430764198303,
"expert": 0.42326027154922485
} |
14,285 | execute system command in rust language | a0823fe2cf248b4366f487612565f1c5 | {
"intermediate": 0.3383897542953491,
"beginner": 0.3360755443572998,
"expert": 0.3255346417427063
} |
14,286 | how to implement div_u64 in freertos? | 8d9b49525880b679f2cea92e63b4f811 | {
"intermediate": 0.2933403253555298,
"beginner": 0.10455309599637985,
"expert": 0.602106511592865
} |
14,287 | How to find out in zuora that how much we used workflow? | 6acc1f8b4cb5850db45a8cfa05566fd6 | {
"intermediate": 0.46285882592201233,
"beginner": 0.22902308404445648,
"expert": 0.30811813473701477
} |
14,288 | import random
import pygame
# Define the artists and their monthly Spotify listeners
artists = {
"Young Thug": {"Image": "C:/Users/elias/Documents/PycharmProjects/Python/Zelf/Python - Freegpt/Music/fotos (code)/fotos/Young_Thug/Young Thug_1.jpeg", "listeners": 28887553},
"Yungeen Ace": {"Image": "C:/Users/elias/Documents/PycharmProjects/Python/Zelf/Python - Freegpt/Music/fotos (code)/fotos/Young_Thug/Young Thug_1.jpeg", "listeners": 1294188},
}
# Initialize Pygame
pygame.init()
# Set the screen dimensions
screen_width = 800
screen_height = 600
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Guess the Artist")
# Load the font
font = pygame.font.Font(None, 36)
def display_images(first_artist_image, second_artist_image):
# Scale the images to fit the screen
first_artist_image_scaled = pygame.transform.scale(first_artist_image, (screen_width // 2, screen_height))
second_artist_image_scaled = pygame.transform.scale(second_artist_image, (screen_width // 2, screen_height))
# Display the images on the screen
screen.blit(first_artist_image_scaled, (0, 0))
screen.blit(second_artist_image_scaled, (screen_width // 2, 0))
def display_text(text, x, y):
# Render the text
text_surface = font.render(text, True, (255, 255, 255))
text_rect = text_surface.get_rect()
text_rect.center = (x, y)
# Display the text on the screen
screen.blit(text_surface, text_rect)
def play_game():
score = 0 # reset score at the beginning of each game
first_artist, second_artist = random.sample(list(artists.keys()), 2)
# Load the images for the artists
first_artist_image = pygame.image.load(artists[first_artist]["Image"]).convert()
second_artist_image = pygame.image.load(artists[second_artist]["Image"]).convert()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
# Display the images
display_images(first_artist_image, second_artist_image)
# Display the score
display_text(f"Score: {score}", screen_width // 2, 50)
# Display the artist names
display_text(f"1. {first_artist.title()}", screen_width // 4, screen_height - 50)
display_text(f"2. {second_artist.title()}", screen_width // 4 * 3, screen_height - 50)
pygame.display.flip()
guess = None
while guess is None:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_1:
guess = first_artist
elif event.key == pygame.K_2:
guess = second_artist
elif event.key == pygame.K_q:
pygame.quit()
quit()
if artists[guess]["listeners"] > artists[first_artist if guess == second_artist else second_artist]["listeners"]:
score += 1
first_artist, second_artist = random.sample(list(artists.keys()), 2)
# Load the images for the new artists
first_artist_image = pygame.image.load(artists[first_artist]["Image"]).convert()
second_artist_image = pygame.image.load(artists[second_artist]["Image"]).convert()
# Start the game
play_game()
why doesnt anything happen when i ^ress 1 or 2 | 43827c47073de77b77709ddc3a0072ba | {
"intermediate": 0.30203261971473694,
"beginner": 0.44215598702430725,
"expert": 0.25581133365631104
} |
14,289 | how to test such a code: def test_stream(s):
bb = encode_stream(s)
print (len(bb), str(bb))
ss = decode_stream(bb)
n = 0
for i,c in enumerate(s):
n += ss[i]
print (i,s[i],n,ss[i])
print (ss[len(s):])
import sys
test_stream([int(l) for l in sys.stdin]) | 57c8e998e00e0677ba8c1b567463f12f | {
"intermediate": 0.3589977025985718,
"beginner": 0.4489087462425232,
"expert": 0.19209349155426025
} |
14,290 | I used your signal_generator code: def signal_generator(df):
# Calculate EMA and MA lines
df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
df['MA10'] = df['Close'].rolling(window=10).mean()
df['MA20'] = df['Close'].rolling(window=20).mean()
df['MA50'] = df['Close'].rolling(window=50).mean()
df['MA100'] = df['Close'].rolling(window=100).mean()
# Extract necessary prices from df
# Extract necessary prices from df
open_price = df.Open.iloc[-1]
close_price = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]
# Calculate the last candlestick
last_candle = df.iloc[-1]
current_price = df.Close.iloc[-1]
# Initialize analysis variables
ema_analysis = []
candle_analysis = []
# EMA greatest line strategy - buy signal
if (
df.EMA10.iloc[-1] > df.EMA50.iloc[-1] and
df.EMA50.iloc[-1] > df.EMA100.iloc[-1] and
df.EMA100.iloc[-1] > df.EMA200.iloc[-1] and
close_price > max(df['EMA10'].iloc[-2], df['EMA50'].iloc[-2], df['EMA100'].iloc[-2], df['EMA200'].iloc[-2])
):
ema_analysis.append('buy')
# EMA greatest line strategy - sell signal
elif (
df.EMA10.iloc[-1] < df.EMA50.iloc[-1] and
df.EMA50.iloc[-1] < df.EMA100.iloc[-1] and
df.EMA100.iloc[-1] < df.EMA200.iloc[-1] and
close_price < min(df['EMA10'].iloc[-2], df['EMA50'].iloc[-2], df['EMA100'].iloc[-2], df['EMA200'].iloc[-2])
):
ema_analysis.append('sell')
# Check for bullish candlestick pattern - buy signal
if (
open_price < close_price and
previous_open > previous_close and
close_price > previous_open and
open_price <= previous_close
):
candle_analysis.append('buy')
# Check for bearish candlestick pattern - sell signal
elif (
open_price > close_price and
previous_open < previous_close and
close_price < previous_open and
open_price >= previous_close
):
candle_analysis.append('sell')
# Combine all analysis into final signal
ema_signal = 'buy' if 'buy' in ema_analysis else 'sell' if 'sell' in ema_analysis else ''
candle_signal = 'buy' if 'buy' in candle_analysis else 'sell' if 'sell' in candle_analysis else ''
if ema_signal == 'buy' and candle_signal == 'buy':
return 'buy'
elif ema_signal == 'sell' and candle_signal == 'sell':
return 'sell'
else:
return ''
But it gave me signal whcih gave me loss , give me right code which will give me right signals | bfd336a5737c49fa19b3354a4b2903b6 | {
"intermediate": 0.32932597398757935,
"beginner": 0.4049084484577179,
"expert": 0.26576563715934753
} |
14,291 | I used your signal_generator code: def signal_generator(df):
# Calculate EMA and MA lines
df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
df['MA10'] = df['Close'].rolling(window=10).mean()
df['MA20'] = df['Close'].rolling(window=20).mean()
df['MA50'] = df['Close'].rolling(window=50).mean()
df['MA100'] = df['Close'].rolling(window=100).mean()
# Extract necessary prices from df
open_price = df.Open.iloc[-1]
close_price = df.Close.iloc[-1]
previous_open = df.Open.iloc[-2]
previous_close = df.Close.iloc[-2]
# Calculate the last candlestick
last_candle = df.iloc[-1]
current_price = df.Close.iloc[-1]
# Initialize analysis variables
ema_analysis = []
candle_analysis = []
# EMA greatest line strategy - buy signal
if (
df.EMA10.iloc[-1] > df.EMA50.iloc[-1] > df.EMA100.iloc[-1] > df.EMA200.iloc[-1] and
close_price > max(df['EMA10'].iloc[-2], df['EMA50'].iloc[-2], df['EMA100'].iloc[-2], df['EMA200'].iloc[-2])
):
ema_analysis.append('buy')
# EMA greatest line strategy - sell signal
elif (
df.EMA10.iloc[-1] < df.EMA50.iloc[-1] < df.EMA100.iloc[-1] < df.EMA200.iloc[-1] and
close_price < min(df['EMA10'].iloc[-2], df['EMA50'].iloc[-2], df['EMA100'].iloc[-2], df['EMA200'].iloc[-2])
):
ema_analysis.append('sell')
# Check for bullish candlestick pattern - buy signal
if (
open_price < close_price and
previous_open > previous_close and
close_price > previous_open and
open_price <= previous_close
):
candle_analysis.append('buy')
# Check for bearish candlestick pattern - sell signal
elif (
open_price > close_price and
previous_open < previous_close and
close_price < previous_open and
open_price >= previous_close
):
candle_analysis.append('sell')
# Combine all analysis into final signal
ema_signal = 'buy' if 'buy' in ema_analysis else 'sell'
candle_signal = 'buy' if 'buy' in candle_analysis else 'sell'
return ema_signal, candle_signal
But it doesn't have counting system , please add counting system based on my example, example: if EMA_signal giveing signal to buy + candle_signal giveing signal to buy return buy , elif EMA_signal giveing signal to sell + candle_signal giveing signal to sell return sell else : return '' | dfadf5fc800a8bd8f98f13b24faf20db | {
"intermediate": 0.3471031188964844,
"beginner": 0.41510942578315735,
"expert": 0.23778744041919708
} |
14,292 | provide me an example of a simple springboot project using redis (spring datar redis) to rate limit an api, showing the necessary configuration to connect to the running redis instance | c7fa41f538892fe364d6b0fda23c4998 | {
"intermediate": 0.8547870516777039,
"beginner": 0.04783835634589195,
"expert": 0.09737464785575867
} |
14,293 | freertos version of kthread_run() | 729c3cf693db2a4b9c4a6003a3d8f320 | {
"intermediate": 0.3247969150543213,
"beginner": 0.3135870397090912,
"expert": 0.3616161048412323
} |
14,294 | what string.concat in js do | c7818de08df4b53b1d575489135e288c | {
"intermediate": 0.2858008146286011,
"beginner": 0.5100080370903015,
"expert": 0.2041911482810974
} |
14,295 | # While loop exercise
# Print all numbers from 0 up to, but not including, 10 | 9691ecb2ee3f0195f98bbde6c6295e24 | {
"intermediate": 0.20138758420944214,
"beginner": 0.6180963516235352,
"expert": 0.18051598966121674
} |
14,296 | hi | bda291c44378a953387947a0a92004cf | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
14,297 | can this code for a swing piano keyboard layout be trnsfered to a javafx piano layout ?JLayeredPane layeredPane = new JLayeredPane();
layeredPane.setPreferredSize(new Dimension(980, 101)); // x,y size of keyboard
add(layeredPane, BorderLayout.CENTER);
// White Keys
for (int i = 0; i < 49; i++) {
JButton whiteKey = new JButton();
String key = ("A" + i); // Map the keys from A to T
keyButtons.put(key, whiteKey);
whiteKey.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JButton button = keyButtons.get(key);
// todo, look at code end xx3 to override jbutton and set text atbottom
// Perform action for white key
System.out.println(" White Key pressed");
}
});
whiteKey.setBounds(i * 20, 0, 20, 100);
layeredPane.add(whiteKey, Integer.valueOf(0));
}
// Black Keys
for (int i = 0; i < 49; i++) {
if (i % 7 != 2 && i % 7 != 6) { // Skip black keys for E and B
JButton blackKey = new JButton();
String key = ("A" + i); // Map the keys from A to T
keyButtons.put(key, blackKey);
blackKey.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JButton button = keyButtons.get(key);
// Perform action for black key
System.out.println(" Black Key pressed");
}
});
blackKey.setBackground(Color.BLACK);
if ((i + 1) % 7 == 2) { // If next white key is C
blackKey.setBounds((i + 1) * 20 - 5, 0, 10, 60);
} else { // If next white key is F
blackKey.setBounds(i * 20 + 15, 0, 10, 60);
}
layeredPane.add(blackKey, new Integer(1));
}
} | f355e540b28ccb7fdc3372398df593e8 | {
"intermediate": 0.37340155243873596,
"beginner": 0.4219806492328644,
"expert": 0.20461778342723846
} |
14,298 | how i can remove a culmon in sqllite | 004a13eaa63b022e8d61c49cddc61600 | {
"intermediate": 0.26707708835601807,
"beginner": 0.34588271379470825,
"expert": 0.3870401978492737
} |
14,299 | create a merge sort code which takes in number of elements to sort and randomnly generates the number from 1 to 9 ,it should also calculate the total time taken to complete the merge sort write in java | 22a5c353e39091c8185df1e685e3bc72 | {
"intermediate": 0.32103562355041504,
"beginner": 0.08704667538404465,
"expert": 0.5919176936149597
} |
14,300 | kthread_should_stop | 9f4f5e8a842d943db436f54fdf103e3d | {
"intermediate": 0.28615933656692505,
"beginner": 0.3368217647075653,
"expert": 0.37701889872550964
} |
14,301 | create a merge sort java program import all necessary packages to ,i am running in ecllipse,take in input from user for how many elements to sort and create those many random elements using random package the number should be less than ten and not zero and also calculate time taken to complete the program | 15d3a6d1f96244b3653378c285ce2b34 | {
"intermediate": 0.5214306116104126,
"beginner": 0.07447223365306854,
"expert": 0.40409713983535767
} |
14,302 | mean = data3[data3['Initials'] =='Dr']['Age'].mean()
data3[data3['Initials'] =='Dr']['Age'].fillna(mean, inplace=True)
This code not filling NA in column 'Age', why? | 46083dfde8df775efca6476a2b7ef1ca | {
"intermediate": 0.5025558471679688,
"beginner": 0.24603234231472015,
"expert": 0.2514118254184723
} |
14,303 | in freertos, will a task be immediately preempted when i increase a priority of a lower priority task to be higer than this task? | df69da7a2ce8a70798a9ecc7204da732 | {
"intermediate": 0.2875092625617981,
"beginner": 0.15833282470703125,
"expert": 0.5541579127311707
} |
14,304 | опиши что делает этот код и напиши тесты для него используя jest
type Params = {
innerElement: HTMLElement;
container: HTMLElement;
bottomOffset?: number;
};
export const getScrollHeight = ({ innerElement, container, bottomOffset = 0 }: Params) => {
if (innerElement.offsetTop + innerElement.clientHeight > container.clientHeight - bottomOffset) {
return innerElement.offsetTop - (container.clientHeight - innerElement.clientHeight - bottomOffset);
}
return 0;
}; | a0f62d03e6f3d77fdd46c9f5aa5f83da | {
"intermediate": 0.3833521604537964,
"beginner": 0.39301005005836487,
"expert": 0.22363784909248352
} |
14,305 | опиши что делает этот код и напиши тесты для него используя jest
type Params = {
innerElement: HTMLElement;
container: HTMLElement;
bottomOffset?: number;
};
export const getScrollHeight = ({ innerElement, container, bottomOffset = 0 }: Params) => {
if (innerElement.offsetTop + innerElement.clientHeight > container.clientHeight - bottomOffset) {
return innerElement.offsetTop - (container.clientHeight - innerElement.clientHeight - bottomOffset);
}
return 0;
}; | 2805041b798ff88508336e560d8c951e | {
"intermediate": 0.3900282382965088,
"beginner": 0.37305235862731934,
"expert": 0.23691938817501068
} |
14,306 | опиши что делает этот код и напиши тесты для него используя jest
type Params = {
innerElement: HTMLElement;
container: HTMLElement;
bottomOffset?: number;
};
export const getScrollHeight = ({ innerElement, container, bottomOffset = 0 }: Params) => {
if (innerElement.offsetTop + innerElement.clientHeight > container.clientHeight - bottomOffset) {
return innerElement.offsetTop - (container.clientHeight - innerElement.clientHeight - bottomOffset);
}
return 0;
}; | 8669efe0a1729269a7234394d700031e | {
"intermediate": 0.3900282382965088,
"beginner": 0.37305235862731934,
"expert": 0.23691938817501068
} |
14,307 | what means initials ‘Dr’? | 3250524b71aa13ad7ebe8b887edb9f15 | {
"intermediate": 0.3109248876571655,
"beginner": 0.3294474184513092,
"expert": 0.35962772369384766
} |
14,308 | init_waitqueue_head | 736a552178d9bc733ad0d7d35110f558 | {
"intermediate": 0.29248425364494324,
"beginner": 0.3238227367401123,
"expert": 0.38369300961494446
} |
14,309 | опиши что делает этот код и напиши тесты для него используя jest
type Params = {
innerElement: HTMLElement;
container: HTMLElement;
bottomOffset?: number;
};
export const getScrollHeight = ({ innerElement, container, bottomOffset = 0 }: Params) => {
if (innerElement.offsetTop + innerElement.clientHeight > container.clientHeight - bottomOffset) {
return innerElement.offsetTop - (container.clientHeight - innerElement.clientHeight - bottomOffset);
}
return 0;
}; | 7ed88b50e8862582adea78ffeddddbdb | {
"intermediate": 0.3900282382965088,
"beginner": 0.37305235862731934,
"expert": 0.23691938817501068
} |
14,310 | опиши что делает этот код и напиши тесты для него используя jest
type Params = {
innerElement: HTMLElement;
container: HTMLElement;
bottomOffset?: number;
};
export const getScrollHeight = ({ innerElement, container, bottomOffset = 0 }: Params) => {
if (innerElement.offsetTop + innerElement.clientHeight > container.clientHeight - bottomOffset) {
return innerElement.offsetTop - (container.clientHeight - innerElement.clientHeight - bottomOffset);
}
return 0;
}; | 792194ca29ca651946a793b23c13f78c | {
"intermediate": 0.3900282382965088,
"beginner": 0.37305235862731934,
"expert": 0.23691938817501068
} |
14,311 | оптимизируй функцию: def __call__(self, razbor):
line = " ".join([_["text"] for _ in razbor])
processed = self.pipeline.process(line, self.error)
answer = '\n'.join(re.findall("^\d+.+\n", processed, re.M))
answer_lines = answer.split("\n")
answer_lines = [line.split("\t") for line in answer_lines]
for i, row in enumerate(answer_lines):
feats = row[5].split("|") if "|" in row[5] else []
self._update_token(razbor[i+1], {
"head_id": int(row[6]),
"rel": row[7],
"pos": row[3],
**UD2OpenCorpora({_.split("=")[0]: _.split("=")[1] for _ in feats},)
})
break | d7287e2b528353bea9aa0fc1761d58f2 | {
"intermediate": 0.4541703164577484,
"beginner": 0.38294875621795654,
"expert": 0.16288089752197266
} |
14,312 | исправить ошибку
import json
import requests
from pprint import pprint
token = 'y0_AQAAAABjzbrxAAhSRgAAAADLeXue6m1bxVOZSMiw5nR6v6aekQcMVz8'
headers = {'Authorization': 'OAuth ' + token}
params2 = {'metrics': 'ym:s:visits,ym:s:goal137595631reaches',
'dimensions': 'ym:s:lastTrafficSource',
'date1': '2020-10-07',
'date2': '2020-10-09',
'ids': 30177909,
'accuracy':'full',
'limit':100000}
response = requests.get('https://api-metrika.yandex.net/stat/v1/data', params=params2, headers=headers)
print (response.status_code)
metrika_data2 = response.json()
metrika_df2 = pd.DataFrame(metrika_data2['data'])
metrika_list_of_dicts2 = getMetrikaDataInListOfDicts(metrika_data2)
metrika_df2 = pd.DataFrame(metrika_list_of_dicts2)
metrika_df2.columns=['Source','Visits','Conversions']
metrika_df2['Last click CR%'] = metrika_df2['Conversions']/metrika_df2['Visits']
display(metrika_df2.head(10)) | de4db1275208ac9bdaca65550adc27ca | {
"intermediate": 0.4447910487651825,
"beginner": 0.3572499454021454,
"expert": 0.1979590654373169
} |
14,313 | implement a new data structure in assembly code | 13598faac797ec87e629c24f6a16a779 | {
"intermediate": 0.4877782166004181,
"beginner": 0.19450663030147552,
"expert": 0.31771519780158997
} |
14,314 | найти и исправить ошибку
import json
import requests
from pprint import pprint
token = 'y0_AQAAAABjzbrxAAhSRgAAAADLeXue6m1bxVOZSMiw5nR6v6aekQcMVz8'
headers = {'Authorization': 'OAuth ' + token}
params2 = {'metrics': 'ym:s:visits,ym:s:goal137595631reaches',
'dimensions': 'ym:s:lastTrafficSource',
'date1': '2020-10-07',
'date2': '2020-10-09',
'ids': 30177909,
'accuracy':'full',
'limit':100000}
response = requests.get('https://api-metrika.yandex.net/stat/v1/data', params=params2, headers=headers)
print (response.status_code)
metrika_data2 = response.json()
metrika_df2 = pd.DataFrame(metrika_data2['data'])
metrika_list_of_dicts2 = getMetrikaDataInListOfDicts(metrika_data2)
metrika_df2 = pd.DataFrame(metrika_list_of_dicts2)
metrika_df2.columns=['Source','Visits','Conversions']
metrika_df2['Last click CR%'] = metrika_df2['Conversions']/metrika_df2['Visits']
display(metrika_df2.head(10))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[3], line 18
15 print (response.status_code)
17 metrika_data2 = response.json()
---> 18 metrika_df2 = pd.DataFrame(metrika_data2['data'])
19 metrika_list_of_dicts2 = getMetrikaDataInListOfDicts(metrika_data2)
20 metrika_df2 = pd.DataFrame(metrika_list_of_dicts2)
NameError: name 'pd' is not defined | 63af4b09a929e9b1cad36aced0f69871 | {
"intermediate": 0.3544221818447113,
"beginner": 0.4455844461917877,
"expert": 0.19999338686466217
} |
14,315 | implement a freertos version of strncmp() | d78830d342c6cd16b8e62ba3bac5a1b7 | {
"intermediate": 0.2525547444820404,
"beginner": 0.21343258023262024,
"expert": 0.5340126156806946
} |
14,316 | import json
import pandas as pd
import requests
from pprint import pprint
token = 'y0_AQAAAABjzbrxAAhSRgAAAADLeXue6m1bxVOZSMiw5nR6v6aekQcMVz8'
С помощью какого метода можно убрать лишние столбцы из нашего датасета?
Ответ запишите в формате pandas.DataFrame.XXXXXXX
headers = {'Authorization': 'OAuth ' + token}
params2 = {'metrics': 'ym:s:visits,ym:s:goal137595631reaches',
'dimensions': 'ym:s:lastTrafficSource',
'date1': '2020-10-07',
'date2': '2020-10-09',
'ids': 30177909,
'accuracy':'full',
'limit':100000}
response = requests.get('https://api-metrika.yandex.net/stat/v1/data', params=params2, headers=headers)
print (response.status_code)
def getMetrikaDataInListOfDicts(metrika_data):
list_of_dicts = []
dimensions_list = metrika_data['query']['dimensions']
metrics_list = metrika_data['query']['metrics']
for data_item in metrika_data['data']:
d = {}
for i,dimension in enumerate(data_item['dimensions']):
d[dimensions_list[i]] = dimension['name']
for i,metric in enumerate(data_item['metrics']):
d[metrics_list[i]] = metric
list_of_dicts.append(d)
return list_of_dicts | e265b9a8a6cc809bfaa7aef7070d9e6f | {
"intermediate": 0.5210585594177246,
"beginner": 0.35078197717666626,
"expert": 0.12815944850444794
} |
14,317 | what is the code in R for getting a list of all files and folders with full path specified | 42bdc2782c44c1e88933bed15eb60182 | {
"intermediate": 0.4774796962738037,
"beginner": 0.17907756567001343,
"expert": 0.34344276785850525
} |
14,318 | Hello | 12853e9f7ca08cc0911236794331f41f | {
"intermediate": 0.3123404085636139,
"beginner": 0.2729349136352539,
"expert": 0.4147246778011322
} |
14,319 | write a code for wechat in-built app for marketing purpose | 18c8d709a2c6b6192ceb43f050090bae | {
"intermediate": 0.3973746597766876,
"beginner": 0.25973522663116455,
"expert": 0.34289005398750305
} |
14,320 | WITH RECURSIVE topic_parent(id, path) AS (
SELECT
id, ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT
t.id, path || t.id
FROM
topics t
INNER JOIN topic_parent rt ON rt.id = t.parent
),
cte2 as (
select *, unnest(path) AS linked_id
from topic_parent
)
select task_id, max(task) as task_name, max(name) as topic_name, linked_id as topic_id
from cte2 c
inner join tasks_topics t on c.id = t.topics_id
inner join tasks t2 on t2.id = t.task_id
inner join topics t3 on t3.id = c.linked_id
group by task_id, linked_id
order by task_id asc, linked_id desc Как работает этот рекурсивный запрос? | f59774ef6264751a7c58251e7022cc08 | {
"intermediate": 0.36014676094055176,
"beginner": 0.20972424745559692,
"expert": 0.4301290214061737
} |
14,321 | Tell me the number of tokens of the follwing prompts | 0d9b7d988003e0fac6145ba0bbd2b327 | {
"intermediate": 0.3522562086582184,
"beginner": 0.36236971616744995,
"expert": 0.28537407517433167
} |
14,322 | how arm trusted zone achieve security | 41ebf15ee0f8001f67067bb8d799f2c1 | {
"intermediate": 0.3148197829723358,
"beginner": 0.32837000489234924,
"expert": 0.35681018233299255
} |
14,323 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | fb2d5639fb07352f69ed5eda0f0d302f | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,324 | how to use DropdownSearch as reusable widget in flutter | 3b1043b0ba2cd0bd3522da462de08130 | {
"intermediate": 0.5059855580329895,
"beginner": 0.27348583936691284,
"expert": 0.22052857279777527
} |
14,325 | почему при скачивании nessusa на ubuntu выскакивает такая ошибка и как её исправить bash: tee/etc/apt/sources.list.d/nessus.list: No such file or directory | b8dbdfdff9372df1ac60ee5de28ed335 | {
"intermediate": 0.3748294413089752,
"beginner": 0.3971770703792572,
"expert": 0.22799348831176758
} |
14,327 | ь запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 49a562689ea5a3aa9bb805e67c3e0b5b | {
"intermediate": 0.29642537236213684,
"beginner": 0.6001445651054382,
"expert": 0.10343004763126373
} |
14,328 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 2738e9e0ce749e3daae48959e458ac48 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,329 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | b9f433940adda8567e51c82b3088bb47 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,330 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | b72c10e28a9c42c53ae7a6e00e6f3bd2 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,331 | I want a vba code that will perform the following functions on cell change;
On entering a value 'b' anywhere in range AC3:AG18,
determine the row offset position of value 'b' relative to the right of range AB3:AB18.
On the same row as value 'b' determine the value in range AB3:AB18 then search the range D3:D18, L3:L18, T3:T18 for the exact value.
Once the value has been found in the range D3:D18, L3:L18, T3:T18, append the value 'y' with the same offset poistion of value 'b' | a2195f0e72bd058bcf6c86b2210804d5 | {
"intermediate": 0.42194393277168274,
"beginner": 0.18571864068508148,
"expert": 0.39233747124671936
} |
14,332 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 390bbd9d483c68d7298181c13aa98fe4 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,333 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | b43c2c4ddb1620ae7ac6e99259f995de | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,334 | why dosnt it work on kali linux?
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 3B4FE6ACC0B21F32
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 871920D1991BC93C | 2180ba015c348b19e3317c286a1b813d | {
"intermediate": 0.2831782400608063,
"beginner": 0.3926128149032593,
"expert": 0.32420891523361206
} |
14,335 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 9b8de13a4cee509d8a90ee759bdbf436 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,336 | css how make the body content vertical middle | 80c6c37ce1721f0f16c049b6b299dd11 | {
"intermediate": 0.34564462304115295,
"beginner": 0.30697575211524963,
"expert": 0.3473796248435974
} |
14,337 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | bec8230af5df7fce5a2c26e24a425f1d | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,338 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 353737cc7eaefb30b090af4b49164b43 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,339 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 4a6ff3c4fdccd466bfcc131b499fbc9e | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,340 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | db2841c90d5f2186e56227e8b034fa86 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,341 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 103feaf3ccd8a54cfaf8a629c209d9d6 | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,342 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 5e3b643bf2f0741882cf94d0dae1868b | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,343 | Есть запрос в potresql
WITH RECURSIVE topic_parent(id, path) AS
(SELECT id,
ARRAY[id]
FROM topics
WHERE parent = 0
UNION
SELECT t.id,
path || t.id
FROM topics t
INNER JOIN topic_parent rt
ON rt.id = t.parent ), limited_tasks AS
(SELECT * FROM public.tasks
ORDER BY id ASC
LIMIT 100 )
SELECT limited_tasks.id,
limited_tasks.task,
limited_tasks.answer,
array_agg(DISTINCT topics.name) AS topic_name
FROM limited_tasks
INNER JOIN tasks_topics
ON limited_tasks.id = tasks_topics.task_id
INNER JOIN
(SELECT *,
unnest(path) AS linked_id
FROM topic_parent) cte2
ON cte2.id = tasks_topics.topics_id
INNER JOIN topics
ON topics.id = cte2.linked_id
GROUP BY limited_tasks.id, limited_tasks.task, limited_tasks.answer
ORDER BY limited_tasks.id ASC
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 7c1c2d162a6fa29e7b7948ea3aeb512f | {
"intermediate": 0.21325984597206116,
"beginner": 0.7003286480903625,
"expert": 0.0864114835858345
} |
14,344 | I have a nextjs frontend, I then have a nestjs backend using graphql apollo, prisma. Show me how step by step how I could upload images from the frontend to a cloud storage solution and then store the uploaded files urls into my db in code | fc318f40da615006334707f2384ab1b4 | {
"intermediate": 0.9125494360923767,
"beginner": 0.0307192113250494,
"expert": 0.05673135817050934
} |
14,345 | I have a nextjs frontend, I then have a nestjs backend using graphql apollo, prisma. Show me how step by step how I could upload images from the frontend to cloudinary and then store the uploaded files urls into my db | b5555ef626ae1767937392cabb68c5e7 | {
"intermediate": 0.8941652774810791,
"beginner": 0.035672616213560104,
"expert": 0.0701621025800705
} |
14,346 | I have a nextjs frontend, I then have a nestjs backend using graphql apollo, prisma. Show me how step by step how I could upload images from the frontend to a cloud storage solution and then store the uploaded files urls into my db in code | e1a14b626d73ab50f41f998fb70358cf | {
"intermediate": 0.9125494360923767,
"beginner": 0.0307192113250494,
"expert": 0.05673135817050934
} |
14,347 | Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngChange As Range
Set rngChange = Intersect(Target, Me.Range("AC3:AG18"))
If Not rngChange Is Nothing Then
Call ThisWeek
End If
End Sub
Sub ThisWeek()
Dim rngChange As Range
Dim rngValues As Range
Dim rngOffset As Range
Set rngChange = Intersect(Target, Me.Range("AC3:AG18"))
Set rngValues = Me.Range("AB3:AB18")
Set rngOffset = rngValues.Offset(, -1) ' Offset by 1 column to the left (AB -> AA)
Dim cell As Range
For Each cell In rngChange
If cell.Value = "b" Then
Dim rowNum As Long
rowNum = cell.Row - rngChange.Rows(1).Row + 1 ' Calculate the relative row number
Dim lookupValue As Variant
lookupValue = rngValues.Cells(rowNum, 1).Value ' Get the corresponding value from AB3:AB18
Dim resultRng As Range
Set resultRng = Union(Me.Range("D3:D18"), Me.Range("L3:L18"), Me.Range("T3:T18"))
Dim resultCell As Range
Set resultCell = resultRng.Find(lookupValue, LookIn:=xlValues)
If Not resultCell Is Nothing Then
Dim offsetVal As Long
offsetVal = rngChange.Columns(1).Column - rngOffset.Columns(1).Column - 1 ' Calculate the offset
Dim resultOffset As Range
Set resultOffset = resultCell.Offset(, offsetVal)
If resultOffset.Value = "z" Then
resultOffset.Value = "y"
Else
MsgBox "Current Bay is not Free on this day. Only Paking Spaces marked 'z' are free on the day"
cell.Value = "" ' Reset the rejected "b" value to empty
Exit Sub
End If
End If
End If
Next cell
End Sub . . . I am getting an error on this line of code in the Sub ThisWeek(); Set rngChange = Intersect(Target, Me.Range("AC3:AG18")) | c2a4b7dd3b621e875bc34484068c0eac | {
"intermediate": 0.40582576394081116,
"beginner": 0.32952338457107544,
"expert": 0.2646508812904358
} |
14,348 | Hi, a script to read branches in a root file by using uproot | 5f0239632b7dc5de018fdd3f5b3b17e2 | {
"intermediate": 0.38304588198661804,
"beginner": 0.24219770729541779,
"expert": 0.3747563660144806
} |
14,349 | how to dockerize my rails app that uses a postgres database | 25b82997c759d6c463e49e4dc2922633 | {
"intermediate": 0.6117929816246033,
"beginner": 0.2373279631137848,
"expert": 0.15087905526161194
} |
14,350 | write python code to sequantially load several ".csv" files to postgresql database | 5c72f2d5bf5a6fa8339eb1b162e0be99 | {
"intermediate": 0.49871623516082764,
"beginner": 0.1543179750442505,
"expert": 0.3469657897949219
} |
14,351 | ExecuteNonQuery: Connection property has not been initialized. what is this error in vb.net | de919cfaf89b104c7f6e9694c623485d | {
"intermediate": 0.4721032381057739,
"beginner": 0.22182594239711761,
"expert": 0.30607083439826965
} |
14,352 | css for mobile only | cf6ae4d5f4d02094d1309b0ee2dcdb7e | {
"intermediate": 0.30996304750442505,
"beginner": 0.34408238530158997,
"expert": 0.3459545075893402
} |
14,353 | @GetMapping("/v1")
public String testMethod(){
// Get client IP address from the request
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
String ipAddress = "";
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
ipAddress = request.getRemoteAddr();
}
boolean isRateLimited = rateLimitService.checkRateLimit(ipAddress);
if (isRateLimited) {
return "API rate limit exceeded";
}
return "API call successful";
} | 8cb4213bb04fea1ff5dbdb1f63e9e517 | {
"intermediate": 0.41698700189590454,
"beginner": 0.4443591833114624,
"expert": 0.13865382969379425
} |
14,354 | hii | 8749f4737eb4a3382d6bf84278524ff7 | {
"intermediate": 0.3416314125061035,
"beginner": 0.27302300930023193,
"expert": 0.38534557819366455
} |
14,355 | hi | 732058b5b3c3e6a48c9d2be659baad97 | {
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
} |
14,356 | Hello. | 0a39bb5ca0f967001c1101952a992f3a | {
"intermediate": 0.3136391341686249,
"beginner": 0.2352733314037323,
"expert": 0.4510875344276428
} |
14,357 | need a full professional SVG code for a figure with the following description
" Figure 1: Effectiveness of Machine Learning Techniques in IoT Security Management
This figure could be a bar graph that demonstrates the effectiveness of various Machine Learning techniques in enhancing the security of cloud-based IoT systems. The X-axis represents the different ML techniques used in the study (i.e., Decision Trees, Random Forest, Support Vector Machines, and Convolutional Neural Networks). The Y-axis represents the accuracy rate of threat detection by each technique.
Each bar's height would correspond to the accuracy rate achieved by each ML technique. For instance, the bar for Convolutional Neural Networks would be the highest, indicating its superior accuracy rate of 98%.
Additionally, the figure could include horizontal lines indicating the improvements in threat detection, prevention, response, and system recovery, demonstrating the holistic approach's effectiveness in enhancing all aspects of IoT security management."
the code must working | 41fad3c5305ad947af5d6bd0131b604c | {
"intermediate": 0.24866753816604614,
"beginner": 0.20225562155246735,
"expert": 0.5490768551826477
} |
14,358 | Hi there. | 9adf0c63d5f6f3225a14fcba5a86612d | {
"intermediate": 0.3218245506286621,
"beginner": 0.24420461058616638,
"expert": 0.4339708983898163
} |
14,359 | How do i detect the player's mouse is hovering over a part in the workspace in a roblox studio script | f816b9c61cea984ede92d94e7400a87e | {
"intermediate": 0.48010894656181335,
"beginner": 0.2250111699104309,
"expert": 0.2948799133300781
} |
14,360 | test | 27d6fcf3c328ac532abbcc88ece69dba | {
"intermediate": 0.3229040801525116,
"beginner": 0.34353747963905334,
"expert": 0.33355844020843506
} |
14,361 | Range B2:Y18 holds data for the current week which always starts on a Monday
Range B21:Y37 holds data for the next week which always starts on Monday
Range B39:Y54 holds data for a week which always starts on Monday
Values in both Range B2:Y18 and in B21:Y37 are always manually adjusted
Values in Range B39:Y54 are never adjusted
Cell B1 always shows the Date of Monday for the current week generated by the formula; = TODAY() - WEEKDAY(TODAY(), 2) + 1
Cell B20 always shows the Date of Monday for the next week generated by the formula; = TODAY() - WEEKDAY(TODAY(), 2) + 8
When the sheet is opened for the first time at the start of every week,
the values only in Range B21:Y37 must be copied to Range B2:Y18 and once that is done,
the values only in Range B39:Y54 must be copied to Range B21:Y37.
This copy and paste sequence must only happen once when the sheet is opened for the first time in a current week.
How can I do this with VBA code and how do I set the trigger to perform the copy and paste and how do I make sure that once it has done the copy and paste sequence it does not do it again until the next week. | 013db4d39c785b78e5e92b0bc8606cdc | {
"intermediate": 0.45937204360961914,
"beginner": 0.24469462037086487,
"expert": 0.2959333658218384
} |
14,362 | есть таблица potresql со следующими значениями Id parentpath
6 {1,2,9,16}
6 {1,2,3,6,18}
6 {1,2,9,11,17}
А Я хочу получить массив оригинальных чисел, сгруппировав по id
Id parentpath
6 {1,2,3,6,9,11,16,17,18} | 6fe9e2e3ac97151656a16bc4615a7502 | {
"intermediate": 0.34789541363716125,
"beginner": 0.2747953236103058,
"expert": 0.37730923295021057
} |
14,363 | есть таблица potresql со следующими значениями Id parentpath
6 {1,2,9,16}
6 {1,2,3,6,18}
6 {1,2,9,11,17}
А Я хочу получить массив оригинальных чисел, сгруппировав по id
Id parentpath
6 {1,2,3,6,9,11,16,17,18} | 8800b06a57af219ea2dff072c3d8ee76 | {
"intermediate": 0.34789541363716125,
"beginner": 0.2747953236103058,
"expert": 0.37730923295021057
} |
14,364 | import pygame
import random
# Define the screen dimensions
SCREEN_WIDTH = 1500
SCREEN_HEIGHT = 800
# Define the colors
BLACK = (0, 0, 0)
# Define the artists and their monthly Spotify listeners
artists = {
"$NOT": {"Image":"./fotos/$NOT/$NOT_1.jpeg", "listeners": 7781046},
"21 Savage": {"Image":"./fotos/21_Savage/21 Savage_1.jpeg", "listeners": 60358167},
"9lokknine": {"Image":"./fotos/9lokknine/9lokknine_1.jpeg", "listeners": 1680245},
"A Boogie Wit Da Hoodie": {"Image":"./fotos/A_Boogie_Wit_Da_Hoodie/A Boogie Wit Da Hoodie_1.jpeg", "listeners": 18379137},
"Ayo & Teo": {"Image":"./fotos/Ayo_&_Teo/Ayo & Teo_1.jpeg", "listeners": 1818645},
"Bhad Bhabie": {"Image":"./fotos/Bhad_Bhabie/Bhad Bhabie_1.jpeg", "listeners": 1915352},
"Blueface": {"Image":"./fotos/Blueface/Blueface_1.jpeg", "listeners": 4890312},
"Bobby Shmurda": {"Image":"./fotos/Bobby_Shmurda/Bobby Shmurda_1_.jpeg", "listeners": 2523069},
"Cardi B": {"Image":"./fotos/Cardi_B/Cardi B_1.jpeg", "listeners": 30319082},
"Central Cee": {"Image":"./fotos/Central_Cee/Central Cee_1.jpeg", "listeners": 22520846},
"Chief Keef": {"Image":"./fotos/Chief_Keef/Chief Keef_1.jpeg", "listeners": 9541580},
}
# Initialize the game
pygame.init()
# Define the font and font size for the artist names
font = pygame.font.Font(None, 36)
# Initialize the font module
pygame.font.init()
# Initialize the game window and caption
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Guess the Artist")
# Create a clock object to control the frame rate
clock = pygame.time.Clock()
score = 0
while True:
# Select two random artists
first_artist, second_artist = random.sample(list(artists.keys()), 2)
# Render the text surfaces for the artist names
first_artist_text = font.render(f"1 - {first_artist.title()}", True, (255, 255, 255))
second_artist_text = font.render(f"2 - {second_artist.title()}", True, (255, 255, 255))
# Define the desired width and height for the images
image_width = 800
image_height = 600
# Blit the artist names
screen.blit(first_artist_text, (0, image_height))
screen.blit(second_artist_text, (SCREEN_WIDTH // 2, image_height))
# Load the images for the artists
first_artist_image = pygame.image.load(artists[first_artist]["Image"]).convert()
second_artist_image = pygame.image.load(artists[second_artist]["Image"]).convert()
# Resize the first artist's image
first_artist_image = pygame.transform.scale(first_artist_image, (image_width, image_height))
# Resize the second artist's image
second_artist_image = pygame.transform.scale(second_artist_image, (image_width, image_height))
# Display the images
screen.blit(first_artist_image, (0, 0))
screen.blit(second_artist_image, (SCREEN_WIDTH // 2, 0))
# Clear the screen
screen.fill(BLACK)
# Display the images
screen.blit(first_artist_image, (0, 0))
screen.blit(second_artist_image, (SCREEN_WIDTH // 2, 0))
# Update the display
pygame.display.flip()
# Prompt the player for their guess
guess = input(f"\nWhich artist has more monthly Spotify listeners - 1. {first_artist.title()} or 2. {second_artist.title()}? ")
guess_lower = guess.strip().lower()
if guess_lower == 'quit':
print("Thanks for playing!")
break
elif guess_lower not in ['1', '2', first_artist.lower(), second_artist.lower()]:
print("Invalid input. Please enter the name of one of the two artists or 'quit' to end the game.")
elif guess_lower == first_artist.lower() or guess_lower == '1' and artists[first_artist]["listeners"] > artists[second_artist]["listeners"]:
print(f"You guessed correctly! {first_artist.title()} had {artists[first_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners and {second_artist.title()} has {artists[second_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners.")
score += 1
elif guess_lower == second_artist.lower() or guess_lower == '2' and artists[second_artist]["listeners"] > artists[first_artist]["listeners"]:
print(f"You guessed correctly! {second_artist.title()} had {artists[second_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners and {first_artist.title()} has {artists[first_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners.")
score += 1
else:
print(f"\nSorry, you guessed incorrectly. {first_artist.title()} had {artists[first_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners and {second_artist.title()} has {artists[second_artist]['listeners'] / 1e6:.1f}M monthly Spotify listeners.\n")
print(f"Your current score is {score}.")
# AskApologies for the incomplete response. Here's the continuation of the code:
# Ask the player if they want to play again
play_again = input("Would you like to play again? (y/n) ")
if play_again.lower() == 'n':
print(f"Your final score is {score}. Thanks for playing!")
break
else:
score = 0
why arent the names of the artists written unde r the images | 9394ff45427ca0f4ff20a896a506512b | {
"intermediate": 0.282797247171402,
"beginner": 0.5268846154212952,
"expert": 0.19031812250614166
} |
14,365 | in a dockerfile how do I pass the build argument as an environment using ARG and ENV | d2d968629b47552247afe2b52221c83c | {
"intermediate": 0.4000362157821655,
"beginner": 0.23319461941719055,
"expert": 0.3667692244052887
} |
14,366 | import pygame
import random
# Define the screen dimensions
SCREEN_WIDTH = 1500
SCREEN_HEIGHT = 800
# Define the colors
BLACK = (0, 0, 0)
# Define the artists and their monthly Spotify listeners
artists = {
“NOT": {"Image":"./fotos/NOT/$NOT_1.jpeg”, “listeners”: 7781046},
“21 Savage”: {“Image”:“./fotos/21_Savage/21 Savage_1.jpeg”, “listeners”: 60358167},
“9lokknine”: {“Image”:“./fotos/9lokknine/9lokknine_1.jpeg”, “listeners”: 1680245},
“A Boogie Wit Da Hoodie”: {“Image”:“./fotos/A_Boogie_Wit_Da_Hoodie/A Boogie Wit Da Hoodie_1.jpeg”, “listeners”: 18379137},
“Ayo & Teo”: {“Image”:“./fotos/Ayo_&Teo/Ayo & Teo_1.jpeg", “listeners”: 1818645},
“Bhad Bhabie”: {“Image”:“./fotos/Bhad_Bhabie/Bhad Bhabie_1.jpeg”, “listeners”: 1915352},
“Blueface”: {“Image”:“./fotos/Blueface/Blueface_1.jpeg”, “listeners”: 4890312},
“Bobby Shmurda”: {“Image”:"./fotos/Bobby_Shmurda/Bobby Shmurda_1.jpeg”, “listeners”: 2523069},
“Cardi B”: {“Image”:“./fotos/Cardi_B/Cardi B_1.jpeg”, “listeners”: 30319082},
“Central Cee”: {“Image”:“./fotos/Central_Cee/Central Cee_1.jpeg”, “listeners”: 22520846},
}
# Initialize the game
pygame.init()
# Define the font and font size for the artist names
font = pygame.font.Font(None, 36)
# Initialize the font module
pygame.font.init()
# Initialize the game window and caption
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption(“Guess the Artist”)
# Create a clock object to control the frame rate
clock = pygame.time.Clock()
score = 0
while True:
# Select two random artists
first_artist, second_artist = random.sample(list(artists.keys()), 2)
# Define the desired width and height for the images
image_width = 800
image_height = 600
# Load the images for the artists
first_artist_image = pygame.image.load(artists[first_artist][“Image”]).convert()
second_artist_image = pygame.image.load(artists[second_artist][“Image”]).convert()
# Resize the first artist’s image
first_artist_image = pygame.transform.scale(first_artist_image, (image_width, image_height))
# Resize the second artist’s image
second_artist_image = pygame.transform.scale(second_artist_image, (image_width, image_height))
# Display the images
screen.blit(first_artist_image, (0, 0))
screen.blit(second_artist_image, (SCREEN_WIDTH // 2, 0))
# Render the text surfaces for the artist names
first_artist_text = font.render(f"1 - {first_artist.title()}“, True, (255, 255, 255))
second_artist_text = font.render(f"2 - {second_artist.title()}”, True, (255, 255, 255))
# Blit the artist names
screen.blit(first_artist_text, (0, image_height))
screen.blit(second_artist_text, (SCREEN_WIDTH // 2, image_height))
# Clear the screen
screen.fill(BLACK)
# Update the display
pygame.display.flip()
# Prompt the player for their guess
guess = input(f"\nWhich artist has more monthly Spotify listeners - 1. {first_artist.title()} or 2. {second_artist.title()}? “)
guess_lower = guess.strip().lower()
if guess_lower == ‘quit’:
print(“Thanks for playing!”)
break
elif guess_lower not in [‘1’, ‘2’, first_artist.lower(), second_artist.lower()]:
print(“Invalid input. Please enter the name of one of the two artists or ‘quit’ to end the game.”)
elif guess_lower == first_artist.lower() or guess_lower == ‘1’ and artists[first_artist][“listeners”] > artists[second_artist][“listeners”]:
print(f"You guessed correctly! {first_artist.title()} had {artists[first_artist][‘listeners’] / 1e6:.1f}M monthly Spotify listeners and {second_artist.title()} has {artists[second_artist][‘listeners’] / 1e6:.1f}M monthly Spotify listeners.”)
score += 1
elif guess_lower == second_artist.lower() or guess_lower == ‘2’ and artists[second_artist][“listeners”] > artists[first_artist][“listeners”]:
print(f"You guessed correctly! {second_artist.title()} had {artists[second_artist][‘listeners’] / 1e6:.1f}M monthly Spotify listeners and {first_artist.title()} has {artists[first_artist][‘listeners’] / 1e6:.1f}M monthly Spotify listeners.“)
score += 1
else:
print(f”\nSorry, you guessed incorrectly. {first_artist.title()} had {artists[first_artist][‘listeners’] / 1e6:.1f}M monthly Spotify listeners and {second_artist.title()} has {artists[second_artist][‘listeners’] / 1e6:.1f}M monthly Spotify listeners.\n")
print(f"Your current score is {score}.")
# AskApologies for the incomplete response. Here’s the continuation of the code:
# Ask the player if they want to play again
play_again = input("Would you like to play again? (y/n) “)
if play_again.lower() == ‘n’:
print(f"Your final score is {score}. Thanks for playing!”)
break
else:
score = 0
when i play the game the pygame windows opens but there are no images and names | accf2f0a632e6ca51a69294a965363e9 | {
"intermediate": 0.30843618512153625,
"beginner": 0.44075828790664673,
"expert": 0.2508055567741394
} |
14,367 | Есть запрос в potresql
WITH RECURSIVE ParentPaths AS (
SELECT Id, array[Id] AS ParentPath
FROM topics
WHERE parent = 0
UNION ALL
SELECT t.Id, p.ParentPath || t.Id
FROM topics t
JOIN ParentPaths p ON p.Id = t.parent
)
SELECT
tasks.id,
tasks.task,
tasks.answer,
tasks.level,
array_agg(DISTINCT num) AS ParentPath
FROM
ParentPaths
JOIN
tasks_topics ON tasks_topics.topics_id = ParentPaths.Id
JOIN
tasks ON tasks.id = tasks_topics.task_id
LEFT JOIN LATERAL unnest(ParentPaths.ParentPath) AS num ON true
GROUP BY
tasks.id;
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | b10fa5c6cf7f279c964ca50687d922fe | {
"intermediate": 0.26989835500717163,
"beginner": 0.5815881490707397,
"expert": 0.14851349592208862
} |
14,368 | Есть запрос в potresql
WITH RECURSIVE ParentPaths AS (
SELECT Id, array[Id] AS ParentPath
FROM topics
WHERE parent = 0
UNION ALL
SELECT t.Id, p.ParentPath || t.Id
FROM topics t
JOIN ParentPaths p ON p.Id = t.parent
)
SELECT
tasks.id,
tasks.task,
tasks.answer,
tasks.level,
array_agg(DISTINCT num) AS ParentPath
FROM
ParentPaths
JOIN
tasks_topics ON tasks_topics.topics_id = ParentPaths.Id
JOIN
tasks ON tasks.id = tasks_topics.task_id
LEFT JOIN LATERAL unnest(ParentPaths.ParentPath) AS num ON true
GROUP BY
tasks.id;
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table(‘tasks_topics’,
db.Column(‘task_id’, db.Integer, db.ForeignKey(‘tasks.id’)),
db.Column(‘topics_id’, db.Integer, db.ForeignKey(‘topics.id’))
)
class Tasks(db.Model):
tablename = ‘tasks’
searchable = [‘task’,‘id’] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment=“ЧПУ задачи в адресе (транслитом)”)
task = db.Column(db.Text, comment=‘Условие задачи’)
answer = db.Column(db.Text, comment=‘Ответ’)
status = db.Column(db.Boolean, default=0, comment=‘Статус: опубликована/неактивна (по умолчанию нет)’)
created_t = db.Column(db.DateTime, comment=‘Дата и время создания’)
level = db.Column(db.SmallInteger, default=1, comment=‘Уровень сложности: 1,2 … (по умолчанию 1 уровень)’)
# связи
topics = db.relationship(‘Topics’,
secondary=tasks_topics,
back_populates=“tasks”)
class Topics(db.Model):
tablename = ‘topics’
searchable = [‘name’]
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment=“Уникальное название темы(подтемы)”)
parent = db.Column(db.Integer, default=0, comment=“ID родительской темы(если есть)”)
# связи
tasks = db.relationship(‘Tasks’,
secondary=tasks_topics,
back_populates=“topics”)
Как переписать запрос в sql alchemy? | 82eab0eacde78bd3c40c150aeebbfe85 | {
"intermediate": 0.27479803562164307,
"beginner": 0.4330962896347046,
"expert": 0.29210564494132996
} |
14,369 | Есть запрос в potresql
WITH RECURSIVE ParentPaths AS (
SELECT Id, array[Id] AS ParentPath
FROM topics
WHERE parent = 0
UNION ALL
SELECT t.Id, p.ParentPath || t.Id
FROM topics t
JOIN ParentPaths p ON p.Id = t.parent
)
SELECT
tasks.id,
tasks.task,
tasks.answer,
tasks.level,
array_agg(DISTINCT num) AS ParentPath
FROM
ParentPaths
JOIN
tasks_topics ON tasks_topics.topics_id = ParentPaths.Id
JOIN
tasks ON tasks.id = tasks_topics.task_id
LEFT JOIN LATERAL unnest(ParentPaths.ParentPath) AS num ON true
GROUP BY
tasks.id;
И есть классы во flask
# связующая таблица топики задачи
tasks_topics= db.Table('tasks_topics',
db.Column('task_id', db.Integer, db.ForeignKey('tasks.id')),
db.Column('topics_id', db.Integer, db.ForeignKey('topics.id'))
)
class Tasks(db.Model):
__tablename__ = 'tasks'
__searchable__ = ['task','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
url = db.Column(db.String(120), comment="ЧПУ задачи в адресе (транслитом)")
task = db.Column(db.Text, comment='Условие задачи')
answer = db.Column(db.Text, comment='Ответ')
status = db.Column(db.Boolean, default=0, comment='Статус: опубликована/неактивна (по умолчанию нет)')
created_t = db.Column(db.DateTime, comment='Дата и время создания')
level = db.Column(db.SmallInteger, default=1, comment='Уровень сложности: 1,2 ... (по умолчанию 1 уровень)')
# связи
topics = db.relationship('Topics',
secondary=tasks_topics,
back_populates="tasks")
class Topics(db.Model):
__tablename__ = 'topics'
__searchable__ = ['name']
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(140), comment="Уникальное название темы(подтемы)")
parent = db.Column(db.Integer, default=0, comment="ID родительской темы(если есть)")
# связи
tasks = db.relationship('Tasks',
secondary=tasks_topics,
back_populates="topics")
Как переписать запрос в sql alchemy? | 99e7c48b958c7e44756cb5a4419dcabc | {
"intermediate": 0.26989835500717163,
"beginner": 0.5815881490707397,
"expert": 0.14851349592208862
} |
14,370 | Sub ThisWeek(rngChange As Range)
Dim rngValues As Range
Dim rngOffset As Range
Set rngValues = Me.Range("AB3:AB18")
Set rngOffset = rngValues.Offset(, -1) ' Offset by 1 column to the left (AB -> AA)
Dim cell As Range
For Each cell In rngChange
If cell.Value = "b" Then
Dim rowNum As Long
rowNum = cell.Row - rngChange.Rows(1).Row + 1 ' Calculate the relative row number
Dim lookupValue As Variant
lookupValue = rngValues.Cells(rowNum, 1).Value ' Get the corresponding value from AB3:AB18
Dim resultRng As Range
Set resultRng = Union(Me.Range("D3:D18"), Me.Range("L3:L18"), Me.Range("T3:T18"))
Dim resultCell As Range
Set resultCell = resultRng.Find(lookupValue, LookIn:=xlValues)
If Not resultCell Is Nothing Then
Dim offsetVal As Long
offsetVal = rngChange.Columns(1).Column - rngOffset.Columns(1).Column - 1 ' Calculate the offset
Dim resultOffset As Range
Set resultOffset = resultCell.Offset(, offsetVal)
If resultOffset.Value = "z" Then
resultOffset.Value = "y"
Else
MsgBox "Current Bay is not Free on this day. Only Parking Spaces marked 'z' are free on the day."
cell.Value = "" ' Reset the rejected "b" value to empty
Exit Sub
End If
End If
End If
Next cell
End Sub
In this VBA code, I want to change this part of the code,
"For Each cell In rngChange
If cell.Value = "b" Then" . . . What I want the code to do is to run after each "b" has been entered and ignore other values of 'b' that may have been entered previously.
If this can be done, then can the Next cell be removed from the code. | a6a427c7fb575ae56c5f228a7841ad7c | {
"intermediate": 0.40971124172210693,
"beginner": 0.39664188027381897,
"expert": 0.19364690780639648
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.