## Language Independent – Do blanks affect runtime?

If I have two pseudocodes:

Code 1:

``````var exemplo = 7;

switch (exemplo) {
case 1, 2, 3:
print('exemplo = 1 || 2 || 3');
break;
case 3, 4, 5:
print('exemplo = 3 || 4 || 5');
break;
case 6, 7, 8:
print('exemplo = 6 || 7 || 8');
break;
default:
print('exemplo < 1 && > 8);
break;
}
``````

Code 2:

``````var exemplo         =

7;

switch
(exemplo) {
case 1,       2, 3:

print('exemplo = 1 || 2 || 3');
break;
case 3, 4, 5:

print('exemplo = 3 || 4 || 5');
break;
case

6, 7
, 8:
print('exemplo = 6 || 7 || 8');
break;
default:

print('exemplo < 1 && > 8);
break;
}
``````

Spaces and newlines beyond tabsDoes it shorten the time it takes to execute each command, even if it makes almost no difference? If not the time change, why?

## Simulate the Tic Tac Toe game in C language

I did one Tic Tac toe Play with C. Here are two players, player1 and player2can participate and play. Please rate my code and suggest improvements.

``````#include
#include
void board(char t());
int cheak(char T());

void main()
{
int i=0,n,r=100,p=1;
char TOT(9)={'1','2','3','4','5','6','7','8','9'};
char a='X';
for(;i<9;i++)
{
clrscr();
board(TOT);
printf("nnn Player1=XnPlayer2=O");
printf(" n player %d tern:-",p);
printf("nEnter number");
scanf("%d",&n);
TOT(n-1)=a;
if(a=='X')
{
a='O';
}
else
{
a='X';
}
r=cheak(TOT);
if(r==1)
{
clrscr();
board(TOT);
printf("nPlayer 1 win");
break;
}
if(r==2)
{
clrscr();
board(TOT);
printf("nPlayer 2 win");
break;
}
if(p==1)
{
p=2;
}
else
{
p=1;
}
if(i==8)
{
clrscr();
board(TOT);
printf("nnMatch Draw");
break;
}
}
getch();
}
void board(char t())
{
printf("_________________");
printf("n|| %c || %c || %c ||",t(0),t(1),t(2));
printf("n|---------------|");
printf("n|| %c || %c || %c ||",t(3),t(4),t(5));
printf("n|---------------|");
printf("n|| %c || %c || %c ||",t(6),t(7),t(8));
printf("n|---------------|");
}

int cheak(char T())
{
int i=0,n=0;
for(;n<3;n++)
{
if(T(i)=='X'&&T(i+1)=='X'&&T(i+2)=='X')
{
return 1;
}
i=i+3;
}

i=0;
for(n=0;n<3;n++)
{
if(T(i)=='X'&&T(i+3)=='X'&&T(i+6)=='X')
{
return 1;
}
i++;
}
if(T(0)=='X'&&T(4)=='X'&&T(8)=='X')
{
return 1;
}
if(T(2)=='X'&&T(4)=='X'&&T(6)=='X')
{
return 1;
}

i=0;
for(n=0;n<3;n++)
{
if(T(i)=='O'&&T(i+1)=='O'&&T(i+2)=='O')
{
return 2;
}
i=i+3;
}

i=0;
n=0;
for(;n<3;n++)
{
if(T(i)=='O'&&T(i+3)=='O'&&T(i+6)=='O')
{
return 2;
}
i++;
}
if(T(0)=='O'&&T(4)=='0'&&T(8)=='O')
{
return 2;
}
if(T(2)=='O'&&T(4)=='O'&&T(6)=='O')
{
return 2;
}
return 0;
}
``````

## translate – magento 1.9: anchor tag does not work for language translation

I want to put an anchor tag in the given text, so I kept that

``````   __("Iam here with link",\$var) ?>
``````

I wrote translations for

``````      Iam here with link in csv file but it is not translating
``````

## dnd 5e – Can a sorcerer learn spells written in an unknown language by understanding languages?

The rules for copying spells into your spellbook are:

To copy a spell into the book. If you find a spell of the first level or higher, you can add it to your spellbook if it has a magic level you can prepare, and if you have the time decipher and copy it.

Copying this spell into your spellbook involves reproducing the spell Basic form of the spell, then Decrypt the unique notation system used by the wizard that wrote it,

It is not mentioned that spells are written in any language. Maybe they are written in magical runes and diagrams. When notes are written in language, they do not seem relevant to learning the spell.

## 8 – Change the language code for the default language

I have a multilingual website with English as the default language.

The language code for English is currently `en` but I want to convert it `en-US`,

I thought about adding a new language with the right language code, but I do not think that this is the best solution because I have a lot of translated content and do not want to re-add all the translations for the new language.

Is it possible to update the language code of a current language, if not, what can I do then?

TL; DR
I have a number of languages ​​on my website and would like to update all their language codes without losing my translations.

## How can you prove that a language is not context-free?

### closure properties

Once you have a small collection of non-context-free languages, you can often use closure properties of \$ mathrm {CFL} \$ as follows:

For example, \$ L in mathrm {CFL} \$. Then through Closure property X (together with Y) \$ L & # 39; in mathrm {CFL} \$. This contradicts \$ L & # 39; notin mathrm {CFL} \$, which we know to contain \$ L notin mathrm {CFL} \$.

This is often shorter (and often less error prone) than using any of the other results that require less prior knowledge. It is also a general concept that can be applied to all types of object classes.

Example 1: Overlap with regular languages

We note \$ mathcal L (e) \$ the regular language specified by a regular expression \$ e \$.

Let \$ L = {w midw in {a, b, c } ^ *, | w | _a = | w | _b = | w | _c } \$. How

\$ qquad displaystyle L cap mathcal {L} (a ^ * b ^ * c ^ *) = {a ^ nb ^ nc ^ n in mathbb {N} } notin mathrm {CFL} \$

and \$ mathrm {CFL} \$ is closed at the intersection with regular languages, \$ L notin mathrm {CFL} \$.

Example 2: (Inverse) homomorphism

Let \$ L = {(ab) ^ {2n} c ^ md ^ {2n-m} (aba) ^ {n} mid m, n in mathbb {N} } \$. With the homomorphism

\$ qquad displaystyle phi (x) = begin {cases}
a & x = a \
varepsilon & x = b \
b & x = c lor x = d
end {cases} \$

we have \$ phi (L) = {a ^ {2n} b ^ {2n} a ^ {2n} mid n in mathbb {N} }. \$

Now with

\$ qquad displaystyle psi (x) = begin {cases}
aa & x = a lor x = c \
bb & x = b
end {cases} quad text {and} quad L_1 = {x ^ nb ^ ny ^ n mid x, y in {a, c } wedge n in mathbb {N} }, \$

we get \$ L_1 = psi ^ {- 1} ( phi (L))) \$.

Finally, when we cross \$ L_1 \$ with the regular language \$ L_2 = mathcal L (a ^ * b ^ * c ^ *) \$, we get the language \$ L_3 = {a ^ nb ^ nc ^ n mid n in mathbb {N} } \$.

Altogether we have \$ L_3 = L_2 cap psi ^ {- 1} ( phi (L)) \$.

Now suppose that \$ L \$ was context-free. Then, since \$ mathrm {CFL} \$ is locked against homomorphism, inverse homomorphism, and intersection with regular sets, \$ L_3 \$ is also context-free. But we knows (possibly via pumping lemma) that \$ L_3 \$ is not context-free, so this is a contradiction. We have shown that \$ L notin mathrm {CFL} \$.

### Exchange lemma

The Exchange lemma (1) proposes a necessary condition for context freedom that is even stronger than Ogden's lemma. For example, it can be used to show this

\$ qquad {xyyz mid x, y, z in {a, b, c } ^ + } notin mathrm {CFL} \$

that resists many other methods. This is the lemma:

Leave \$ L in mathrm {CFL} \$. Then there is a constant \$ c_L \$ such that for every integer \$ n geq 2 \$, every set \$ Q_n subseteq L_n = L cap Sigma ^ n \$ and every integer \$ m \$ with \$ n geq m geq holds 2 \$ There are \$ k geq frac {| Q_n |} {c_L n ^ 2} \$ strings \$ z_i in Q_n \$ with

1. \$ z_i = w_ix_iy_i \$ for \$ i = 1, dots, k \$,
2. \$ | w_1 | = | w_2 | = dots = | w_k | \$,
3. \$ | y_1 | = | y_2 | = dots = | y_k | \$,
4. \$ m geq | x_1 | = | x_2 | = dots = | x_k | > frac {m} {2} \$ and
5. \$ w_ix_jy_i in L_n \$ for all \$ (i, j) in (1..k) ^ 2 \$.

Applying it means finding \$ n, m \$ and \$ Q_n \$ such that 1.-4. but keep 5th is hurt. The application example in the original work is very detailed and is therefore omitted here.

Currently, I have no freely available reference and the above formulation comes from a preprint of (1) from 1981. I am grateful for finding better references. It seems that the same property has been (re) discovered recently (2).

### Other necessary conditions

Boonyavatana and Slutzki (3) investigate several conditions that are similar to Pumping and Interchange Lemma.

1. An "Interchange Lemma" for context-free languages ​​by W. Ogden, R. J. Ross and K. Winklmann (1985)
2. Exchange of Lemmas for Regular and Context Free Languages ​​by T. Yamakami (2008)
3. The Exchange or Pump (DI) Lemmas for Context Free Languages ​​by R. Boonyavatana and G. Slutzki (1988)

## Views – How to Use Drupal to Learn Basic Words of a Language?

To help myself and others learn new natural languages, I'd like to create a program that makes it easy to translate commonly used phrases that are available in all these languages.

Such a program contains the following functions:

1. A user has a web page with two or more single-column HTML tables
(Each such table represents a linguistic context, in the sense of a set of basic sentences in English, such as: connection or conditioning).
2. Each table has basic English, which serves as a starting point for the translation
(although there is no need for an English-centered design)
3. A user can add a column for each table, and each column contains translation placeholders that can be used to enter translations of phrases in a particular language of choice
(After double-clicking on a translation placeholder).

A good non-Drupal demonstration of this concept is this program (thanks to Jhecht for developing this code).
Run the snippet and double-click a translation placeholder to translate a phrase.

``````const definitions = {
"if": null,
"when": null,
"tomato": null,
};

const tbody = document.querySelector('#definitions');

const parent = e.target.parentElement;

if (parent.tagName !== 'TR' || parent.dataset.editorShown === 'true') return;

parent.dataset.editorShown = true;

const dataTd = parent.querySelector('td:last-child');
const textarea = document.createElement('textarea');
textarea.placeholder = "Double click to translate";

dataTd.replaceChild(textarea, dataTd.firstChild);
dataTd.firstChild.focus();

});

