Outlook invite URLs through the web without picking up the approved start and end date in the dtstart and dtend parameters

url https://outlook.live.com/owa/?rru=addevent&dtstart=20200330T011159&dtend=20200330T031159&title=&location= incorporateurl ►&description=&allday=false

mysql.connector.errors.ProgrammingError error: not enough parameters for SQL statement

# script de carga 
import csv 
import mysql.connector

# conexao com o banco 
mysql = mysql.connector.connect(
    host='0.0.0.0',
    user='root',
    passwd='mysql',
    database='mydesenv',
    port=3306
)
cur=mysql.cursor()
sql = """insert into mydesenv.tb_load (id, nm_name, dt_load) values (%s, %s, %s)"""
#passo01 - Ler arquivo .csv
csv_data = csv.reader('/Users/eduardoaandrad/Dropbox/Desenv/Script/csv/carga_teste.csv',delimiter=';')
for row in csv_data:
    print(row)
    cur.execute(sql,row)

mysql.commit()
cur.close()

google sheets – Exception: parameters (null) do not match method signature for FormApp.Form.getItemById. (line 38, file "Code")

When I run the following script I get the message: Exception: The parameters (null) don't match the method signature for FormApp.Form.getItemById. (line 38, file "Code")
It has been working well so far. I don't know what happened but it started showing this error:

var ssID = "1Z7uUBnzS5zKnxGswKKNAgn2XbRunqIzQZMATDl7skoE";
var formID = "1LxORhL2WgU6teJ11ax7_HsFxhbpXbjtFXiuPH5qfEfA";

var wsData = SpreadsheetApp.openById(ssID).getSheetByName("Questions#1");
var form = FormApp.openById(formID);

function updateDropdown(id,values) {
  var item = form.getItemById(id);
  item.asListItem().setChoiceValues(values);
}

Please help find the problem and fix it!

postgresql 11: need a function to execute different queries based on parameters sent

New to advanced SQL stuff. I am storing constants. Constants have three possible scopes: local, users, global. Two tables: s0constants_user contains the set values ​​of the constants, s0constants contains the definitions and the constant values.

    CREATE TABLE public.s0constants_user (
    constant_name bpchar(15) NOT NULL,
    empfkey int2 NOT NULL,
    constant_value bpchar(255) NULL,
    locality_name bpchar(30) NULL,
    id serial NOT NULL,
    CONSTRAINT s0constants_user_pk PRIMARY KEY (id)
);
CREATE INDEX s0constants_user_constant_name_idx ON public.s0constants_user USING btree (constant_name, empfkey, locality_name);

CREATE TABLE public.s0constants (
constant_name bpchar(15) NOT NULL,
constant_value bpchar(255) NULL,
constant_data_type bpchar(1) NULL,
cttype int4 NULL,
displayname bpchar(30) NULL,
actiontype int4 NULL,
note text NULL,
const_scopefk int4 NOT NULL DEFAULT 3, -- 1=local¶2- user¶3=global
CONSTRAINT "S0CONSTANTS_pkey" PRIMARY KEY (constant_name),
CONSTRAINT scope_fk FOREIGN KEY (const_scopefk) REFERENCES s0constants_scopelk(id)

I realize I could do this with separate tables for each scope, but I would like to make this work even if it is just a learning exercise.
I need a function to return and the value of the constant and the data type given the constant name and the empf key. There are different queries for each constant scope.
local – constant_name, empfkey, locality_name
user – constant_name, empfkey
global – constant_name
Constant names are unique in all three areas. I thought a case statement could do it, but I am having trouble limiting it to one row of data and how to configure subqueries.
This is my first step in this, but I can't figure out how to get the "cdt" column in subqueries or, if this is the event, the correct hint:

public.const_get( stname text, empid INT, locality text ) returns TABLE(cvalue text, ctype text)
    LANGUAGE sql
     STABLE PARALLEL SAFE
AS $$

   select c.const_scopefk, c.constant_data_type as cdt
     ,case 
       when const_scopefk = 1 then
       ( select scu.constant_value, c.cdt
        from s0constants_user scu 
        where (scu.constant_name = constant_name 
           and scu.empfkey = empid
           and scu.locality_name = locality))

       when const_scopefk  = 2 then 
        (select scu.constant_value, c.cdt
        from s0constants_user scu 
        where (scu.constant_name = constant_name 
           and scu.empfkey = empid))

      when const_scopefk  = 1 then 
        (select scu.constant_value, c.cdt
        from s0constants_user scu 
        where (scu.constant_name = constant_name ))
    end 
   from public.s0constants c
   where  c.constant_name = UPPER(constname);

python: error passing numpy.core._exceptions.UFuncTypeError parameters: ufunc & # 39; subtract & # 39; did not contain a loop signature match type (dtype (& # 39; <U21 & # 39;)

Basically I have the following code:

import numpy as np

def localize(aux1, aux2, aux3, aux4, aux5, aux6):

    search = np.array(((aux1,aux2,aux3,aux4,aux5,aux6)))

    B1A = np.array(((-46,-78,-72,-70,-81,-59)))     #B1A
    B1B = np.array(((-100,-82,-85,-100,-76,-55)))   #B1B
    B1C = np.array(((-100,-100,-100,-78,-100,-58))) #B1C
    B2A = np.array(((-100,-88,-100,-100,-100,-60)))  #B2A
    B2B = np.array(((-100,-78,-79,-80,-80,-59)))     #B2B

    candidatos = (B1A, B1B, B1C, B2A, B2B)
    margem_erroP = 10.0
    margem_erroN = -10.0

    distancias = candidatos(::) - search

    avaliar_dist = np.where(np.absolute(distancias) < margem_erroP, True, False) 
    avaliar_distN = np.where(np.absolute(distancias) < margem_erroN, True, False)

    vetores_aprovados = avaliar_dist.all(axis=2)
    vetores_aprovados += avaliar_distN.all(axis=2)

    posicao_aprovados = np.array(np.where(vetores_aprovados== True)(0))

    print("---- Resultado ----")
    print()
    print("Busca: {}".format(search))
    print("Resultado: ")
    for x in posicao_aprovados:
        print(candidatos(x))

        here = candidatos(x)(-1)
        print("Aquii")
        print(here)

        if posicao_aprovados(0) == 0:
            print("Local: B1A")
            local = "B1A"
        elif posicao_aprovados(0) == 1:
            print("Local: B1B")
            local = "B1B"
        elif posicao_aprovados(0) == 2:
            print("Local: B1C")
            local = "B1C"
        elif posicao_aprovados(0) == 3:
            print("Local: B2A")
            local = "B2A"
        elif posicao_aprovados(0) == 4:
            print("Local: B2B")
            local = "B2B"
        else:
            local = "não encontrado"

    x = {
        "search" : search.tolist(),
        "locale" : local,
        "result" : here.tolist()
    }
    json.dumps(x)
    return x

So far so good, it works exactly as needed!

The problem is when I try to run this function from another location. For example:

I have a variable find which contains the following string: '-100,-67,-63,-49,-53,-48'

Since I need to pass 6 values ​​and in this case only step 1 (a string), I separate my string into integers with the following command:
valores = find.split(",")

This done, my list turns into this: ('-100', '-67', '-63', '-49', '-53', '-48')

To execute my function, I did it as follows: aux = localize.localize(valores(0),valores(1),valores(2),valores(3),valores(4),valores(5))

Putting it this way, what I'm doing is basically: localize.localize(-100 -67 -63 -49 -53 -48)

However, it doesn't work returning the error:
distancias = candidatos(::) - search numpy.core._exceptions.UFuncTypeError: ufunc 'subtract' did not contain a loop with signature matching types (dtype(' dtype('

IMPORTANT TO MENTION THAT
If I call my function passing the values ​​directly like so: aux = localize.localize(-100,-70,-68,-55,-53,-55)
It works perfectly, but going this way, which is how I need it, won't work at all.

I came to think it didn't work because there was no comma to separate each integer value, so I did it like this: localize.localize(valores(0)+',',valores(1)+',',valores(2)+',',valores(3)+',',valores(4)+',',valores(5))

Which was the same as happening:

localize.localize(-100,-67,-63,-49,-53,-48) it didn't work either.

I would like help to understand how I can pass the values ​​in a way that is functional and through the variables as I described. Thanks in advance for any assistance

If it helps, I leave below the function I'm trying to perform. It is a POST of an API that comes with some parameters (coordinates) and the algorithm will help me tell where the closest coordinates are. It is only after receiving the data and verifying the location that the data is saved in the bank. I was printing everything to see how the data arrived hehe

@app.route('/api/v1/resources/positions/app', methods=('POST'))
def positions_post_app():
    conn = sqlite3.connect('locale.db')
    conn.row_factory = dict_factory
    cur = conn.cursor()
    users = request.get_json()
    for user in users:
        user_id = user('user_id')
        find = user('search')
        date = user('date')

#        print("valor que chega!")
#        print(find)
#        valores = find.split(",")
#        print("lista de inteiros")
#        print(valores)
#        print("Tabela atualizada:")
#        print(valores(0)+',',valores(1)+',',valores(2)+',',valores(3)+',',valores(4)+',',valores(5))

#        aux = localize.localize(-100,-70,-68,-55,-53,-55) #FUNÇÃO FUNCIONANDO
         aux = localize.localize(valores(0),valores(1),valores(2),valores(3),valores(4),valores(5))

        locale = aux('locale')
        result = aux('result')
        print("insert into positions values(NULL, '{}','{}', {}, {}, '{}')".format(user_id, find, result, locale, date)) #PRINT PARA VER COMO FICARIA O SQL 

#        cur.execute("insert into positions values(NULL, '{}','{}', {}, {}, '{}')".format(user_id, search, result, locale, date))
#        conn.commit()
    return {'Status' : 'Success'}

python 3.x – How to make a CreateView with parameters

Hello, my problem is that I have a list of users to whom specific permissions must be assigned, such as assigning one or more agencies, one or more cabinets, among others, the models are related to each other as follows:

Archivo models.py
class Usuariospdn(models.Model):
TIPOUSUARIO= (
    ('Conductor', 'Conductor'),
    ('Dependiente', 'Dependiente'),
)
nombre = models.CharField(db_column='Nombre', max_length=32)  # Field name made lowercase.
tipousuario = models.CharField(db_column='TipoUsuario', max_length=23, choices=TIPOUSUARIO, default='Conductor')  # Field name made lowercase.
movil = models.CharField(db_column='Movil', max_length=12, blank=True, null=True)  # Field name made lowercase.
qr = models.CharField(db_column='QR', max_length=12)  # Field name made lowercase.
pin = models.IntegerField(db_column='PIN')  # Field name made lowercase.

class Usuariosagencias(models.Model):
    idusuariopdn = models.ForeignKey(Usuariospdn, on_delete=models.CASCADE, db_column='idUsuarioPDN')  # Field name made lowercase.
    idagencia = models.ForeignKey(Agencias, on_delete=models.CASCADE, db_column='IdAgencia')  # Field name made lowercase.
    fechaalta = models.DateField(db_column='FechaAlta')  # Field name made lowercase.
    baja = models.BooleanField(db_column='Baja')  # Field name made lowercase.
    fechabaja = models.DateField(db_column='FechaBaja', blank=True, null=True)  # Field name made lowercase.

class Usuariosarmarios(models.Model):
    idusuarioagencia = models.ForeignKey(Usuariosagencias, on_delete=models.CASCADE, db_column='idUsuarioAgencia')  # Field name made lowercase.
    idarmario = models.ForeignKey(Armarios, models.DO_NOTHING, db_column='idArmario')  # Field name made lowercase.
    fechaalta = models.DateField(db_column='FechaAlta')  # Field name made lowercase.
    baja = models.BooleanField(db_column='Baja')  # Field name made lowercase.
    fechabaja = models.DateField(db_column='FechaBaja', blank=True, null=True)  # Field name made lowercase.

class Usuariospartners(models.Model):
    idusuarioarmario = models.ForeignKey(Usuariosarmarios, on_delete=models.CASCADE, db_column='idUsuarioArmario')  # Field name made lowercase.
    idpartner = models.ForeignKey(Partners, on_delete=models.CASCADE, db_column='IdPartner')  # Field name made lowercase.
    realizaentregas = models.BooleanField(db_column='RealizaEntregas')  # Field name made lowercase.
    realizarecogidas = models.BooleanField(db_column='RealizaRecogidas')  # Field name made lowercase.
    realizaconsignas = models.BooleanField(db_column='RealizaConsignas')  # Field name made lowercase.
    fechaalta = models.DateField(db_column='FechaAlta')  # Field name made lowercase.
    baja = models.BooleanField(db_column='Baja')  # Field name made lowercase.
    fechabaja = models.DateField(db_column='FechaBaja', blank=True, null=True)  # Field name made lowercase.
    enviado = models.BooleanField(db_column='Enviado')  # Field name made lowercase.
    error = models.BooleanField(db_column='Error')  # Field name made lowercase.

On the one hand, I already managed to show the list of the permissions of a specific user in the same template using the following:

Archivo views.py
def listarpermisos(request, id):
    permisos_agencias = Usuariosagencias.objects.filter(idusuariopdn=id)
    permisos_armarios = Usuariosarmarios.objects.filter(idusuarioagencia__idusuariopdn=id)
    permisos_partners = Usuariospartners.objects.filter(idusuarioarmario__idusuarioagencia__idusuariopdn=id)

Archivo urls.py
path('listar_permisos/', login_required(listarpermisos), name = 'listar_permisos')

So far everything works well the problem comes in the views to create agency, cabinet or partner permissions.
I need that when I enter the option to add or edit first, the user I want to give those permissions to take and not have to select it from the list of users that the form gives me. Also, and very importantly, the program gives me an error once I add some permission and the form is sent because when re-directing to list permission, no parameter is sent to know which user to list. How can I send the parameter of the user that I am adding permissions so that I can list again without problems

These are the views to create any of the three permissions

Archivo views.py

class CrearUsuarioPDNAgencias(CreateView):
    model : Usuariosagencias
    template_name = 'GestionPaqueteria/permisosuPDN/usuariospdnagencias/crear_usuariospdnagencias.html'
    form_class = UsuariosagenciasForm
    success_url = reverse_lazy('gestionpaqueteria:listar_permisos')

http – Is it allowed / possible to send parameters by URL using the POST method?

I am trying to send an HTTP packet with a JSON in the body. However, the server is coming back 400 Bad Request.

note: I do not fully know the internal workings of the server.

I wonder if it is possible to send parameters by URL (just like in the GET method) even using the POST method.

I would also like to send the data in JSON format in the body of the package. Please note that I will use Content-Type: application/json.

For example:

POST /aplicacao?parametro1=string HTTP/1.1
Content-Type: application/json
...
...

What would be the correct way to pass the parameter? parameter1?

I also cannot pass the parameter in the body of the package as it is a JSON string. It is necessary to change Content-Type? – Remembering that I need the package body to be in JSON

How to generate alphabetic parameters in differential solution results

I want to generate alphabetic parameters in the differential solution as shown in the figure below:
enter the image description here
enter the image description here

But I get a lot of error warnings when I do this:

L = (D(#, {r, 2}) + 1/r D(#, r)) &;
f(i_) := FromCharacterCode(i + 64)
DSolve(L((D(φ(r), {r, 2}) + 1/r D(φ(r), r))) == 
  0, φ(r), r, GeneratedParameters -> f)

What can I do to solve this problem better?

probability – Distribution of the ratio of sums of exponential random variables with different parameters

$ X_ {i} sim exp ( lambda_i) $. Now I want to find the distribution of $ frac {X_ {i} -c_i} { sum_ {i = 1} ^ n (X_ {i})} $, where $ c_i $ is a constant for each $ i $. I know that the denominator part has a name called hypo-exponential distribution. And in my case, one can suppose $ lambda $are not very different and $ n $ is large, so the denominator is normally asymptotically distributed …

I wonder if anyone knows the exact distribution of $ frac {X_ {i} -c_i} { sum_ {i = 1} ^ n (X_ {i})} $, or can you find its asymptotic distribution?

One way I'm thinking now is $ frac {X_ {i}} { sum_ {i = 1} ^ n (X_ {i})} = frac {1} {1+ sum_ {j ne i} ^ n frac {X_j} {X_i}} $Y $ sum_ {j ne i} ^ n frac {X_j} {X_i} $ is asymptotically normal in my configuration (i.e. $ lambda $are not very different and $ n $ It is long). Is this correct and is there any other better way?

Any suggestion is highly appreciated.