## How to set up phpcs with WordPress coding standard (in March 2021 with PHP8)?

Trying to set up PHP_CodeSniffer with the WordPress Codings Standards. I’m running PHP v8.0.3 and phpcs v3.5.8.

WPCS is installed via

git clone -b master https://github.com/WordPress/WordPress-Coding-Standards.git wpcs 

The installation worked, but running phpcs leads to this error:
phpcs: Uncaught TypeError: vsprintf(): Argument #2 (\$ values) must be of type array, string given in file.php

This is apparently an issue with WPCS and fixed in this commit. The commit seems to be not merged into master yet, so I checked out the develop branch. This appears to fix the above mentioned issue but causes another error:
phpcs: Referenced sniff "PHPCSUtils" does not exist

The proposed solution for fixing this issue is switching to the master branch, which brings me back to square one.

So both master and develop don’t work for different reasons. I guess could change the source code in the master branch manually, but that doesn’t seem to be a sustainable fix.

Is there a better way make phpcs work with the current versions of PHP and WPCS?

## Create stylish Stripe forms without coding

Hi community,
I developed the prototype of a web app that helps you to create custom design Stripe forms without coding. It does not require any front-end or back-end development. Just pick a template, customize its look, add Stripe API keys, paste the generated code into your page, add products in your Stripe dashboard, and you are ready to collect payments.

Here's a short video demo (1min 45sec)

I'd like to hear your feedback. Also, if you want to be…

Create stylish Stripe forms without coding

## Coding Spelunky Edge Roll Mechanic

Inspired by the recently released Spelunky 2, I’ve been making Spelunky clone from scratch using Monogame for gamedev coding practice.

I’ve successfully coded the basic platforming mechanics: terrain collision solving, gravity, running and jumping, even having the camera pan up or down after pressing those buttons for a half-second.

The next thing I am trying to implement is edge-hanging. Getting the basic case of hanging after falling onto an edge in the right way was easy enough. I basically just checked for the right conditions and added a boolean in my player class for whether the player is hanging, which prevents left/right motion and keeps the player from falling when it’s true.

My question is: how can I implement the edge-rolling mechanism, where you can roll over edges into an edge-hang by pressing down as you walk off? I don’t understand what extra information I need to store or how to smoothly transition the player from being halfway on the edge to hanging off of the edge one block lower.

Right now the player just kind of falls away from the edge after walking off, as you would expect with the basic mechanics so far.

## How do you prevent HTML special character coding from displaying on a website?

An article in the Wall Street Journal (wsj.com) displays HTML special character code instead of the actual character, the greater-than sign. Thus, instead of displaying >, the article displays &gt;. This occurs (for me, at least) on Chrome, Firefox, and Safari (all latest versions with cache cleared).

My (limited) understanding is that websites should have the following code in the header:

<meta http-equiv="content-type" content="text/html;charset=utf-8" /> [α] 

The wsj.com site has this code in the header: <meta charset="UTF-8">. Is this the cause of the problem? In other words, if the WSJ site had <meta http-equiv="content-type" content="text/html;charset=utf-8" /> in the header, would we see > instead of &gt;?

The Wall Street Journal article is:

• Stern, Joanna. "iOS 14 Review: Your iPhone Will Look Completely Different Now, if You Want." Wall Street Journal (16 September 2020).

The article is probably behind a firewall, so here is an image of the sentence as it appears in the article:

TIA,

Mark

Footnote
α. Kyrnin, Jennifer. "How to Use Special Characters in HTML." Lifewire (20 February 2020).

## WordPress or custom coding better for this project?

I’m a LAMP developer with a ton of experience building custom-coded websites in a variety of PHP frameworks who has been tasked to develop a website for a customer who strongly prefers that I use WordPress. My WordPress knowledge is extremely limited. I have built a couple of simple sites using Envato themes that didn’t really require any custom plugin development, or meddling with source code.

This site would be different. It would be a custom fitness tracking website where users can login, view videos of exercises, and log their workouts. (Yes, I know there are a million of these out there, but this company wants their own).

Here’s an overview of my major requirements:

• Customer accounts with secure login
• Videos of exercises
• Forms to log progress (time, reps, etc.)
• Charts and graphs to view progress
• Leaderboard to show comparisons of members
• Ability for future iOS/Android apps to integrate with the website/database

From my limited knowledge of WordPress, I would have to build some custom plugins for this. I don’t see anything out there that would accomplish all of these requirements. I’m also assuming that I would need a separate MySQL database to store the majority of this data.

Are these requirements able to be accomplished with WordPress in a relatively straightforward manner? How would a WordPress expert go about tackling this project?

## Does RLNC (Random Linear Network Coding) still need interaction from the other side to overcome packet loss reliably?

I’m looking into implementing RLNC as a project, and while I understand the concept of encoding the original data with random linear coefficients, resulting in a number of packets, sending those packets, and thus the client will be able to reconstruct the original data from some of the received packets, even if a few of the packets are lost, if enough encoded packets have arrived to create a solvable equation system.

