plpgsql – PostgreSQL: How to stop PostgreSQL from generating logs for PL/pgSQL functions?

I’ve defined some PL/pgSQL functions which get invoked from the client (e.g. psql, but could be JDBC/Hibernate as well), which is connected using a non super user role. e.g. SELECT chk_pwd('(some.user,example.com)', 'P@ssW0rd'); I’ve also set log_statement = 'none' in the postgresql.conf of my server. That stops logging of all SQL statements. However, the signatures and invocations of the PL/pgSQL functions are still being logged, leaking sensitive data into the log files. How do I prevent this?

2021-02-27 17:42:58.483 IST (13008) myrole@test_db CONTEXT:  PL/pgSQL function chk_pwd(email_t,character varying) line 10 at RAISE
2021-02-27 17:42:58.483 IST (13008) myrole@test_db STATEMENT:  SELECT chk_pwd('(some.user,example.com)', 'P@ssW0rd');

complexity theory – Generating a fast permutation function over an integer range

Is there a way to generate a bijection over integers $F : (0..n) rightarrow (0..n)$ that satisfies the properties:

  • $n$ is arbitrarily chosen and can be any positive integer
  • $F$ generates a pseudorandom, potentially biased permutation of its domain
  • $F$ is seedable and can be easily influenced to generate a different random permutation
  • The computational complexity of computing $F(i)$ for all $i$ is better than $O(n)$ (ideally, $O(1)$)
  • The computational complexity of generating $F$ itself is better than $O(n)$ (ideally, $O(1)$)

I have looked at Fisher-Yates, LCGs, LFSRs, minimal perfect hashing, and unique-permutation hashing, and haven’t found anything that could tell me if this is possible.

I am mainly interested in this because I want a “scrollable” output of randomly-permuted integers, of which there may be an impractically large number to compute the entire permutation at once, but which will eventually all be consumed.

To optimize memory usage, it would be preferable to return a fixed number $k$ at a time. If such an $F$ exists, the algorithm could then fetch the next $k$ integers, and so on until the permutation is exhausted.

context free – generating strings from this formal grammar

Hey guys I am having trouble generating strings from this language, I haven’t seen a grammar that looks like this and can’t figure how to generate strings from this grammar, is this Context Sensitive grammar? Thank you.

$G=({S, L_x,R_x,W_x },{a,b},P,S) \
P = {
\S to lambda mid L_x R_x, \
L_x to x mid L_xyW_y, \
W_xy to yW_x, \
W_xR_y to R_yx, \
R_x to x \} \
x, y ∈ {a,b } text{ this means that } x=y text{ but also it can be } x neq y
$

How to? Generating SEO audit reports through api

I’m working on revamping our company’s website. It is currently running on wordpress but we are switching to Static Site Generation and a headless cms (Strapi) and NextJS. On wordpress we use YoastSEO premium which is a great SEO tool as it gives you up-to-date recommendations on good practices. If we move over to a headless cms we’d lose this so I am wondering if there’s a service, preferably with an API, that can be used to audit our pages for SEO good practices and that would stay up-to-date with the latest SEO rules, yes I know there’s a few out there if I do a Google search but I don’t know how trustworthy they are and I don’t wanna waste time or money. Thanks in advance for your help.

Generating a self-signed code signing certifcate in macOS using only the terminal

I have been wrestling with Unknown Error = -2,14,74,14,007 when generating a self-signed certificate to give gdb the appropriate permissions on macOS and while the solution is available, they require me to use Keychain Access to generate the certificate, introduce it to the System keychain and request the system to trust it.

I want to write a script that will automate generating a code-signing certificate, trusting it and signing the gdb binary on a clean macOS install with minimal user intervention. Everything after generating and trusting the certificate seems to be scriptable (with a static entitlements file and admin permissions)

I know that keychain manipulation is possible using security (man page) and I can disable additional pop-ups using sudo /usr/sbin/DevToolsSecurity --enable, but according to the man page, the policy and resultType arguments are only available for add-trusted-cert but not for add-certificates.

I figured if I could make my own CA, import the CA cert as trusted, then import a certificated issued by the self-made CA (for instance, using this guide), then everything should work but there is no way to import a CA certificate, let alone sign a certificate using the CA.

How do I generate a self-signed code signing certificate, add it to the System Keychain and trust it on macOS using only the command-line?

path finding – How can I maintain a contiguous area when generating a tilemap using Wave Function Collapse?

I’m using Wave Function Collapse to generate a tilemap, and I’m trying to come up with a way to maintain a contiguous area during generation. As an example: ensuring all “walkable” tiles are contiguous such that no “walkable” tile is blocked off from another. An acceptable outcome would also be ensuring there is a contiguous path between two (or more) designated tiles. I’m thinking there may be some way to determine how likely any given tile is to bisect a contiguous area and integrate that into the entropy calculation, but I’m not sure how I would determine that.

generating functions – How to get an asymptote not equal to 0y?

I’m trying to find an exponential decay function that roughly models experimental results, and I’m not a trained mathematician.

The experimental results are that the y-intercept is 0.5, and the horizontal asymptote is roughly 0.3. The results only lie on the positive side of the x-axis.

The closest I’ve come to modeling this is with the function:

$y = 1 cdot 0.5 ^ x$

My problem is that I can’t figure out how to lift the asymptote above 0. How do I achieve this?