function blurOrKeypress(e) {
// split up largely for readability
if (e.target.tagName !== 'TEXTAREA') return false;
if (e.type === 'keypress' && e.code != 'Enter' && !e.ctrlKey) return false;

const parent = e.target.parentElement;
const row = parent.parentElement;
const text = document.createTextNode(e.target.value || 'Double click to translate');
if (e.target.isConnected) {
parent.replaceChild(text, e.target);
row.dataset.editorShown = false;
}

}
// the one thing I miss about jquery event listeners: adding multiple types of event by putting spaces

tbody.append(...Object.entries(definitions).map(((word, translation)) => {

const tr = document.createElement('tr');
const keyTd = document.createElement('td');
const valueTd = document.createElement('td');
tr.dataset.editorShown = false;

keyTd.innerText = word;

valueTd.innerText = translation || 'Double click to translate';
tr.append(keyTd, valueTd);
return tr;
}));
``````
``````/* Styling here to make myself feel better*/
textarea.full {
height: 1.5rem;
width: 100%;
line-height: 1.5rem;
}

.bold {
font-weight: bold;
}

td.bold {
font-style: unset;
}

table {
border-collapse: collapse;
width: 100%;
}

td {
color: #111;
width: 50%;
border: 1px solid lightgray;
box-sizing: border-box;
border-width: 1px 0;
font-style: italic;
}