However, I have not seen any mention of the fact that if there is a non zero percent of packet loss, there is a possibility that the receiver of the encoded packets will not receive enough packets to reconstruct the original data. The only solution I see to this is to implement some type of sequencing so that the receiver can verify he hasn’t missed some packets that would allow him to reconstruct the original data, in other words interaction. Am I missing some part of the algorithm or not? If someone has solved this problem already, can you please show me where it has been solved so I can read about it?

## 2 Paper Strip Coding Challenge

You are given two paper strips. On each strip, numbers (1,2,… N) are written in random order. Cut the original paper strip into several pieces and rearrange those pieces to form the desired sequence.

Write a function, efficiently with respect to time used, returns the minimum number of cut pieces needed to perform the described operation.

For example, the following code should display 3 because the pieces used should be (1), (4, 3) and (2):

int[] original = new int[] { 1, 4, 3, 2 }; int[] desired = new int[] { 1, 2, 4, 3 }; Console.WriteLine(PaperStrip.MinPieces(original, desired)); 

Another example, the following code should display 5 because the pieces used should be (1), (2), (3), (4, 5, 6) and (8, 9, 10):

int[] original = new int[] { 8, 9, 10, 4, 5, 6, 3, 2, 1 }; int[] desired = new int[] { 1, 2, 3, 4, 5, 6, 8, 9, 10 }; Console.WriteLine(PaperStrip.MinPieces(original, desired)); 

Here’s the code you can implement: using System;

public class PaperStrip {    public static int MinPieces(int[] original, int[] desired)    {       Throw new NotImplementedException(“Waiting to be implemented”);    }     Public static void Main(string[] argos)    {       // Easy       int[] original = new int[] { 1, 4, 3, 2 };       int[] desired = new int[] { 1, 2, 4, 3 };       Console.WriteLine(PaperStrip.MinPieces(original, desired));        // Advance       int[] original = new int[] { 8, 9, 10, 4, 5, 6, 3, 2, 1 };       int[] desired = new int[] { 1, 2, 3, 4, 5, 6, 8, 9, 10 };       Console.WriteLine(PaperStrip.MinPieces(original, desired));    } } 

I’m not sure where to begin with this one… any hints, guidance or answers are greatly appreciated. Thank you in advance.

I understand that static arithmetic coding involves using preset probabilities of symbols that remain static during the whole process. I also understand that adaptive arithmetic coding involves change all probabilities after each symbol encountered.

However, what is the point of changing the probability after each symbol? Why wouldn’t you just go through an entire file first and determine the probabilities and then do the arithmetic coding as a second pass?

Additionally, I don’t understand how changing the probability of symbols impacts the compression? If we know the true probabilities of the symbols in the file we are compressing, then will it make the file smaller?

## Significance of model in arithmetic coding

I am trying to understand the concept of arithmetic coding, i understand how the range is subdivided after each character is read from the string. But i am unable to understand why using a more accurate model compresses the string. Whether the model is static/adaptive either way the number of characters in the compressed string would be the same. What am i missing?

## Channel coding and Error probability. Where are these probabilities from?

From where are the following probabilities?

We consider BSCε with ε = 0,1 and block code C = {c1, c2} with the code words c1 = 010 and c2 = 101. On the received word y we use the decoder D = {D1,D2} which decodes the word to the code word which has the lowest hamming distance to y. Determine D1 and D2 and the global error probability ERROR(D) if the code words have the same probability. Hint: To an output y there exists only one x which gets to a failing decoding. (Y = 100 will only gets wrong decoded if we sent message is x = c1 = 010.) So the term (1− p(D(y)|y)) is equal to Pr[X = x|Y = y] for a suitable x.

Nun

\begin{aligned} &\text { Hamming-Distance: }\ &\begin{array}{c|cc} \text { Code } & 010 & 101 \ \hline \hline 000 & 1 & 2 \ \hline 001 & 2 & 1 \ \hline 010 & 0 & 3 \ \hline 011 & 1 & 2 \ \hline 100 & 2 & 1 \ \hline 101 & 3 & 0 \ \hline 110 & 1 & 2 \ \hline 111 & 2 & 1 \ \hline \end{array} \end{aligned} $$\left.D_{1}=\{000,010,011,110\} \text { (Decides for } 010\right) \left.D_{2}=\{001,100,101,111\} \text { (Decides for } 101\right)$$ \begin{aligned} E R R O R(D) &=\sum_{y \in \Sigma_{A}^{3}} p(y)(1-p(D(y) | y)) \ &=\overbrace{2 \cdot p(y)(1-p(D(y) | y))}+\quad \overbrace{6 \cdot p(y)(1-p(D(y) | y))}^{ } \ &=2 \cdot\left(\frac{729}{2000}+\frac{1}{2000}\right)\left(\frac{7}{250}\right)+6 \cdot\left(\frac{81}{2000}+\frac{9}{2000}\right)\left(\frac{757}{1000}\right) \end{aligned} How do I get to the probabilities $$\frac{7}{250}$$ and $$\frac{757}{1000}$$??

I don’t get this calculation. It should be right. But I don’t get how to get to these probabilities.

Could someone explain me this?