(The tag is likely wrong, I had no idea what to tag this with sorry.)

Syntax error while generating images

I have this code to generate an image with a scale bar and a label:

tema=Import["https://i.ibb.co/M67YjjP/tema.png"];
scalea=Graphics[{White,Rectangle[{0,0},{125,15}],Text[Style["100 nm",16,"TR",White,Bold],{62,23}]},ImageSize->125];
scaleb=Graphics[{White,Rectangle[{0,0},{125,15}],Text[Style["100 nm",16,"TR",White,Bold],{62,23}]},ImageSize->125];
labela=Graphics[Text[Style["a]",30,"TR",White,Bold]]];
labelb=Graphics[Text[Style["b]",30,"TR",White,Bold]]];
fig1=Rasterize[Show[tema,Epilog->{Inset[scalea,Scaled[{0.8,0.1}]],Inset[labela,Scaled[{0.1,0.9}]]},ImagePadding->None]]

Which works and outputs this image:

enter image description here

However, when I try to generate multiple images like that, I get a Syntax error: incomplete expression, more output is needed. If I add this line to the previous code:

fig2=Rasterize[Show[tema,Epilog->{Inset[scaleb,Scaled[{0.8,0.1}]],Inset[labelb,Scaled[{0.1,0.9}]]},ImagePadding->None]]

No image is generated. What could be the source of this problem?

fourier analysis – Does every compact abelian group contain a Kronecker set generating a dense subgroup?

Let $G$ be a compact metrizable abelian group with infinite exponent.

Let $S^1 = left{z in mathbb{C} : |z| = 1 right}$. A set $K subset G$ is a Kronecker set if, for every continuous function $f : K to S^1$ and every $varepsilon > 0$, there is a character $chi in hat{G}$ such that $|f(x) – chi(x)| < varepsilon$ for every $x in K$.

A set is perfect if it is closed with no isolated points.

It is known that $G$ contains a perfect Kronecker set (a construction is given, for example, in Section 5.2 of Rudin’s Fourier Analysis on Groups). For an application of Kronecker sets, I want to be able to control the subgroup generated by $K$. Namely, I want to know if the following is true:

Problem: Does there exist a perfect Kronecker set $K subset G$ such that the subgroup generated by $K$ is dense in $G$?

I thought of trying to make an argument using Zorn’s lemma, but this appears to be a dead end: a nested union of Kronecker sets need not be Kronecker.

I was able to find some interesting results about subgroups generated by Kronecker sets (e.g., in this paper of Biró and this one by Gabriyelyan). However, I was not able to find anything directly addressing density in the existing literature.

hierarchical clustering – Problem generating graphics using hclust and pvclust in R

I would like help with the following question:
I am using hierarchical clustering for my data. I’m doing an example using both the hclust function and using pvclust (includes the hclust function).

I did two tests: the first for a base with 8 properties and the other with 19 properties. The first base worked, presented the graphics correctly, they are the same, since both use hclust. But when I made it with 19 properties, the graph was different, could it help me understand and solve this problem?

Thank you!

library(rdist)
library(pvclust)
library(geosphere)

#USING HCLUST
 df <- structure(
   list(Propertie = c(1,2,3,4,5,6,7,8), Latitude = c(-24.779225, -24.789635, -24.763461, -24.794394, -24.747102,-24.781307,-24.761081,-24.761084),
        Longitude = c(-49.934816, -49.922324, -49.911616, -49.906262, -49.890796,-49.8875254,-49.8875254,-49.922244), 
        Waste = c(526, 350, 526, 469, 285, 433, 456,825)),class = "data.frame", row.names = c(NA, -8L))

coordinates<-subset(df,select=c("Latitude","Longitude")) 
d<- dist(distm(coordinates(,2:1)), method="euclidean")
fit.average<-hclust(d,method="average") 
plot(fit.average,hang=-1,cex=.8,main="Average Linkage Clustering")
   

enter image description here

### USING PVCLUST
coordinates<-subset(df,select=c("Latitude","Longitude")) 
d<-dist(distm(coordinates(,2:1)))
mat <- as.matrix(d)
mat <- t(mat)
fit <- pvclust(mat, method.hclust="average", method.dist="euclidean", 
               nboot=10)
plot(fit,hang=-1,cex=.8, cex.pv=.5, print.num=FALSE, print.pv=FALSE, 
      main="Average Linkage Clustering") 

enter image description here

### FOR DATABASE DF WITH 19 PROPERTIES

     df<-structure(list(Propertie = c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19), Latitude = c(-23.8, -23.9, -23.5, -23.4, -23.6,-23.9, -23.2, -23.5, -23.8, -23.7, -23.8, -23.9, -23.4, -23.9,-23.9, -23.2, -23.3, -23.7, -23.8),
Longitude = c(-49.1, -49.3,-49.4, -49.7, -49.6, -49.6, -49.6, -49.6, -49.6, -49.6, -49.7,-49.2, -49.5, -49.8, -49.5, -49.3, -49.3, -49.2, -49.5), 
Waste = c(526,350, 526, 469, 285, 175, 175, 350, 350, 175, 350, 175, 175, 364,175, 175, 350, 45.5, 54.6)), class = "data.frame", row.names = c(NA, -19L))

Figure for hclust

enter image description here

Figure for pvclust

enter image description here