th {
border: 2px solid lightgray;
border-width: 0 0 2px;
text-decoration: underline;
font-style: unset;
font-size: 1.15rem;
}

tbody tr:nth-child(odd) {
background-color: lightgray;
}
``````
``````

Word/Phrase
Translation

``````

If I could, I would stick with this little program, but I need Drupal's backend power so I can actually store translations in a database (if I'm not mistaken, you can not edit HTML directly from JavaScript, so save the translations ).

How could that be done in Drupal?
Possibly with views, with diagram module, possibly only with nodes;
How would you do a phrase-2 phrase translation in a "smart" way?

## Reductions – Decide if the language of the Turing machine contains an a or a b string

During the school exercises we worked on decision problems and there was one that I do not really understand. We received solutions and explanations for this exercise, but I need more guidance.

The problem is:

Prove it
$$L = { | M$$ is Turing machine, $$| L (M) cap {a, b } | = 1 } notin REC$$

Proof idea:

1. Reduction of retention problems
2. machine $$M_x$$ (Output of the reduction function) checks whether at its input $$a$$, stores this information
3. if  (Instance of HP) has no required structure, $$M_x$$ Rejects
4. $$M_x$$ simulated $$M_h$$ on $$W_h$$, if $$M_h$$ accepted, $$M_x$$ accepted if it had on his input $$a$$otherwise refuses … if $$M_h$$ is in the loop $$M_x$$ is also in the loop

