postgresql – Why doesn’t the $1 syntax work for all queries?

I tried to do this:

COPY postgres_log FROM $1 WITH csv;

And with a separately sent file path, like I make all normal queries (SELECT/UPDATE/INSERT/DELETE). However, it gives:

ERROR:  syntax error at or near "$1"

Um… So does that mean that I’m forced to send it a scary string like this?

COPY postgres_log FROM '/full/path/to/logfileblablabla.csv' WITH csv;

If so, why? Why don’t all query types support the parameterized queries interface? Isn’t this like asking to enable SQL query injection vulnerabilities?

python – SyntaxError: invalid syntax on lib/python3.8/site-packages/sql_server/pyodbc/ django deploy on Linux


  1. Preface (Testing HyperV Virtual Server with os: Ubuntu Server 20.04.1 on local Windows PC)


I am having problems deploying my Django app (using Python 3.8.2) on a Ubuntu Server 20.04.1 LTS that uses MS SQL Server as its database. No issues reverting back to ‘ENGINE’: ‘django.db.backends.sqlite3’ on Linux but I have to be honest, it is frustrating.

I already had to downgrade to Django==3.0 to get my app working on my local windows pc but the 2 migrations I did proves that I am missing something and I hope someone can give me a hand. Any help is appreciated.

  1. My PC

