mysql – Why my code only return 1 row? Leetcode#626

You are using an agregate function which causes the result to collapse to single row.
Possible solution:

(CASE WHEN mod(,2)=0 THEN
WHEN mod(,2)=1 AND != maxid.maxid THEN
END) AS id,
FROM seat s
join (select max( as maxId from seat) as maxId on 1=1

You are using it in the SELECT, not CONDITIONAL (WHERE).
Now, the question you ask is a good one and i would have to refresh my knowledge of inner workings of SQL.

I think its because the moment it hits MAX, its collapses the result set, as it doesnt “see” a need to return all rows.

Simply said, the query processor doesnt care if its a condition in case statement or value to be returned. It’s there and thats that.

Aggregation function without group by is a mysql thing, and not SQL standard, so the behaviour is specific to MySQL.

A c++ program to take the size and components of an Array from user and return the reversed Array

I have written this code that should take the size and components of the array from the user and then return the reverse of the Array but not able to identify and fix the error.
My best guess is that the while loop is causing trouble, but I am not sure.

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

// function to reverse given array
void reverseArray(int arr(), int start, int end){

while (start<=end){
    int temp = arr(start);
    arr(start) = arr(end);
    arr(end) = temp;


// function to print given array
void printArray(int arr(), int size){
   for (int i = 0; i < size; i++)
   cout << arr(i) << " ";

int main() {
    int n;
    cin >> n;
    int mainarray() = {n} ; 
    n = sizeof(mainarray);

    for (int i=0; i<n; i++) {
        cin >> mainarray(i);

reverseArray(mainarray , 0, n-1);
printArray(mainarray ,n);

    return 0;

python – The view insertemp.views.Insertrecord didn’t return an HttpResponse object. It returned None instead?
from django.shortcuts import render
from insertemp.models import Empinsert
from django.contrib import messages

def  Insertrecord(request):
    if request.method == 'POST':
        if request.POST.get('empname') and request.POST.get('email') and request.POST.get('country'):
            messages.SUCCESS(request,'your detail saved succeccfullt.......!')
            return render(request,"index.html")
            return render(request,"index.html")
from django.contrib import admin
from django.urls import path
from . import views

urlpatterns = (
    path('', views.Insertrecord),

from django.db import models
class Empinsert(models.Model):

    class meta:
Django settings for insertemp project.

Generated by 'django-admin startproject' using Django 3.1.7.

For more information on this file, see

For the full list of settings and their values, see

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'n7#@rb50!g7yh9_aw@eud++4zv4ee9zgxvrbf0my34pxu=avmc'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True


# Application definition


    'django.contrib.messages.middleware.MessageMiddleware',`enter code here`
ROOT_URLCONF = 'insertemp.urls'
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS':(os.path.join(BASE_DIR, 'templates')),
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': (

WSGI_APPLICATION = 'insertemp.wsgi.application'

# Database

    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '3306',
            'init_command':"SET sql_mode='STRICT_TRANS_TABLES'"

# Password validation

        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',

# Internationalization



USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = '/static/'

Custom shortcode render problem with return ”

I hope you all having a great day. I’m developing a video player plugin with custom shortcodes and stuff but I’m having a problem with the shortcode render. Currently, my shortcode content is rendered with echo which works fine but it doesn’t render inside the page content so I have to change it to return method somehow but it has foreach loops and if else statements inside it so I can’t just do return '<ul> '.foreach($x as $s){}.' </ul> '; and stuff, do you guys know a workaround for this? I’ve also tried to place everything inside a function and tried to render it inside return like this: return "".renderdata().""; which works but again it doesn’t render inside the content.

Here’s my complete shortcode function

function vc_playlist_shortcode( $atts = array() ) {

    // add_action('wp_head', 'deregister_scripts');
    // add_action('wp_enqueue_scripts', 'deregister_scripts');
    // add_action('wp_footer', 'deregister_scripts');
    // get the shortcode attribute value
     'id' => ""
    ), $atts));

    $playlistdata = get_post_meta( $id, 'vc_playlist_data', true );

    // Filter the urls in playlist data and assign it to an array
    $playlisturls = array_filter($playlistdata, function($val){
        return filter_var($val, FILTER_VALIDATE_URL);  
    // rebase the assigned array
    $counter = 0;
    $rebasedurls = array();

    foreach ($playlisturls as $key => $value) {
        $rebasedurls($counter) = $value;
    // trim the '' from the values and keep the ID only
    //$videoIDs = preg_replace('/(^0-9)/', "", $rebasedurls);

    function videostatuschecker($x){
        $unlockedvideos = get_user_meta(wp_get_current_user()->ID, 'vc_unlocked_videos', false);

        if (in_array($x, $unlockedvideos)){
            return 'unlocked';  
            return 'locked';
    // Serve the first video URL to browser so we can access it in our JS function
    echo '<script type="text/javascript">var vc_firstvideo = "".$rebasedurls(0).""</script>';
    echo '<div class="vc-video-container">';
    //echo '<div class="vc-plyr" data-plyr-provider="vimeo" data-plyr-embed-id="".$rebasedurls(0).""></div>';
    echo '<div id="vc-player"></div>';
    echo '<div class="plyr-playlist-wrapper">';
    echo '<ul class="plyr-playlist">';

    foreach($playlistdata as $data){
        if(! filter_var($data, FILTER_VALIDATE_URL)){   
            echo '<span class="plyr-playlist-chapter-title">'.$data.'</span>'; 
            echo '<li class="">';
            echo '<a class="plyr-playlist-link" href="javascript:void(0);" data-video-url="". $data ."" data-status="".videostatuschecker($data)."">';
            echo '<div class="plyr-playlist-thumbnail skeleton"><img class="plyr-miniposter" src="" alt="thumbnail"></div>';
            echo '<span class="plyr-playlist-title skeleton"><span></span></span>';
            echo '</a>';
            echo '</li>';

    echo '</ul>';
    echo '</div>';
    echo '</div>';
    echo '<div class="vc-meta-container">'; 
        echo '<button class="fav-video-button" data-video-url="".$rebasedurls(0)."">Zu Favoriten hinzufügen</button>';
        echo '<div class="autoplay-container"><span class="autoplay-title">Auto Play</span> <div class="toggly-container"> <input type="checkbox" id="autoplay-toggle"> <label class="toggly-label" for="autoplay-toggle"><i class="toggly"></i></label> </div></div>';
    echo '</div>';

    return "";
add_shortcode('vc_playlist', 'vc_playlist_shortcode'); 

Any help is much appreciated, thank you.

google sheets – Function/formula to return only the first string proceeding the first carriage return

Is there a function/formula to return only the first string proceeding the first carriage return using Google Sheets?

Example Text:

Bob & Mary Smith   

Assuming the above text is in cell A1, I would like the formula to return the following to Cell B1 “Bob & Mary Smith”

Transaction cancelled but bitcoin was not return back to my wallet

While your transaction may have been cancelled by whatever system you used, you have to wait for it to cancel out everywhere else too.

Since you only provided a destination wallet and not the actual transaction ID, it’s hard to provide much info. I do, however, see transactions going to the wallet you specified above without issue. It does look like your fee (8.93 sat/B on a 224byte trans) was well below a reasonable fee to be processed in a decent amount of time on the transactions that show up though..

I suggest leveraging to ensure your transactions process in a decent amount of time in the future. Relying on a cancellation is unreliable.

To see your transaction ids, check the following links

you will notice the transaction IDs under the heading “transactions”

MySQL return rows ONLY if ALL the rows in another table have a specified value

I have two tables


Now the data looks like this:

What I need to do is get all the details (efd_details) ONLY if ALL the statuses in efd_detail_status = ‘s’. In the example above, I would retrieve ZERO records since two of the statuses are != ‘s’. If ALL the statuses = ‘s’ then return ALL rows from cms_efd.

I have tried variations of EXISTS and the following:

select e.*
  from cms.cms_efd e
where exists(select 1 
               from cms.cms_efd_status s 
              where s.detail_record_id = e.detail_record_id 
                and IFNULL(s.contrib_calc_status,'f') != 's'
             having count(e.detail_record_id)=count(s.detail_record_id))
    and e.earnings_file_id = 400676;

Appreciate the help.

bitcoin core – Unable to return BlockHashes when I run this generatetoaddress

I have downloaded and fully synced with my Mac last Saturday, my Bitcoin Core version is v0.21.0 and my Bitcoin-Qt version 5.9.8.

I did run other RPC commands such as “getrpcinfo” and it did provide result:

“active_commands”: (
“method”: “getrpcinfo”,
“duration”: 72
“logpath”: “/Users/jsjs77/Library/Application Support/Bitcoin/debug.log”

“getbalance” –

“mine”: {
“trusted”: 0.00000000,
“untrusted_pending”: 0.00000000,
“immature”: 0.00000000

But then, when I want to run this “generatetoaddress nblocks “address” it does not provide block hash result:

generatetoaddress 11 1MDihWw2UfkYyAwrQDWNFbmaH6bx4NBFtL



I have tried the following methods:

bitcoin-cli generatetoaddress 11 1MDihWw2UfkYyAwrQDWNFbmaH6bx4NBFtL.

Method not found (code -32601)


bitcoin-cli -regtest generatetoaddress 11 1MDihWw2UfkYyAwrQDWNFbmaH6bx4NBFtL

Method not found (code -32601)

Is this got to do with the changes of latest version? I really need help. Thanks

enter image description here

KLM refused luggage return during 3 day delay

It is understandable that it is diffcult for them to sort the luggage out and give it to you, but according to the usual rules, they should be responsible for paying for your necessities, as well as the hotels and food, as the delay is their fault. It should be cheaper for them to get your luggage out than to pay for you buying new items, but they may have the choice in that (meaning they probably can choose to give you money instead).

Either way, they are responsible for your cost during the forced stay, and they are legally required to inform you about it. Contact them to get what they owe you, and file a complaint if they don’t want to.

Worst case you can buy some new wardrobe on their nickel, and have some paid vacation in the three days.

Turing machine without return equivalent to Finite Automaton, PushDown Automaton or Turing Machine?

Informally, a pushdown automaton has a way to store and use an infinite amount of memory (the stack). In a Turing machine, the only way to store an infinite amount of memory is to write it on the tape. But in a Turing machine without return, you cannot go back to the cells that you have already written, so that memory can never be used.

That means that a Turing machine without return cannot be “as powerful” as a pushdown automaton. The solution is a finite automaton.

If you want a more formal proof, you can start with the formal definition of a Turing machine without return, note that you can dismiss what you write on the tape (because you can’t go back), and construct a finite automaton that recognize the same language as the Turing machine.