then

• $$L (M) = emptyset$$ if  has damaged or damaged structure $$M_h$$ is in the loop on the word $$W_h$$
• $$L (M) = {a }$$ if  has the right structure and $$M_h$$ stops

How I see it:

• $$M_x$$ stores information of its input
• if $$M_h$$ holds, $$M_x$$ Checks stored information about inputs, if any $$a$$ or $$b$$ accept, otherwise refuse

then

• $$L (M) = emptyset$$ if  has structure or damaged $$M_h$$ is in the loop on the word $$W_h$$
• $$L (M) = {a }$$ if  has the right structure and $$M_h$$ stops with input $$a$$
• $$L (M) = {b }$$ if  has the right structure and $$M_h$$ stops with input $$b$$

I do not understand what happened to it $$b$$,

## Can there be a context-free language that is not recognized by a PEG?

This is related to this question. In essence, I want to know if my reasoning is correct.

1. We know that parsing with a context-free grammar is the same as multiplying with a Boolean matrix (Forward: Valient 1975, Backword: Lee et al., 2002), and for any matrices has a lower bound of O (n ^ 2).
2. So there should be a context-free language that takes at least 0 (n ^ 2) of time to verify membership.
3. It is known that PEGs require only a linear time (Birman and Ullman 1970) (Loff et al., 2019).
4. If there is a PEG for this context-free language, this would be a recognizer that checks membership in linear time and therefore can solve this matrix multiplication in linear time.

Therefore, there is no PEG for this CFL.

Where am I going wrong?

## Subsite language template is ignored

I have a site collection based on the Italian template.
If I create a subsite and explicitly select the Italian template, the subsite will use English as the default language anyway.

What is the problem here?