Cloudflare blocks my access when trying to post Nyquist code

I wanted to share a Nyquist plugin in a new post in the “New plugins” forum.
But after copying the code (without or within code tags doesn’t matter) and trying to see the preview I got a banner from Cloudflare in my face:

Sorry, you have been blocked
You are unable to access audacityteam.org

Cloudflare Ray ID: 63fea0182a0641fd • Your IP: • Performance & security by Cloudflare

Splitting the code in chunks I found that I could post about half of it before the block hit me.

What do I need to do to be able to share the full code?
Obviously I can’t share the code in this post for you to try :unamused: but I can in an email, if desired.

Were you posting the code directly in your post, or as an attachment?
The “New plugins” forum should allow you to post a “.ny” file as an attachment (see: https://forum.audacityteam.org/t/how-to-attach-files-to-forum-posts/24026/1)

The limit for the number of characters in a post is fairly small, so if you were posting the code in-line, you may have hit the limit.

I was trying it inline, because I was unaware of the option to attach a file. ~140 lines of code then was probably too much.
Anyway, following your advice I tried attaching the *.ny file (8 kB) - but it threw an “http error”. However after quitting the error, the filename was displayed in the list of attached files, but “status” was a green bar, not a green checkmark. Attaching another (smaller) *.ny file worked OK.
What am I doing wrong?

I don’t think you’re doing anything wrong. It looks like a connection problem from your location.
Are you able to try again with a different web browser?

Hmm - this is odd.
Originally I used Fireox, now I’m on Chrome. But the same problem persists (on Win8.1). Also tried FF and Edge on Win10 to no avail.
Here I what I did then:

  1. change extension of file from *.ny to *.txt => error
  2. changed filename name from “fade and silence.txt” to “xxx.txt” (no spaces in name) => error
  3. split file into two, about equally sized (xxx - 1.txt and xxx - 2.txt) => upload of xxx - 1.txt OK, upload of xxx - 2.txt failed
  4. split xxx-2.txt again into two chunks xxx - 2.1 and xxx - 2.2 => now upload of both files worked OK

So in the end you can restore the original file by just patching the three together - however this doesn’t feel right.
Any clue what’s wrong here?
xxx - 2.2.ny (1.93 KB)
xxx - 2.1.ny (2.17 KB)
xxx - 1.ny (3.47 KB)

After reassembling your script into a single file I can reproduce the “http error” problem.

I’ll look into it, but I’ll probably need to speak to the system administrator, which will later today because of time zones.
It looks like a configuration problem in the Cloudflare settings (similar to when an anti-virus app detects a “false positive”)

The system administrator has tweaked some settings. You should now be able to post the full plug-in.

Before you do, there’s a few details that I noticed that you may want to change:

  1. Use spaces rather than tabs.
    The problem with tabs is that the amount of space they create depends on the text editor that you are using. The code may look beautifully laid out and clear in one text editor, and be all over the place in another, simply due to different tab sizes.
    For LISP languages (including Nyquist) it is common to use two spaces for each indent level.

  2. Avoid dangling parentheses.
    LISP languages tend to use a lot of short lines and many indentation levels which make dangling parentheses cumbersome:

;; Good
(defun test (param)
  (let ((val (* param 2)))
    (if (> val 42)
        val
        (- val 100))))



;; Bad
(defun test (param)
  (let ((val (* param 2)
        )
       )
    (if (> val 42)
        val
        (- val 100)
    )
  )
)
;name "fade 'n silence"

Is that a typo?
By convention, names of effects are capitalised, and it is highly recommended to avoid punctuation characters.
I’m unsure what you meant, but perhaps something like:

;name "Fade in Silence"
;author "Steve Daulton & Samse26"

Avoid special characters in header strings. I don’t think there’s a problem in this specific case, but in some cases they can cause weird bugs. Best to stick with normal “safe” characters a to z, A to Z, 0 to 9, hyphen (“-”), space, and underscore (“_”).
Better as:

;author "Steve and Samse26"

or just:

;author "Samse26"

with a comment about where you got the other code:

;; Based on code from: https://forum.audacityteam.org.whatever
  1. Code comments
    I often add far too many code comments. This is intentional because there’s not many code examples available for people learning Nyquist, so I add them to help people that are unfamiliar with Nyquist. For “production code” it is better to only add code comments when necessary. It’s much better to try to write code that is self explanatory.

A classic example of bad commenting:

; l ("L") is the label list
; The "nl" function adds a new label to the label list
(setf l (nl 0 4 str))

Much better is:

(setf labels (add-label 0 4 str))

(Adding the “manual” as comments at the top of the file as you’ve done is often useful)

Thanks for following up with the sysadmin and getting the problem fixed.
Since this is my first Nyquist plug-in, next thing after my posting was to ask for style recommendations for the code - so I do appreciate your comments. Is there a style guide document for Nyquist/LISP code formatting?
The comments in the code were added mainly for my own education, since sometimes it took me a while to decipher the meaning. I also thought it was good if others want to understand it, but I can remove them as well in the “published” version.
I will rework the code and then post it on the Nyquist forum. (Hopefully without problems :wink: )

There’s these two topics.

They’ve not been updated in years, so if you spot any problems let me know and I’ll update them.