Cloudflare blocks my access when trying to post Nyquist code

Suggestions and Questions About the Forum Web Site.
Forum rules
ImagePost here only if the Forum isn't working as you would like or expect.

If you require help using Audacity, or think you have found a "bug", please post on the forum board relevant to your operating system.
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
Samse26
Posts: 78
Joined: Tue Nov 27, 2018 12:05 pm
Operating System: Windows 8 or 8.1

Cloudflare blocks my access when trying to post Nyquist code

Post by Samse26 » Wed Apr 14, 2021 5:38 pm

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: <to be shared privately on request> • 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 :roll: but I can in an email, if desired.

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by steve » Wed Apr 14, 2021 7:19 pm

Samse26 wrote:
Wed Apr 14, 2021 5:38 pm
But after copying the code
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: viewtopic.php?f=49&t=64936)

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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Samse26
Posts: 78
Joined: Tue Nov 27, 2018 12:05 pm
Operating System: Windows 8 or 8.1

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by Samse26 » Thu Apr 15, 2021 5:04 pm

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?

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by steve » Thu Apr 15, 2021 5:21 pm

Samse26 wrote:
Thu Apr 15, 2021 5:04 pm
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?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Samse26
Posts: 78
Joined: Tue Nov 27, 2018 12:05 pm
Operating System: Windows 8 or 8.1

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by Samse26 » Fri Apr 16, 2021 7:14 am

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
2) 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
3) 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?
Attachments
xxx - 1.ny
Part 1
(3.47 KiB) Downloaded 14 times
xxx - 2.1.ny
Part 2 - append to 1
(2.17 KiB) Downloaded 13 times
xxx - 2.2.ny
Part 3 - append to 1 + 2
(1.93 KiB) Downloaded 15 times

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by steve » Fri Apr 16, 2021 9:20 am

Samse26 wrote:
Fri Apr 16, 2021 7:14 am
Any clue what's wrong here?
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")
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by steve » Fri Apr 16, 2021 1:19 pm

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:

Code: Select all

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

Code: Select all

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

3.

Code: Select all

;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:

Code: Select all

;name "Fade in Silence"

4.

Code: Select all

;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:

Code: Select all

;author "Steve and Samse26"
or just:

Code: Select all

;author "Samse26"
with a comment about where you got the other code:

Code: Select all

;; Based on code from: https://forum.audacityteam.org.whatever

5. 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:

Code: Select all

; 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:

Code: Select all

(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)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Samse26
Posts: 78
Joined: Tue Nov 27, 2018 12:05 pm
Operating System: Windows 8 or 8.1

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by Samse26 » Fri Apr 16, 2021 4:21 pm

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 ;) )

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Cloudflare blocks my access when trying to post Nyquist code

Post by steve » Fri Apr 16, 2021 5:07 pm

Samse26 wrote:
Fri Apr 16, 2021 4:21 pm
Is there a style guide document for Nyquist/LISP code formatting?
There's these two topics.
viewtopic.php?f=39&t=42106
viewtopic.php?f=39&t=77214
They've not been updated in years, so if you spot any problems let me know and I'll update them.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply