wp query – Meta_query on the same meta key with different values

I try to get users with the meta_query where I have to find users who either have the meta key missing or are empty.

It seems like I'm looking everywhere, I should be able to use the OR for the relation and then use the same meta key, but whatever I set it up, it will not work.

My code:

$ors() = array(
   'key'   => 'death_date',
   'compare' => '=',
   'value' => '',
   'type' => 'NUMERIC'                    
$ors() = array(
   'key'   => 'death_date',
   'compare' => 'NOT EXISTS'                    

$args = array(
   'meta_query' => array(
   'relation' => 'or',

$return = get_users($args);

Both work separately, but not together.

postgresql – Efficient storage of key values ​​in Postgres

I want to use Postgres (11 in CloudSQL) as an efficient key-value store. I have about 200 GB of dictionaries. I'm thinking about using improved hash indexes. Here is the scheme:


        CREATE TABLE IF NOT EXISTS key_val (
            id uuid DEFAULT uuid_generate_v4(),
            value jsonb,
            EXCLUDE using hash (id with =)

        CREATE INDEX IF NOT EXISTS idx_key_val ON key_val USING hash (id);

Getting, updating, and pasting are pretty straightforward, but I'm not sure how to implement efficient upserting.

INSERT INTO key_val VALUES ($1, $2) ON CONFLICT ON CONSTRAINT key_val_id_excl DO UPDATE SET value = ($2)

Results in WrongObjectTypeError ON CONFLICT DO UPDATE not supported with exclusion constraints

Possible solution:

  1. Upsert https://stackoverflow.com/a/8702291/336186
  2. Use hstore, but i would lose json query improvements and a single tail can have 20kb +
  3. Use btree – lookups would be slower (estimate 2x-3x) and the index would be much larger.
  4. Other option

Database Design – What is an alternative solution for using a null value for a foreign key field?

There are some tables in my database that contain a foreign key field that is linked to another table. The problem is that the value for this field will not always be there, so sometimes I need to insert a null foreign key field. Working out:

I have a table Sense_LanguageSource Here are listed individual etymologies of entries in a dictionary. This has the following fields:

  • LanguageSourceID (PK – Autonumber)
  • SenseFK (FK number)
  • language code (FK number)
  • SourceWord (short text)
  • LanguageSourceType (short text)
  • IsWaseieigo (yes / no)

The LanguageCode Field is the problematic case. It is used to list the language from which the etymology is derived. In this case, it is a foreign key that is linked to a LanguageCodeValue Table containing both the ISO-639-2B code and the full name of the language.

However, some of the etymologies that I will insert into the database have no LanguageCodes, so I would need to include a 0 in this field. Initially Access did not allow me to do that, so I disabled referential integrity. When I reopened the database, Access said the database was compromised and needed repair. So I think I need an alternative solution.

I would less normalize it and just have a text box for the LanguageCode in it, but there are two tables that refer to that LanguageCodeValue It seems to make sense to have a table that describes what every LanguageCode refers to. The solutions that come to my mind are:

  1. Remove the relationship between the LanguageCode Fields and the LanguageCodeValue table (so it's just a reference table and not linked) and just use it SELECT asks if I need to look up the meaning of the LanguageCode.

  2. Keep the join between the tables without referential integrity to allow null foreign keys, and hope that the database will not fail.

  3. Insert a "null" value in this LanguageCodeValue table to reference so that instead of entering a null foreign key, I can only reference a record that means nothing.

  4. Another solution?

Since I have no previous experience with databases and I am not sure which design practices are best, I would like to know which solution suits my situation best.

mobile application – key response depending on the x-coordinate

I have to show some boring tables (some data, a number and a text, not pictures) with a lot of boring details. Imagine your bank statement.

On mobile devices, I need to use multiple lines for each entry. Fortunately, this means that the entry is big enough to work as a button.

Unfortunately I need for actions like two or three buttons per entry

  • show more details (leads to a new page)
  • Mark as read
  • a menu for everything else

Adding buttons, of course, would take up a lot of space (currently, users can see about eight entries at once, which may be okay, adding buttons would reduce that to about half).

So I think about whether the entries react differently, depending on where they are touched, eg.

  • left third mark ⇒ read
  • middle third ⇒ Show menu
  • right third ⇒ Show more details

Obviously, the user has to help with the first use.

  • Is this a good idea?
  • Are there already known apps that do the same?
  • Is there a simple and compact way to visually display this functionality?


Imagine, my entry looks like

          SOMETHING HERE                            22.30         
Lorem ipsum dolor sit amet, consectetur adipiscing  02.12.2019    
elit, sed do eiusmod tempor incididunt ut labore et               
dolore magna aliqua. Mollis aliquam ut porttitor    WOW!          

and three transparent buttons laid over it like that


sharepoint online – properties in the document library can not be edited – an item with the same key has already been added

There is a document library that displays the error: & # 39; An item with the same key has already been added. & # 39; for all files when trying to edit the metadata of the file.

I can not seem to find any occurrences of the problem on the web. Has anyone ever encountered the problem here? If so, how do I fix it?

Additional information:

  • SharePoint Online
  • The document library contains sets of documents
  • The problem occurs with both document record properties and files in document sets
  • When using & # 39; fast editing & # 39; the properties can be edited
  • No duplicate files
  • No document approval flow
  • In addition to the document set is a vanilla document library

Python – How do I go through the form with the TAB key?

I have set up a form and want to invoke it via the tab key. How can I do that?

import wx
import sqlite3
import locale
pi = 3.141592653589931
R = 0.083144621
e = 2.718281828459045235360287471352662497757
erroentr = 0
respconstr = 0
presentr = 1.01325
tempentr = 0.0
presSI = 1.01325
tempK = 273.15
tempSI = Pr = Tr =  prescrit = tempcrit =  0.0
fatacc = 0.0
ro = visc = Cp = Cv = kappa = 0.0
fracmol1 = 1.0
fracmol2 = fracmol3 = 0.0
val = val1 = val2 = val3 = 0.0
sel = nome = nomefluido1 = nomefluido2 = nomefluido3 = pip = ""
name1 = name2 = name3 = composicao =  ""
upres = ("barA","kgf/cm2A","psiA")
utemp = ("°C","K","°F","°R")
db1 = sqlite3.connect('prop.db')
cursor = db1.cursor()
lista =()
cursor.execute("""SELECT Nome FROM fluido""")
for row in cursor.fetchall():
db1 = sqlite3.connect('prop.db')
cursor = db1.cursor()
liste =()
cursor.execute("""SELECT Name FROM fluido""")
for row in cursor.fetchall():
class Classeform(wx.Frame):
    def __init__(self,parent,title):
        super(Classeform,self).__init__(parent,title='Propriedades', pos = (10,10), size = (750,350))
        global ed1,ed2, lista, lan
        icon = wx.Icon("placa.ico", wx.BITMAP_TYPE_ICO)
        locale.setlocale(locale.LC_ALL, ('pt_BR', 'UTF8'))
        self.lba = wx.StaticText(self, label = 'Pressão:', pos = (5,40))
        self.lb2 = wx.StaticText(self, label = 'Temperatura:', pos = (5,70))
        self.lb3 = wx.StaticText(self, label = 'Fluído', pos = (380,10))
        self.lb4 = wx.StaticText(self, label = 'Fração molar', pos = (505,10))
        self.ed1 = wx.TextCtrl(self, size=(90,-1), pos=(100,40), value=(locale.format_string("%f", 1.01325, grouping=True)))
        self.ed2 = wx.TextCtrl(self, size=(90,-1), pos=(100,70), value=(locale.format_string("%f", 0.0, grouping=True)))
        self.ed3 = wx.TextCtrl(self, size=(90,-1), pos=(500,40), value=(locale.format_string("%f", 1.0, grouping=True)))
        self.ed4 = wx.TextCtrl(self, size=(90,-1), pos=(500,70), value=(locale.format_string("%f", 0.0, grouping=True)))
        self.ed5 = wx.TextCtrl(self, size=(90,-1), pos=(500,100), value=(locale.format_string("%f", 0.0, grouping=True)))
        self.cb1 = wx.ComboBox(self, size=(90,-1), pos=(200,40), style=wx.CB_READONLY, choices = upres) 
        self.cb2 = wx.ComboBox(self, size=(90, -1), pos=(200,70), style=wx.CB_READONLY, choices = utemp) 
        self.cb3 = wx.ComboBox(self, size=(90, -1), pos=(350,40), style=wx.CB_READONLY, choices = lista) 
        self.cb4 = wx.ComboBox(self, size=(90, -1), pos=(350,70), style=wx.CB_READONLY, choices = lista) 
        self.cb5 = wx.ComboBox(self, size=(90, -1), pos=(350,100), style=wx.CB_READONLY, choices = lista) 
        self.dirDlgBtn1 = wx.Button(self, label="Calcular", pos=(100,100))
        self.dirDlgBtn1.Bind(wx.EVT_BUTTON, self.calculodef)        
        def block_non_numbers(event):
            key_code = event.GetKeyCode()
            if ord('0') <= key_code <= ord('9'):
            if key_code == ord('.') or key_code == ord(',') or key_code == ord('-'):
            if key_code == ord('t') or key_code == 127  or key_code == 8  or key_code == 9  or key_code == 13:
            if 314 <= key_code <= 319:
        self.ed1.Bind(wx.EVT_CHAR, block_non_numbers)
        self.ed2.Bind(wx.EVT_CHAR, block_non_numbers)
        self.ed3.Bind(wx.EVT_CHAR, block_non_numbers)
        self.ed4.Bind(wx.EVT_CHAR, block_non_numbers)
        self.ed5.Bind(wx.EVT_CHAR, block_non_numbers)


    # Cria evento de saida
    def OnSair(self, evt):

     # Cria Janela
    def OnNovoFormulario(self, evt):
        # Cria Formulario Filho
        FormularioFilho = wx.MDIChildFrame(self, -1, "Formulario Filho", size=(400, 200))

        # Cria componentes do formulario
        self.texto = wx.StaticText(FormularioFilho, label="Digite seu nome: ", pos=(20, 30))
        self.campo = wx.TextCtrl(FormularioFilho, size=(300, -1), pos=(20, 60))
        self.botao = wx.Button(FormularioFilho, label="Ok", pos=(20, 90))

        # Exibe formulario

    def calculodef(self, evt):
        global ed1,ed2, erroentr, val, val1, val2, val3, composicao
        global nomefluido1, name1, nomefluido2, name2, nomefluido3, name3
        global tempK, tempSI, presSI, fracmol1, fracmol2, fracmol3 
        global presentr, tempentr, ro, visc, Cp, Cv, kappa, pip, respconstr
        global stme, stvisc, stz, stcp, stcv, stk, stpip, stvs, stct
        erroentr = 0
#limpa área de respostas
        if respconstr == 1:
            if not visc == 0:
            if fracmol1 == 1:
        respconstr = 1

#pega variáveis
            val = float(locale.delocalize(self.ed1.GetValue()))
            erroentr = 0
        except ValueError:
            val = 1.01325
            erroentr = 1
        presentr = val
        if erroentr == 0:
                val = float(locale.delocalize(self.ed2.GetValue()))
            except ValueError:
                val = 0
                erroentr = 2
        tempentr = val
        if erroentr == 0:
                val1 = float(locale.delocalize(self.ed3.GetValue()))
                val2 = float(locale.delocalize(self.ed4.GetValue()))
                val3 = float(locale.delocalize(self.ed5.GetValue()))
            except ValueError:
                val1 = 1.0
                val2 = 0.0
                val3 = 0.0
                erroentr = 3
        if erroentr == 0:
            val = val1 + val2 + val3
            if not val == 1:
                erroentr = 4
        fracmol1 = val1
        fracmol2 = val2
        fracmol3 = val3
        if erroentr == 0:
            presSI = sipres(self.cb1.GetValue())
            tempSI = sitemp(self.cb2.GetValue())
            nomefluido1 = (self.cb3.GetValue())
            nomefluido2 = (self.cb4.GetValue())
            nomefluido3 = (self.cb5.GetValue())
            name1 = escfluido(nomefluido1)
            composicao = name1 + "(" + str(fracmol1) + ")"
            if fracmol2 > 0:
                name2 = escfluido(nomefluido2)
                composicao = composicao + "&" + name2 + "(" + str(fracmol2) + ")"
            if fracmol3 > 0:
                name3 = escfluido(nomefluido3)
                composicao = composicao + "&" + name3 + "(" + str(fracmol3) + ")"
            tempK = tempSI + 273.15
            resposta = calculo(presSI,tempSI,composicao)
            ro = resposta(0)
            visc = resposta(1)
            z = resposta(2)
            Cp = resposta(3)
            Cv = resposta(4)
            kappa = resposta(5)
            pip = resposta(6)
            vs = resposta(7)
            cdterm = resposta(8)
            stme = wx.StaticText(self, label = "Massa Específica:  " + locale.str(ro) + "  kg/m3", pos = (5,160))
            if not visc == 0:
                stvisc = wx.StaticText(self, label = "Viscosidade: " + locale.str(visc*1000) + " cp", pos = (5,190))
            stz = wx.StaticText(self, label = 'Z: ' + locale.str(z), pos = (5,220))
            stcp = wx.StaticText(self, label = 'Cp: ' + locale.str(Cp) + " J/mol.K" , pos = (300,160))
            stcv = wx.StaticText(self, label = 'Cv: ' + locale.str(Cv) + " J/mol.K" , pos = (300,190))
            stk = wx.StaticText(self, label = 'K: ' + locale.str(kappa), pos = (300,220))
            if fracmol1 == 1:
                stpip = wx.StaticText(self, label = 'Fase: ' + pip , pos = (500,160))
            stvs = wx.StaticText(self, label = 'Velocidade som: ' + locale.str(vs) + " m/s" , pos = (500,190)) 
            stct = wx.StaticText(self, label = 'Cond. Térmica: ' + locale.str(cdterm) + " W/m.k" , pos = (500,220)) 

        elif erroentr == 1:
            wx.StaticText(self, label = "Entrada da pressão não numérica", pos = (5,160) )
        elif erroentr == 2:
            wx.StaticText(self, label = "Entrada da temperatura não numérica", pos = (5,160) )
        elif erroentr == 3:
            wx.StaticText(self, label = "Entrada das frações molares não numéricas", pos = (5,160) )
        elif erroentr == 4:
            wx.StaticText(self, label = "Soma das frações molares não é igual a 1", pos = (5,160) )

def sipres(UEpres):
    global presentr
    if UEpres == "barA":
        si = presentr
    elif UEpres == "kgf/cm2A":
        si = presentr * 14.2233 / 14.50377
    elif UEpres == "psiA":
        si = presentr / 14.50377
        si = 0.0

def sitemp(UEtemp):
    global tempentr
    if UEtemp == "°C":
        si = tempentr
    elif UEtemp == "K":
        si = (tempentr - 273.15)
    elif UEtemp == "°F":
        si = (tempentr - 32) / 1.8
    elif UEtemp == "°R":
        si = (tempentr - 491.67) / 1.8
        si = 0.0

def escfluido(nf):
    sel = "SELECT DISTINCT * FROM fluido WHERE nome= '" + nf + "'"
    db1 = sqlite3.connect('prop.db')
    cursor = db1.cursor()
    banco = cursor.fetchone()
    n1 = banco(1)

def calculo(pressao,temperatura,composicao):
    # ainda a definir

app = wx.App()


Encryption – Why do NodeJS Crypto documents use CBC instead of GCM for RSA key pairs?

I've read that GCM, when properly implemented, is almost always safer than CBC.

The NodeJS documentation uses CBC as an example instead. The key pair is stored in the node environment.

Since the private key is stored locally and CBC is an acceptable encryption for local files according to this answer, is it a sufficiently secure implementation, or should GCM be used as in this sample code?

Plugins – WordPress database problem wp_posts, primary key

Repende my website in WordPress did not let me work properly, did not allow me to publish an article and has shown me a problem in the editor. Display the message: "You are editing the page where your recent posts are displayed."

The search on the internet seems to be a problem of the database. When I enter the wp_post phpmyadmin table I get the message "The current selection does not contain a single column. The raster output and the links for copying, deleting and editing are not available." I can not change the data in the table. I also see that the structure differs from any other database in WordPress. For example, in the wp_posts table, the ID has no automatic increment and no primary key if it should have it. I try to assign it, but I receive the following error message:


MySQL said: Documentation

# 1062 - Duplicate entry '0' for the key 'PRIMARY'

Enter image description here

Any way to solve this problem? I've already updated WordPress, which uses the plugin to "fix" the database, but nothing worked for me

I appreciate your help

How can I insert a record into a table that depends on a foreign key linked to a previous table?

Starting from this question. I wrote a dictionary file in XML. I've written a program in VB.NET to parse this file and store all the data in class objects, and now I want to write a subroutine to put all that data into an Access database. What I have to struggle with is figuring out how to use SQL INSERT all data.

There are 20 tables, and the main table is called Entryto which all other tables refer back. To give a simplified example of the data structure, there is also one Keyword Table that points to the back Entry, And there it is Keyword_Priority Table referenced back Keyword, Both relationships are one-to-many as follows:

Enter image description here

My question

I can use SQL INSERT for the Entry Table to create a record. But how would I create a record for that? Keyword Table related to the primary key of Entry Record that I just created? And how would I then create a record for Keyword_Priority, in relation to Keyword Recording? And so on.

This is all done through VB.NET. I can not use forms because over 180,000 entries must be entered. Is there a way to store a variable in SQL that I can refer to later?