Working file (currently running on windows with Sql Server 2019 Express

    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mdm_db',
        'USER': 'AAA',
        'PASSWORD': 'AAA',
         'HOST': 'localhost\SQLEXPRESS',
        'PORT': '',

        'OPTIONS': {
            'driver': 'SQL Server Native Client 11.0',
            # 'driver': 'ODBC Driver 13 for SQL Server ', -> port 1433?
installed components:
    pip freeze
  1. Ubuntu Server

(also tried using ODBC and installing the latest version

    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mdm_db',
        'USER': 'mdmuser',
        'PASSWORD': 'mdmuser',
         'HOST': 'localhost\SQLEXPRESS',
        'PORT': '',
        'OPTIONS': {
            #'driver': 'SQL Server Native Client 11.0',
             'driver': 'ODBC Driver 17 for SQL Server ',

Packages installed

:~/app/MDM_SQLServer$ history | grep install

   32  sudo apt-get install unixodbc-dev
   34  sudo apt-get install python3-dev
   36  sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
   60  sudo ACCEPT_EULA=Y apt-get install msodbcsql17
  1. Issue: (venv) luca@webserver:~/app/MDM_SQLServer$ python runserver

Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.8/", line 932, in _bootstrap_inner
  File "/usr/lib/python3.8/", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/utils/", line 53, in wrapper
    fn(*args, **kwargs)
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/core/management/commands/", line 109, in inner_run
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/utils/", line 76, in raise_last_exception
    raise _exception(1)
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/core/management/", line 357, in execute
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/utils/", line 53, in wrapper
    fn(*args, **kwargs)
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/", line 24, in setup
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/apps/", line 114, in populate
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/apps/", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.8/importlib/", line 127, in import_module
    return _bootstrap._gcd_import(name(level:), package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/luca/app/MDM_SQLServer/cpus/", line 6, in <module>
    from sites.models import Site
  File "/home/luca/app/MDM_SQLServer/sites/", line 4, in <module>
    from wifis.models import Wifi
  File "/home/luca/app/MDM_SQLServer/wifis/", line 3, in <module>
    class Wifi(models.Model):
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/db/models/", line 121, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/db/models/", line 325, in add_to_class
    value.contribute_to_class(cls, name)
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/db/models/", line 208, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/db/", line 28, in __getattr__
    return getattr(connections(DEFAULT_DB_ALIAS), item)
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/db/", line 207, in __getitem__
    backend = load_backend(db('ENGINE'))
  File "/home/luca/app/venv/lib/python3.8/site-packages/django/db/", line 111, in load_backend
    return import_module('%s.base' % backend_name)
  File "/usr/lib/python3.8/importlib/", line 127, in import_module
    return _bootstrap._gcd_import(name(level:), package, level)
  File "/home/luca/app/venv/lib/python3.8/site-packages/sql_server/pyodbc/", line 7
    except ImportError, e:
SyntaxError: invalid syntax

NOTE Prompt is not returned, I need to corntol+C out.

Thank you all.

MySQL: Why am I getting a syntax error when using the FIELDS ESCAPED BY clause on a select statement

I am attempting to generate a csv file including headers from a table in my MySQL 8.0 database. After a lot of searching I found the following suggest syntax:

    SELECT "ansId","assmt","ques","answerCode","details"
    FROM ayanswer
    SELECT ansId,assmt,ques,answerCode,details
    FROM ayanswer
    INTO OUTFILE 'c:/data/test1.csv'

However when I run this statement in mysql I get the following error:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘FIELDS ESCAPED BY ”’ at line 9

According to the MySQL Server 8.0 reference manual this syntax should be correct. So what am I doing wrong?

Composer patches cweagans Core module update syntax – one patch not being applied

I’m using cweagans composer patches:
to patch Drupal 9.x
I’ve made a patch file. The first patch applies but I think I have the path wrong for the core module, layout_builder, which I am trying to patch. Patch file below. The patch seems to be completely ignored. Layout Builder patch is applied to: core/modules/layout_builder/src/Form/OverridesEntityForm.php

   "patches": {
     "drupal/imce": {
         "Secuirty isued D9 imcefilefield": ""
     "core/layout_builder": {
         "Default region for overridden layout of entity": ""

vhdl – Beginner: undeclared signal and syntax errors

Very much a beginner in VHDL, I found some code to try and get a board to blink an LED but I decided to try and have it scan across the LED’s instead. I’m getting:

“Syntax error near <=” VHDL 1261 – Line 14
“Syntax error near if” VHDL 1261 – Line 22
“State is not declared” VHDL 1241 – Line 53, Line 54


      CLK  : IN  std_logic;
      LED  : OUT std_logic_vector(7 downto 0)
end Cylon;

architecture Cylon_Beh of CYLON is
      constant mx_cnt : natural   := 48000000;
      signal   state  : std_logic <= '0'; --LINE14
      signal   enable : std_logic <= '0';
      variable count  : natural range 0 to mx_cnt;
        --enables count to run
        if rising_edge(clk) then --LINE22
            --enable = 0, state ++
            if count < mx_cnt & enable = 0 then
                count = count + 1;
                --Controls State increment/decrement
                if (mx_cnt % 60000000 = 0) then
                    state = state + 1;
                end if;
                count  = 0;
                enable = 1;
                state  = state + 1;
            end if;
            --enable = 1, state--
            if count < mx_cnt & enable = 1 then
                count = count + 1;
                --Controls State increment/decrement
                if (mx_cnt % 60000000 = 0) then
                    state = state - 1;
                end if;
                count  = 0;
                enable = 0;
                state  = state + 1;
            end if;
        end if;
end process;

    wait on state; -LINE53
        case state is -LINE54
            when 0 => LED <= "00000001";
            when 1 => LED <= "00000010";
            when 2 => LED <= "00000100";
            when 3 => LED <= "00001000";
            when 4 => LED <= "00010000";
            when 5 => LED <= "00100000";
            when 6 => LED <= "01000000";
            when 7 => LED <= "10000000";
        end case;
end process; 

end Cylon_Beh;  

I Feel I’m very close to getting my result, assuming my logic is right, but I can’t get past these errors. Any wizards out there who can offer more experienced eyes?

externalevaulate – How to assemble Python abstract syntax trees (AST) in Mathematica?

I would like to assemble Python ‘ast.Module‘ objects inside of Mathematica and then submit them to Python via e.g. ExternalEvaluate("exec(astObject)").

The Python ast, parse, eval, exec and compile functions can all operate on ‘ast.Module‘ objects, either outputting them or taking them as inputs. However I don’t know how to assemble this astObject within Mathematica/WL and then send it over to Python via ExternalEvaluate.

I am trying to programmatically generate Python code in MMA (for a genetic algorithm) and then submit it to Python for evaluation. I could assemble Python code strings, but then I have to handle all of the indentation, which seems like a pain.

Is it possible to create this sort of Python object on the Mathematica side?


PS: Here is a description of the ‘ast.Module‘ objects:

PPS: I have cross-posted this on Wolfram Community:

JavaScript syntax: bucketing based on days (today, yesterday and past)

I am trying to create three buckets of objects. Today, yesterday and past. I am wondering can the following be done in a more concise way in pure JavaScript without any libraries?

const (todayBucket, yesterdayBucket) = (0, 1).map(offset =>
  recordings.filter(({ createdOn }) =>
    moment(createdOn).isSame(moment().add(-offset), 'day'),
const pastBucket = recordings.filter(
  recording => !(...todayBucket, ...yesterdayBucket).includes(recording),

Dovecot configuration files using `remote` syntax not being honored

According to the Dovecot documentation, one can alter configuration directives based on the protocol, as well as the local and remote IPs.

In my current setup (Mail-in-a-box using Nextcloud, which uses IMAP authentication), my mail logs are spammed with local logins. I really don’t need these reports, but still want to retain login logs for remote IPs.

I set the following in my configuration:

remote {
  info_log_path = /dev/null

When I run doveadm -n -f remote=, this appears to be registered correctly:

# (d6601f4ec): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
info_log_path = /dev/null
remote {
  info_log_path = /dev/null

Unfortunately, I’m still getting spammed with login reports when the local and remote IPs are both localhost.

Aug 12 12:17:13 imap-login: Info: Login: user=<user@domain.tld>, method=PLAIN, rip=, lip=, mpid=29798, TLS, session=<FGVJhbCsstt/AAAB>
Aug 12 12:17:13 imap(user@domain.tld): Info: Logged out in=305 out=2277

I’ve also tried logging to a specific file, instead of /dev/null, but no file was created. So there must be an issue with my understanding. Anyone else successfully able to use these conditionals in their configuration?

How to figure out syntax for symbols?

I’m new to Mathematica and am having a hard time figuring out how to type certain symbols when I read the documentation.

For example, in, the syntax is:

MatrixPropertyDistribution(expr,x mdist) where there is a symbol between x and mdist. I eventually figured out that the symbol could be interpreted as Distributed(x, mdist) or x (Distributed) mdist, but is there a function in Mathematica or some other website (like Detexify for Tex) that can translate the symbol to the thing you would actually need to type in Mathematica to get the symbol?

A similar issue I’m having right now is trying to define the usual complex inner product as is done in first example in the Applications section of this reference: The issue is that the braces they have there is not the same as just the brackets on the keyboard corresponding to pressing Shift with “,” or Shift with “.” and I’d like to find out how to actually type these certain braces, so I can actually use the inner product.

ssh – could not parse *** as int value for flag port,p: strconv.ParseInt: parsing “***”: invalid syntax

I’m new in Devops. and I’m trying to use CI/CD for a simple Node.js (express.js) project in github actions. And I’m using evennode as my host.
But I’m getting this error in “SSH and deploy node app step” for port:

could not parse *** as int value for flag port,p: strconv.ParseInt:
parsing “***”: invalid syntax

How do I set the port? I’m doing something like this: 22, p: 22, port: 22. But I did not get an answer.

enter image description here