Number of possible functions using minterms that can be formed using n boolean variables.

Question: Consider 3 boolean variables $x, y$ and $z$. Then you can form a total of 8 expressions using each variable or its complements exactly once in each expression i.e. $xyz$, $xyz′$, $xy′z$, $xy′z′$, $x′yz$, $x′yz′$, $x′y′z$, $x′y′z′$ where $x′$ represent complement of $x$. Each of these terms is called a minterm. So if we have $n$ variables, we can have a total of $2^n$ minterms.
Now any boolean function which involves these n variables can be expressed as a sum of one or more of these minterms.
For a better explanation, look into this wiki link here.
So what is the possible number of functions using $n$ boolean varibles? Below is my attempt:
Since we have $n$ boolean variable, that means we have $2^n$ possible minterms and any function using  given $n$ boolean variables is essentially a sum of one or more of these. So this essentially reduces our problem to the number of ways that we can pick these minterms.
For each minterms, we have two options, either to select it or to not.
Repeating this for every minterm, We have that total number of possible functions is:
$2*2*2*....... (2^n times)$
$= 2^{2^n}$ possible functions.
But the solution states that the total number of possible functions is $2^{2n}$.
Where am I going wrong?
Comment: There seems to be a counterexample for $2^{2n}$. For $n=0$, you get $2^0=1$, and $2^{2^n}=2$. There are two possible functions, $0$ and $1$.
Comment: Yep, it seems to me that your logic is correct. There should be $2^{2^n}$ possible functions from $n$ boolean variables to a boolean value.
Answer: There are $2^n$ possible input vectors to the boolean function, and $2$ possible outputs, so you have $2^{2^n}$ possible boolean functions (as in this question).
The person who wrote the answer probably reversed the inputs and the outputs -- if you have a function which takes a boolean, and outputs a length n boolean vector, there are $2^{2n}$ such functions.


Ordenação de vetores de string e numeros

Question: estou com um problema em um exercicio da facul.
Basicamente é um sistema de loja, onde eu entro com a quantidade de lojas, a quantidade de produtos, o nome dos produtos, e a quantidade de produtos em cada loja.
Até aqui tudo bem, o meu problema esta no fato de que eu tenho que imprimir a matriz que contem os produtos em ordem alfabética, ou seja, preciso criar uma função que ordene um vetor de strings, e não somente isso, também tenho que mudar a matriz com as quantidades de produtos assim como mudo o nome dos produtos, se não ficarei com os nomes em ordem mas as quantidades dos produtos erradas.
Minha idéia seria percorrer a matriz de strings e identificar em qual posição estão os menores elementos em ordem crescente e adicionar seus indices em uma matriz auxiliar, para que depois na hora de imprimir a matriz com os nomes e com os produtos eu siga os indices dessa matriz auxiliar, e não de um for, por exemplo:
matrizNome[0] = macarrao
matrizNome[1] = alface
matrizNome[2] = cebola
matrizNome[3] = batata

Criando a matriz auxiliar e salvando os indices da matrizNome, dessa maneira:
matrizAux[0] = 1
matrizAux[1] = 3
matrizAux[2] = 2
matrizAux[3] = 0

E então, quando for imprimir, uso os valores contidos na matrizAux:
for(i = 0; i < tamanho; i++){

    aux = matrizAux[i];
    printf("%d", matrizNome[aux]);

Mas ainda não consegui pensar em como fazer isso, vou deixa o meu codigo aqui em baixo e se caso puderem me ajudar, ficarei muito agradecido.
int ordena(char **matrizNome, int prod){

int i, j, k, auxnum;
int *vet = (int *) malloc (prod * sizeof(int));
char *aux[20];

for(i = 0; i < prod; i++){

    strcpy(aux, matrizNome[i]);

    for(j = i+1 ; j < prod; j++){

        k = strcmp(aux, matrizNome[j]);

    }
}
}

int main (int argc, char *argv[]){

int prod; //Numero de colunas
int loja; //Numero de linhas
int i, j, k, nprod, nloja, prodLoja;
int **matriz = NULL, *vet;
char **matrizNome = NULL;
char produto[20];
int tamanho;

printf("Insira a quantidade de lojas: "); //Recebe a quantidade de lojas
scanf("%d", &loja);

printf("Insira a quantidade de produtos: "); //Recebe a quantidade de produtos
scanf("%d", &prod);

matriz = (int **) malloc (prod * sizeof(int)); //Inicia a matriz com prod colunas
for(i = 0; i < prod; i++){
    matriz[i] = (int *) malloc (loja * sizeof(int));
}

matrizNome = (char **) malloc (prod * sizeof(char));

printf("\n");
gets(produto);

for(i = 0; i < prod; i++){

    printf("Insira o nome do produto %d: ", i + 1);
    gets(produto);
    matrizNome[i] = (char *) malloc (30 * sizeof(char)+1);
    strcpy(matrizNome[i], produto);
}

//Entra com os valores na matriz [produto][loja]
for(i = 0; i < prod; i++){

    for(j = 0; j < loja; j++){

        printf("Insira a quantidade de itens %d na loja %d: ", i+1, j+1);
        scanf("%d", &matriz[i][j]);
    }
}

//Pula uma linha e escreve LOJA
printf("\nLoja:");

//Imprime a quantidade de lojas
for(k = 0; k < loja; k++){

    if(k == 0){
        printf("\t\t%d", k+1); //Dois tabs depois de imprimir loja
    }
    else{
        printf("\t%d", k+1); //Um tab depois do 1
    }
}

//Imprime um pulo de linha
printf("\n");

//Imprime a matriz para o usuario
for(i = 0; i < prod; i++){

    printf("\n%s", matrizNome[i]);
    tamanho = strlen(matrizNome[i]);

    if(tamanho < 8){
        printf("\t");
    }

    for(j = 0; j < loja; j++){

        printf("\t%d", matriz[i][j]);
    }
}

//Imprime um pulo de linha
printf("\n");

 //Libera a memoria Heap onde a matriz estava armazenada
for(i = 0; i < prod; i++) free(matriz[i]);
free (matriz);
for(i = 0; i < prod; i++) free(matrizNome[i]);
free (matrizNome);
}

Answer: Nick, acredito que usando várias matrizes voce acabe usando a mesma quantidade de memória (ou mais até) que se usasse uma unica matriz com o nome e as quantidades, separadas por um "separador".
Algo como:
 matrizNome[0] = macarrao|0001|R$ 23,00
 matrizNome[1] = alface|0202|R$ 44,00
 matrizNome[2] = cebola|0051|R$ 3,00
 matrizNome[3] = batata|0002|R$ 11,00

Assim sendo, voce teria uma matriz de produtos, seu "indice" (que pode servir a outros propósitos) e seu preço unitário.
Ao imprimir esta matriz, bastaria voce efetuar um SORT nela ou fazer o SORT para uma nova matriz. Obviamente que voce pode ainda ter matrizes de produtos diferentes para diferentes tipos de alimentos (verduras, legumes, frutas).
Se pensar que suas linhas podem ser as acima, verá que conter uma matriz indexadora de ordem alfabética é apenas criar mais demanda de memória, sem necessidade.
MAS, seguindo o que voce deseja, penso que efetuar apenas um Bubble-Sort em sua matriz de nomes já executa o que deseja - ou seja, a matriz será sorteada sempre que for imprimi-la, o que não deverá criar demanda de CPU se for usando um bom algoritmo de SORT.
Consulte no Google sobre SORT STRING ALGORITHMS e verá coisas muito boas...
Espero ter ajudado.


Change a ternary conditional operator to regular if else statement

Question: I have a logic that checks the start and end date of an event. If the start and end date are in the same month then it shows only one date, for example 18 Feb, 2021. But if it's a multi-day event then it shows the event date like this, for example 18 Feb - 24 Mar, 2021.
This logic is taken care of by a ternary conditional and it's working fine, but now I would like to add a third condition for when the event is multi-day and the start & end date are in the same month.  For this third condition, I would like to omit the month name in start date and only show the month once after the end date, like this: 18 - 22 Feb, 2021 and not 18 Feb - 22 Feb, 2021.
This is my ternary conditional, I was thinking changing it to a standard if else statement for more flexibility but I am not sure how to change that and what would be the logic for the third condition:
<%# (String.Format("{0:dd MMM}", (DateTime)Eval("EventStart")) == String.Format("{0:dd MMM}", (DateTime)Eval("EventEnd"))) ? String.Format("{0:dd MMM, yyy}", ((DateTime)Eval("EventEnd")).AddMinutes((double)Eval("EventEndUtcOffset"))) : String.Format("{0:dd MMM}", ((DateTime)Eval("EventStart")).AddMinutes((double)Eval("EventStartUtcOffset")))+" - "+String.Format("{0:dd MMM, yyy}",((DateTime)Eval("EventEnd")).AddMinutes((double)Eval("EventEndUtcOffset"))) %>

Any help to understand the logic of this code as it is now would be appreciated and it helps me understand how to change it to an if else statement.
Comment: So your question is how to write an [`if...else`??!](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/if-else)
Comment: I would be tempted to move all the logic out of the `<%# .. %>` as it's fairly unreadable as it is. Tidying the code up would make it much easier to see what is going on.
Comment: No exactly. I know how to write an if statement but I can't make sense of the logic in the ternary code. I was wondering if it's possible to add the third condition in the same code and if it's not then how to dissect and change it to an if statement
Comment: That's what I am trying to understand
Answer: So, let's start by adding some whitespace to format it as a ternary:
(String.Format("{0:dd MMM}", (DateTime)Eval("EventStart")) == String.Format("{0:dd MMM}", (DateTime)Eval("EventEnd")))
    ? String.Format("{0:dd MMM, yyy}", ((DateTime)Eval("EventEnd")).AddMinutes((double)Eval("EventEndUtcOffset")))
    : String.Format("{0:dd MMM}", ((DateTime)Eval("EventStart")).AddMinutes((double)Eval("EventStartUtcOffset")))+" - "+String.Format("{0:dd MMM, yyy}",((DateTime)Eval("EventEnd")).AddMinutes((double)Eval("EventEndUtcOffset")))

That's fairly easy to translate directly into an if/else:
string result;
if (String.Format("{0:dd MMM}", (DateTime)Eval("EventStart")) == String.Format("{0:dd MMM}", (DateTime)Eval("EventEnd")))
{
    result = String.Format("{0:dd MMM, yyy}", ((DateTime)Eval("EventEnd")).AddMinutes((double)Eval("EventEndUtcOffset")));
}
else
{
    result = String.Format("{0:dd MMM}", ((DateTime)Eval("EventStart")).AddMinutes((double)Eval("EventStartUtcOffset")))+" - "+String.Format("{0:dd MMM, yyy}",((DateTime)Eval("EventEnd")).AddMinutes((double)Eval("EventEndUtcOffset")));
}

That hasn't particularly helped the readability however... Let's improve it slightly.
Start by declaring some variables to avoid all of those repeated casts:
var eventStart = (DateTime)Eval("EventStart");
var eventEnd = (DateTime)Eval("EventEnd");
double eventEndUtcOffsetMins = (double)Eval("EventEndUtcOffset");
string result;
if (String.Format("{0:dd MMM}", eventStart) == String.Format("{0:dd MMM}", eventEnd))
{
    result = String.Format("{0:dd MMM, yyy}", eventEnd.AddMinutes(eventEndUtcOffsetMins));
}
else
{
    double eventStartUtcOffsetMins = (double)Eval("EventStartUtcOffset");
    result = String.Format("{0:dd MMM}", eventStart.AddMinutes(eventStartUtcOffsetMins))+" - "+String.Format("{0:dd MMM, yyy}",eventEnd.AddMinutes(eventEndUtcOffsetMins));
}

This is getting better. We can shorten it a bit by using TimeSpans for those offsets: that shifts the complexity from those already-long String.Format lines, into the lines which declate eventStartUtcOffset and eventEndUtcOffset.
var eventStart = (DateTime)Eval("EventStart");
var eventEnd = (DateTime)Eval("EventEnd");
var eventEndUtcOffset = TimeSpan.FromMinutes((double)Eval("EventEndUtcOffset"));
string result;
if (String.Format("{0:dd MMM}", eventStart) == String.Format("{0:dd MMM}", eventEnd))
{
    result = String.Format("{0:dd MMM, yyy}", eventEnd + eventEndUtcOffset);
}
else
{
    var eventStartUtcOffset = TimeSpan.FromMinutes((double)Eval("EventStartUtcOffset"));
    result = String.Format("{0:dd MMM}", eventStart + eventStartUtcOffset)+" - "+String.Format("{0:dd MMM, yyy}",eventEnd + eventEndUtcOffset);
}

We can also remove those calls to String.Format, and use interpolated strings instead:
var eventStart = (DateTime)Eval("EventStart");
var eventEnd = (DateTime)Eval("EventEnd");
var eventEndUtcOffset = TimeSpan.FromMinutes((double)Eval("EventEndUtcOffset"));

string result;
if ($"{eventStart:dd MMM}" == $"{eventEnd:dd MMM}")
{
    result = $"{eventEnd + eventEndUtcOffset:dd MMM, yyy}";
}
else
{
    var eventStartUtcOffset = TimeSpan.FromMinutes((double)Eval("EventStartUtcOffset"));
    result = $"{eventStart + eventStartUtfOffset:dd MMM} - {eventEnd + eventEndUtfOffset:dd MMM, yyy}";
}

That's a bit better -- at least we can now see what the code is doing.
Comment: Saved my day. Just the first part of the explanation helped me a lot and the way you cleaned it up makes a lot more sense. Thank you! :)
Answer: Try this code-
var startDate = new DateTime(2020, 12, 12);
var endDate = new DateTime(2020, 02, 18);

var resDate=GetDateBreak(startDate, endDate);
Console.WriteLine(resDate);

public static string GetDateBreak(DateTime sDate, DateTime eDate)
    {
        CultureInfo info = new CultureInfo("en-us");
        return (sDate.Month == eDate.Month) ? $"Date={sDate.Day}-{eDate.Day} {info.DateTimeFormat.GetAbbreviatedMonthName(eDate.Month)},{eDate.Year}"
            : $"Date={sDate.Day} {info.DateTimeFormat.GetAbbreviatedMonthName(sDate.Month)}-{eDate.Day} {info.DateTimeFormat.GetAbbreviatedMonthName(eDate.Month)},{eDate.Year}";
    }


Python parsing multi column file

Question: I have a file where i need to parse and construct in to a single row from multi row using python
NAME ID

TITLE DEP

USER1  0023

S1  SALES

USER2  0022

A2  ACCOUNT

As you can see here the file header are NAME, ID, TITLE, DEP
I want to print output like below so i can read easy in csv file and do other stuff easily.
NAME, ID, TITLE, DEP
USER1,0023,S1,SALES
USER2,0022,A2,ACCOUNT

Below is the code i started with but not able to get to where i want.
I tried with different options to split and replace but did not worked.
import csv
file =open('test_file_parse.csv','r')
out_file=open('test_out.csv','w')
lines = file.readlines()
file.close()
for line in lines:
    line=line.strip()
    print (line)

Any help is appreciated
Comment: Why don't you use something like `sed` to join the pairs of lines first and then process it like a normal delimited file?
Answer: Having all the words in a file called file.txt here is the code:

# read all the words
with open('file.txt') as f:
    words = f.read().split()

# convert to groups of 4-s
groups4 = [words[i:i+4] for i in range(0, len(words), 4)]

# convert to lines with commas using join()
lines = [', '.join(lst) for lst in groups4]

# and here is the result
for line in lines:
    print(line)

Output:
NAME, ID, TITLE, DEP
USER1, 0023, S1, SALES
USER2, 0022, A2, ACCOUNT

Comment: Depends on the size of the file. This requires that you can edit the whole thing at once in memory.
Comment: How can you handle blank filed/column in this case ?
Answer: infile = open('test_file_parse.csv','r')
def custom_func(x):
    return next(x).strip().split()
while infile:
    try:
       print ','.join(reduce(lambda x, y: x + y, (custom_func(infile) for z in range(4))))
    except TypeError:
       break
infile.close()

Comment: Can you elaborate on how this code will solve the OP's problem?
Answer: If you know everything will be pairs of two lines and you know you can ignore empty lines, you could do something like:
infile = open('test_file_parse.csv', 'r')

# A generator that yields the non-empty lines, without newlines.
lines = (l.strip() for l in infile if l.strip())

# An iterator to iterate over the yielded lines.
line_iter = iter(lines)

# A generator to yield space-separated combined lines.
new_lines = (' '.join(l_pair) for l_pair in zip(line_iter, line_iter))

# Lastly, a generator to yield proper csv for the lines.
csv_lines = (','.join(l.split()) for l in new_lines)

for line in csv_lines:
    print line

Comment: Note that since this uses generator comprehensions and an iterator, it should work on arbitrarily large input files without requiring everything to be in memory at once.

Python parsing multi column file


Locating memory leak in Apache httpd process, PHP/Doctrine-based application

Question: I have a PHP application using these components:

Apache 2.2.3-31 on Centos 5.4
PHP 5.2.10
Xdebug 2.0.5 with Remote Debugging enabled
APC 3.0.19
Doctrine ORM for PHP 1.2.1 using Query Caching and Results Caching via APC
MySQL 5.0.77 using Query Caching

I've noticed that when I start up Apache, I eventually end up 10 child processes.  As time goes on, each process will grow in memory until each one approaches 10% of available memory, which begins to slow the server to a crawl since together they grow to take up 100% of memory.
Here is a snapshot of my top output:
<code> PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1471 apache    16   0  626m 201m  18m S  0.0 10.2   1:11.02 httpd
 1470 apache    16   0  622m 198m  18m S  0.0 10.1   1:14.49 httpd
 1469 apache    16   0  619m 197m  18m S  0.0 10.0   1:11.98 httpd
 1462 apache    18   0  622m 197m  18m S  0.0 10.0   1:11.27 httpd
 1460 apache    15   0  622m 195m  18m S  0.0 10.0   1:12.73 httpd
 1459 apache    16   0  618m 191m  18m S  0.0  9.7   1:13.00 httpd
 1461 apache    18   0  616m 190m  18m S  0.0  9.7   1:14.09 httpd
 1468 apache    18   0  613m 190m  18m S  0.0  9.7   1:12.67 httpd
 7919 apache    18   0  116m  75m  15m S  0.0  3.8   0:19.86 httpd
 9486 apache    16   0 97.7m  56m  14m S  0.0  2.9   0:13.51 httpd
</code>
I have no long-running scripts (they all terminate eventually, the longest being maybe 2 minutes long), and I am working under the assumption that once each script terminates, the memory it uses gets deallocated.  (Maybe someone can correct me on that).
My hunch is that it could be APC, since it stores data between requests, but at the same time, it seems weird that it would store data inside the httpd process.
How can I track down which part of my app is causing the memory leak?
What tools can I use to see how the memory usage is growing inside the httpd process and what is contributing to it?
Answer: There is a very good answer to a similar question here:
How can I determine the cause of an apparent memory leak in my Apache/PHP based web app?
Comment: I've also learned that Apache child processes do NOT release memory back to the OS, even if the memory inside the process has been freed:

 * http://php.net/manual/en/function.apache-child-terminate.php
 * http://doughboy.wordpress.com/2008/02/13/apache-worker-and-php/#comment-18402


How to split an XMM 128-bit register into two 64-bit integer registers?

Question: How to split a 128-bit xmm register into two 64-bit quadwords?
I have a very large number in xmm1 and want to get the higher quadword to r9 and lower quadword to r10, or RAX and RDX.
movlpd or movhpd only works with reg to mem or vice versa.
Comment: Compile `long long f(long long __attribute__((vector_size(16))) x){return x[1];}` with gcc (and the version with `0`) to get some suggestions...
Answer: SSE2 (baseline for x86-64) has instructions for moving data directly between XMM and integer registers (without bouncing through memory).  It's easy for the low element of a vector: MOVD or MOVQ.  To extract higher elements, you can just shuffle the element you want down to the low element of a vector.
SSE4.1 also added insert/extract for sizes other than 16-bit (e.g. PEXTRQ).  Other than code-size, it's not actually faster than a separate shuffle and movq on any existing CPUs, but it means you don't need any extra tmp registers.
#SSE4.1
movq    rax, xmm0       # low qword
pextrq  rdx,  xmm0, 1   # high qword
# 128b result in rdx:rax, ready for use with div r64 for example.
# (But watch out for #DE on overflow)
# also ready for returning as a __int128_t in the SystemV x86-64 ABI

#SSE2
movq       r10, xmm0
punpckhqdq xmm0, xmm0    # broadcast the high half of xmm0 to both halves
movq       r9,  xmm0

PUNPCKHQDQ is the most efficient way to do this.  It's fast even on old CPUs with slow shuffles for element-sizes smaller than 64-bit, like 65nm Core2 (Merom/Conroe).  See my horizontal sum answer for more details about that.  PUNPCKHQDQ doesn't have an immediate operand, and is only SSE2, so it's only 4 bytes of code-size.
To preserve the original value of xmm0, use pshufd with a different destination.  Or to swap high and low halves in-place, or whatever.

movlpd or movhpd ...

There's no point in ever using them.  Use movlps / movhps instead, because they're shorter and no CPUs care about float vs. double.
You can use movhlps xmm1, xmm0 to extract the high half of xmm0 into another register, but mixing FP shuffles with integer-vector operations will cause bypass delays on some CPUs (specifically Intel Nehalem).  Also beware of the dependency on xmm1 causing a latency bottleneck.
Definitely prefer pshufd for this in general.  But you could use movhlps if you're tuning for a specific CPU like Core2 where movhlps is fast and runs in the integer domain, and pshufd is slow.


uid is not taking

Question: I'm getting uid by $account->uid on rules when I wrote a query by using this id it returns 0 rows.
Below is the code that i'm writing on rules
$uid=$account->uid;
$sql="select * from profile where uid=:uid";
$args = array(':uid' => $uid);
$row = db_query($sql, $args)->rowCount();
echo $row;

the output is 0. uid is there on both tables
please help me why this is happening.
Comment: Which version of Drupal are you using, and are you sure that there is table named 'profile'?
Answer: The documentation for DatabaseStatementInterface::rowCount states:

Returns the number of rows affected by the last SQL statement.
Return value
The number of rows affected by the last DELETE, INSERT, or UPDATE
  statement executed.

Notably, "SELECT" isn't included in there, so may not be reliable to use with selections.
Assuming $account is a valid user object, you may find you have a query result if you try something like:
// Get query result using db_select
$result = db_select('profile', 'p')
            ->fields('p')
            ->condition('uid', $account->uid)
            ->range(0,1)
            ->execute()
            ->fetchObject();
drupal_set_message('
'.var_export($result,1).'
');

It might just be the missing curly braces around the table name (profile versus {profile}).
Lastly, you might also be interested in profile2_load_by_user($account, 'main').

uid is not taking


Add custom SQL column in register

Question: environment: vs2017, .core net 2.1, default .core project with MVC
I try to add NickName column store in SQL DB, i had update DB and also add NickName column in the input model. it succeeds to show input the NickName option in the register page but fault to write into SQL DB after clicks register(and other work as usual).
after override IdentityUser it does not work.
add/chg code in Register.cshtml.cs:
        public class CustomUserproperties : IdentityUser
        {
            public string NickName { get; set; }
        }

        public async Task<IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl = returnUrl ?? Url.Content("~/");
            if (ModelState.IsValid)
            {
                //here is where i change.
                var user = new CustomUserproperties { UserName = Input.UserName, Email = Input.Email, NickName = Input.NickName };
                var result = await _userManager.CreateAsync(user, Input.Password);

what could i do else?
Answer: Here is a working demo, you could refer to create a new or check the difference between your old one.
1.Modify ApplicationDbContext and Add-migration , update-database
public class ApplicationDbContext : IdentityDbContext<CustomUserproperties>
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }
}

2. Scaffold the Identity with the above ApplicationDbContext , then you could get RegisterModel like below:
 public class RegisterModel : PageModel
{
    private readonly SignInManager<CustomUserproperties> _signInManager;
    private readonly UserManager<CustomUserproperties> _userManager;
    private readonly ILogger<RegisterModel> _logger;
    private readonly IEmailSender _emailSender;

    public RegisterModel(
        UserManager<CustomUserproperties> userManager,
        SignInManager<CustomUserproperties> signInManager,
        ILogger<RegisterModel> logger,
        IEmailSender emailSender)
    {
        _userManager = userManager;
        _signInManager = signInManager;
        _logger = logger;
        _emailSender = emailSender;
    }

    [BindProperty]
    public InputModel Input { get; set; }

    public string ReturnUrl { get; set; }

    public class InputModel
    {
        [Required]
        [Display(Name = "NickName")]
        public string NickName { get; set; }

        [Required]
        [EmailAddress]
        [Display(Name = "Email")]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }

    public void OnGet(string returnUrl = null)
    {
        ReturnUrl = returnUrl;
    }

    public async Task<IActionResult> OnPostAsync(string returnUrl = null)
    {
        returnUrl = returnUrl ?? Url.Content("~/");
        if (ModelState.IsValid)
        {
            var user = new CustomUserproperties { UserName = Input.Email, Email = Input.Email , NickName = Input.NickName };
            var result = await _userManager.CreateAsync(user, Input.Password);

            ...
        }
    }
}

3.Change the ConfigureServices in StartUp.cs
     services.AddDbContext<ApplicationDbContext>(options =>
            options.UseSqlServer(
                Configuration.GetConnectionString("DefaultConnection")));
     services.AddDefaultIdentity<CustomUserproperties>()
            .AddEntityFrameworkStores<ApplicationDbContext>();

4._LoginPartial.cshtml
@inject SignInManager<CustomUserproperties> SignInManager
@inject UserManager<CustomUserproperties> UserManager

Here is my project .

Add custom SQL column in register


joining 3 tables in one sql

Question: I have 3 tables as described below ,
table1 'ads'

 id     userid
 1       47
 2       47                    //ads.id  = adcat.adid
 3       45
 4       47

table2  'adcat'

  adid    catid
   1        1
   2        3
   3        3                 // adcat.catid  = categories.id
   4        3

 table3  'categories'

   id        name
    1        mathematic
    2        biolog
    3        leteratur
    4        chemi

What I want is to get categories.id from ads.id.
I have tried this
SELECT categories.id, ads.id
FROM ads
INNER JOIN adcat ON ads.id = adcat.adid
INNER JOIN categories ON categories.id = adcat.catid

But it does not come by the exact value.
obs : I don't get any error just not exact value.
any help will be much appreciated.
Comment: what result do you want to get? It seems that you have correct `join` syntax.
Comment: Can you edit your post to show what the table of results you want would actually look like, like you did for your current 3 tables.
Comment: Your result will be same as adcat table with different colum order. What is the result you see when you execute that sql statement?
Comment: i have ads.id  and i want get from it the categories.id
Comment: the result is i get other ids , other numbers which does not exist
Comment: If you only want categories.id then you could just use adcat.catid and skip the second join since they are the same number. Is there more you need from categories?
Answer: I'm not sure what exactly is the question but I think you are trying to get not all but single row based on one ads.id if so:
SELECT categories.id ,ads.id
FROM ads
INNER JOIN adcat ON ads.id = adcat.adid
INNER JOIN categories ON categories.id = adcat.catid
WHERE ads.id = your_id_here

Answer: Seems to be no reason to go in to categories table if adcat.catid = categories.id and that is the only value you need.
SELECT ads.id,adcat.catid
FROM ads
INNER JOIN adcat
ON ads.id=adcat.adid

Use $row['catid'] with this query.
If in the future you need more columns from categories then you will need a double join:
SELECT categories.id *AS id*,ads.id *AS ads_id*
FROM ads
INNER JOIN adcat ON ads.id = adcat.adid
INNER JOIN categories ON categories.id = adcat.catid

Use $row['id'] with this query.
See *AS id* and *AS ads_id* - remove the stars and you are giving the columns an ALIAS which is basically like a nickname, this can be handy in many cases but especially important in this case since the two columns both have the same names. So now you can call $row['id'] and get categories.id
Comment: hehehehe waw it works :) i get exact value :) , i know u was sure about it :) thanks genious :)
Comment: Great, we finally got there. Good luck with the rest of it.
Comment: catid.id ?? you maybe done wrong here , i dont know what u mean
Comment: Got mixed up with your table and column names, but I edited it a few mins ago. But if you want us to provide you with an accurate answer the best thing you can do is show the table result you are actually aiming for.
Comment: i get same result as before, maybe its me who is echoing wrong , im echoing like that  `$row['id']` is it right?
Comment: That would give you ads.id not adcat.catid or categories.id. You need to do `$row['catid']` for my example, which since it skips out an unnecessary join seems most sensible, but if in the future you need more columns from categories then switch over to the double joins.
Comment: I will edit my answer to clarify what to do with the double joins.
Comment: In the future you can try `print_r($row)` to see what information is in your query result array, which will also show you the column names that you should be using.
Comment: it does not give any result :(
Comment: what doesn't give any result? `print_r($row)` or `$row['catid']`? Make sure to use `$row['catid']` with my query and `$row['id']` with the double join but removing the stars. Does `print_r($row)` show anything for either query? You could post a snippet of what it displays on your question. I updated my post since I posted the triple from rather then the double join, I'd personally use the double join.
Comment: `$row['catid']` displays nothing in ur query , and  `$row['catid']` displays wrong category id
Comment: i try your first or second sql ? there is 2
Comment: First one, and if you don't get the result you want then use `print_r($row)` and paste the result here.
Answer: Try this:
SELECT categories.id, ads.id
FROM ads, adscat, categories
WHERE ads.id=adcat.adid
AND categories.id = adcat.catid

joining 3 tables in one sql


Testing whether replicate number has an effect on outcome

Question: I have four biological (independent) replicates in each of my experimental conditions. There is a potential issue with our equipment - it's possible that the first replicate for each condition is contaminated and needs to be excluded from the analysis. What's the right way to test whether the first replicates are significantly different from the others? I was thinking of multivariate regression using replicate numbers and conditions as independent variables. Is there a better choice?
Answer: If you have serious reason to question the equipment used in the first set of biological replicates (other than you just didn't like the way the results looked), you are probably safest if you discard those data.
You could proceed the way that you propose, using additive fixed-effect terms to distinguish the replicates. But that would only account for differences in baseline values; it wouldn't account for different responses to treatment conditions (e.g., from improper slope calibration of the equipment). For that you would need to include a replicate:treatment interaction, too. If you suspect systematic differences between biological replicates, one might argue that you should do that anyway.
A potential advantage is that you can not only estimate the systematic differences among biological replicates but also get estimates of treatment effects that are corrected for those differences. The potential disadvantage is that you now have more regression coefficients to estimate, potentially lowering your power to find true treatment effects.
Your situation, however, poses an additional problem: if there was external evidence of equipment malfunction, the results from the replicates examined with that equipment might not represent the underlying biological phenomena faithfully. As a rule of thumb, the precision of an estimate increases with the square root of the number of replicates. On that basis, working with 3 replicates instead of 4 only decreases your precision by about 13% $(1-\sqrt{3/4})$. If, for reasons beyond your observations of the outcomes, you think that 1 of the replicates had technical difficulties, I think that's a reasonable tradeoff to make.

A couple of extra thoughts. First, I recall a relevant mantra from early in my training: "When in doubt, throw it out." Second, you used the word "multivariate" in your question. In this context, that word is best reserved for multiple outcomes rather than multiple predictors. The analysis here with multiple predictors should be called "multiple regression." This is a common confusion, and I confess to having published at least one paper where I consistently wrote "multivariate" instead of "multiple."


Is it possible to set up PHP-FPM with different pool-options (xdebug enabled / xdebug disabled)

Question: I've a LEMP environment and need the option to separate all development subdomains from staging (development with xdebug staging without).

dev.projectX.mydomain.tld
staging.projectX.mydomain.tld

Therefore I set up two pools php-dev and php-stage, but it seems that i can enable extensions only in the php.ini!?
Here is my pool.conf (dev)
<code>[php-dev]
listen = 127.0.0.1:9101
listen = /var/run/php-fpm/a1-php-dev.socket
listen.backlog = -1
listen.allowed_clients = 127.0.0.1

user = nginx
group = nginx

request_slowlog_timeout = 3s
slowlog = /var/log/php-fpm/slowlog-php-dev.log

pm = dynamic
pm.max_children = 20
pm.start_servers = 10
pm.min_spare_servers = 4
pm.max_spare_servers = 16
pm.max_requests = 500
pm.status_path = /status

request_terminate_timeout = 120s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

php_admin_value[zend_extension]         = "/usr/lib64/php/modules/xdebug.so"
php_admin_value[xdebug.default_enable]      = 0
php_admin_value[xdebug.remote_enable]       = 0
php_admin_value[xdebug.remote_autostart]        = 0
php_admin_value[xdebug.remote_host]         = localhost
php_admin_value[xdebug.profiler_enable_trigger]     = 0
php_admin_value[xdebug.remote_port]         = 9001
php_admin_value[xdebug.collect_params]      = 2
php_admin_value[xdebug.collect_vars]        = 1
php_admin_value[xdebug.trace_format]        = 2
</code>
Unfortunately, xdebug won't be loaded.
Is there any other option to load xdebug only on dev.* domains?
Answer: Unfortunately you can't load different modules or version of modules for each FPM pool. So far I've created multiple completely separate instances of PHP-FPM in similar situations.
Answer: Yes, but the extra pool also needs to run under a separate service. That service can use the same binaries, but needs its own conf files and (some) dirs. How to achieve this depends on your system and its service manager. I used this answer as a basis because I have systemd.
Answer: simplest is to create service in /etc/init/php-xdebug
<code>start on runlevel [2345]
stop on runlevel [016]

# you can uncomment this with recent upstart
# reload signal USR2

pre-start script
mkdir -p /run/php
chmod 0755 /run/php
chown www-data:www-data /run/php
end script

respawn
exec /usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-xdebug.conf
</code>
Answer: XDebug in combination with PHP-FPM has one pitfall - option xdebug.mode can be set only in php.ini. But if you have one production and one staging site using the same php.ini and you want xdebug enabled for staging but disabled for production (cos of performance) you got a problem.
You can solve that by creating another php-fpm service (https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files) and in unit configuration you can set php.ini file which will be new ini file with xdebug enabled.
Then you just need to make sure that your debug requests point to this new php-fpm (which you can do by setting fpm pool's listening host and port).
Hope I left some clues for others struggling with xdebug, php-fpm and php.ini stuff...


Whether to transform non-normal independent variables in logistic regression?

Question: I recently received the following email, which I paraphrase below:

I want to do binomial logistic
  regression with the data and I have non-normally distributed IVs.  I tried doing square root transformation on
  the non-normal IVs.  This was
  successful in normalising the distribution; however, when I did the
  logistic regression on the data I got ridiculous results i.e. OR: 14,
  CI 6 - 180.  So I transformed the variables back by squaring them, and
  then ran the analysis again.

Questions

Why do the odds ratios look ridiculous after applying square root transformation?
Should one apply the square root transformation to non-normal predictors when doing logistic regression?
Answer: Why odds ratios look strange on transformed variables
Transformations change the metric of the variable. Odds ratios are the predicted difference in odds for a one unit increase on the IV holding all other IVs constant. The meaning of one unit will be very different after a square root transformation.
For example, if you had a 1 to 100 raw scale, then after transformation, the difference between 16 and 25 on the raw scale would be the same as the difference between 4 and 5 on the square root transformed scale. Thus, it's not surprising that your odds ratios became a lot larger after square root transformation.
If you want to examine the effect of the transformation in a scaling-neutral way, you could standardise your IVs (i.e., make them z-scores). Thus, you could compare the odds ratio of a z-score of the raw variable to a z-score of the transformed variable. This will allow you to isolate the effect of changing the relative distance between categories.
Whether to transform non-normal predictors in logistic regression
Normality of predictors is not an assumption of logistic regression, or linear regression for that matter. See @whuber's answer here for more details.
That said, you may find one scaling of your IVs more predictive or interpretable. I'd use criteria like that to decide whether you want to transform a predictor variable.
Comment: Observations with outliers in an IV tend to highly influence the parameter estimates of the model. In such a case, transformations might be an option.


Turn off responsive behavior for Bootstrap 3

Question: I know how to turn off responsive in bootrap . but how it can be in drupal theme. As i am using Drupal Bootstrap and created a subtheme. can that subtheme be non-responsive ??
Answer: You can reset Media queries breakpoints, it will not work.
Here is path: bootstrap/bootstrap_subtheme/less/variable.less
at line number 209.
Check it.
Comment: you will have to disable & enable theme.


How to show tooltips using a bootstrap sub-theme in a views filter?

Question: I am using the bootstrap Tweme theme and would like to show tooltips when hovering over exposed filters (e.g. haslanguagecertificate) in a view. When hovering over profile edit fields the help text is shown properly.
I have also added the snippet in html.tpl.php before the closing < / body>.
<code>(function($) {
   $(document).ready(function() {
   $('[data-toggle=tooltip]').tooltip();
   });
})(jQuery);
</code>
This has How to show tooltips on form labels based on view filter descriptions in a Bootstrap sub-theme? that helped, but the tooltips are not showing up. Devel does not show ['title']['#attributes'] - what do i have to write here?
<code>/**
 * Implements hook_form_FORM_ID_alter().
*/

function customisations_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
dpm($form);
// $field_name = 'filter-title';
$field_name = 'filter-field_haslanguagecertificate_value';
$form['title']['#attributes'] = array(
  'data-toggle' => 'tooltip',
  'data-original-title' => $form['#info'][$field_name]['description']
  );
 $form['#info'][$field_name]['description'] = '';
}
</code>
Answer: form['title'] needed to be replaced with the fieldname without "filter-".
<code>function customisations_form_views_exposed_form_alter(&$form) {
  //drupal_set_message("setting exposed filter tooltips", 'status');
  //dpm($form);
  $allFilter = array();
  $filtersList = array_keys($form['#info']);

for ($i =0; $i<count($filtersList); $i++) {
    //drupal_set_message("filter " . $filtersList[$i], 'status');
    array_push($allFilter,$filtersList[$i]);
  }

  foreach ($allFilter as $field_name) {
    $fieldTitle = substr($field_name,7); //removes the filter-
    $form[$fieldTitle]['#attributes'] = array(
    'data-toggle' => 'tooltip',
    'data-original-title' => $form['#info'][$field_name]['description']
  );
  $form['#info'][$field_name]['description'] = '';
}
}
</code>


Different modes of pentatonic scale

Question: Just as there are seven modes of the diatonic scale, I would expect five modes of the pentatonic scale.
Have these been classified?
Here they are, in the form of {semitone interval gaps} (Notes for root:C)

    { 2 2 3  2 3  }  ( C D E  G A  )
    { 3  2 2 3  2 }  ( C ♭E F G ♭B )
    { 2 3  2 2 3  }  ( C D  F G A  )
    { 3  2 3  2 2 }  ( C ♭E F ♭A♭B )
    { 2 3  2 3  2 }  ( C D  F G ♭B )

Note how I've used spacing to illustrate that it is the same pattern cycling.
In the key of C, I would expect {C ♭E F ♭A ♭B} to be labelled a 'minor' pentatonic, as ♭E and ♭A are both in the scale of C minor.
However, {C D E G A} and {C D F G A} would both be contenders for a 'major' pentatonic scale.
Comment: Diatonic is commonly used to mean incorporating the 12-tone system of so-called 'Western theory', whereas pentatonic refers to the use of any number of 5-tone systems.  I think technically when using a pentatonic scale, as long as you stay within that scale you can still be said to be playing 'diatonically'.  But, the use of pentatonics sort of restricts what modern theoretical equivalences can be used.  AFAIK although a couple of pentatonics are more common, and some do get called 'minor' as a specific entity in modern theory, even something like C C# D D# E is a pentatonic scale.
Answer: Theoretically, yes there are five modes that can be derived from the major pentatonic scale and they would be named the same way the other modes contained in the major scale.
Let's  look at the relative modes instead of parallel as it is slightly easier to see the patter.  The C major pentatonic scale consists of the following notes:

C, D, E, G, A

Like any scale, we can start on any note and have a different mode. The name would be consistent with how modes are typically named and shown as follows:

D Dorian pentatonic - D, E, G, A, C
E Phrygian pentatonic - E, G, A, C, D
G Mixolydian pentatonic - G, A, C, D, E
A minor  pentatonic  - A, C, D, E , G

Something important must be noted  though as of the scales above, only the major and minor contain  the notes  of the tonic chord. Thus the other 3 modes of the pentatonic scale really aren't too useful. Especially when you consider the petantionic scales are more for watered-down improvisations and melodies thus trying to build modes of them practically doesn't make much sense.
Comment: Dom, the other 3 modes of the pentatonic is not about tonic chord. Its about harmony in music, the bass player know this well.
Comment: @Bent Yes, but strictly speak when looking at the structures, it would be hard to say we're in any of the modes without more of the notes that define them. The pentatonic scale is more of a jumping off point than fully harmony and because of that certain flavors don't come of with just these sets of notes.  For example, could you really say you were in E Phhrygian without playing an F which gives that mode it's flavor or D dorian without F either?
Comment: This website refers to Dorian pentatonic as something else: https://www.jazz-guitar-licks.com/pages/guitar-scales-modes/pentatonic-scales/
Answer: Dom's answer correctly explains what the modes of the pentatonic scale are and how they are (not) used. Since this might give the impression that the pentatonic scale is almost exclusively useful if used as either major or minor pentatonic scale, I would like to add one important application of the pentatonic scale where it is used over a chord whose tonic is not even part of the scale. This use of the pentatonic scale is pretty common in jazz. Since very often the root of the associated chord is not part of the scale, it usually does not make sense to talk about these scales as modes.
Here a few examples:

G major pentatonic over Cmaj7: creates a Cmaj13 sound
D major pentatonic over Cmaj7: creates a Cmaj13(#11) (lydian) sound
E minor pentatonic over Am7: creates an Am11 sound
B minor pentatonic over Am7: creates an Am13 (dorian) sound
Bb minor pentatonic over G7: creates a G7alt (altered, superlocrian) sound

What is happening in all of these examples is that some of the basic (triad) chord tones in the standard pentatonic scale are replaced by higher chord tensions, which add more color than the root or the fifth of the chord. Note that the only example above where the scale contains the root of the associated chord is 'E minor pentatonic over Am7'. This corresponds to what could be called 'dorian pentatonic' (see Dom's answer). For all other examples the root of the chord is not part of the scale, so talking about modes doesn't make much sense here. Yet, they are basic major or minor pentatonic scales, just used in an unconventional way.
Of course all of them are subsets of a complete 7-note chord scale (in above order):

C major (ionian) without root and fourth
C lydian without root and fifth
A dorian without third and sixth
A dorian without third and seventh
G altered without root and third
Answer: While some pentatonic scales may not be common in western music, pentatonic scales are used in many cultures around the world so each mode mode of the pentatonic scale does have a name; for example, the yo scale, from Japan, is equivalent to the 5th mode you mentioned (CD FG Bb) when ascending and equivalent to the 3rd mode you mentioned (CD FGA) when descending.
Yo Scale:
Ascending:
C D  F G  Bb C
Descending and Basic:
C  A G F  D C

https://en.wikipedia.org/wiki/Yo_scale
Due to it's communally written nature Wikipedia is a good place to start looking for these modes, and it has names for each of the modes you mentioned, as well as information on a number of pentatonic pentatonic traditions from around the world.
{ 2 2 3  2 3  }  ( C D E  G A  ) Major Pentatonic
{ 3  2 2 3  2 }  ( C ♭E F G ♭B ) Minor Pentatonic
{ 2 3  2 2 3  }  ( C D  F G A  ) Blues Major, Ritsusen, Yo (Also standard tuning (Zheng Diao) of a Guqin)
{ 3  2 3  2 2 }  ( C ♭E F ♭A♭B ) Blues Minor, Man Gong
{ 2 3  2 3  2 }  ( C D  F G ♭B ) Egyptian, Suspended

https://en.wikipedia.org/wiki/Pentatonic_scale#Five_black-key_pentatonic_scales_of_the_piano
Answer: Major & minor pentatonic are widely accepted, but the other "modes" listed only share the root of the modes on which they are built, but are missing the color tones that characterize that particular mode.

D Dorian pentatonic D, E, G, A, C

1, 2, 4, 5, b7 (ex. b3 & 6)

E Phrygian pentatonic - E, G, A, C, D

1, b3, 4, b6, b7 (ex. b2)

G Mixolydian pentatonic - G, A, C, D, E

1, 2, 4, 5, 6 (ex. 3 & b7)

"Dorian pentatonic" is missing the minor 3rd as well the Major 6th, which define the triad and differentiate Dorian from Aeolian/natural minor. I have seen this pattern called Egyptian, but that doesn't relay any info on it's use. A better designation would be Suspended, or rather 9sus4.
"Phrygian pentatonic" contains the minor chord & color tones, but again this mode is missing it's a key color tone in b2; this defines Phrygian. I have seen this pattern called Blues Minor and other exotic appellations such as Man Gong, which are misleading and ineffective respectively. In keeping with a chord name that conveys useful musical info, perhaps min11#5. It's not a chord you're likely to see on a lead sheet, but function aside we can extrapolate what notes are contained within the scale.
"Mixolydian pentatonic" is perhaps the least aptly named as there is nothing to define the triad or the quality of the seventh. It could be any major mode or Dorian even. In keeping with the chord name reference without regard to function, I think of this as a 6/9sus4.
In summary, I submit that we should use the following naming conventions for the pentatonic modes:

A minor pentatonic
C Major pentatonic
D 9sus4 pentatonic
E min11#5 pentatonic
G 6/9sus4 pentatonic
Comment: I think you missed the last paragraph of my answer that says they aren't necessarily useful in that context. There is ambiguity of the pentatonic scale which is why it is versatile, trying to lock them into a chord name doesn't necessarily match with that very well.
Comment: @Dom, I did see your comment, but I thought I made it clear that these were not chords in the functional sense but rather a way to 'classify' the modes in the spirit of the OP. By that I mean you were to tell me to play Dorian pentatonic, the scale in mind would be the minor pentatonic plus the M6 (even in favor of the b7); similarly with the Phrygian add the b2, and with Mixo add the the M3 instead for the 'Dominant pentatonic'. I didn't intend to challenge you, just the notion of these modal designations for the pentatonic box patterns. "...watered-down improvisations" for shame!
Answer: Different modes of the pentatonic scale
A Minor Pentatonic (aeolian)
C Major Pentatonic (ionian)
D Sus2 Pentatonic (dorian)
E Minor Pentatonic  (phrygian)
G Sus2 Pentatonic (mixolydian)
In relation to the diatonic scale, the modes of the minor pentatonic scale in order would be -
Aeolian Pentatonic (missing 2 and 6)
Ionian Pentatonic  (missing 4 and 7)
Dorian Pentatonic  (missing 3 and 6)
Phrygian Pentatonic  (missing 2 and 5)
Mixolydian Pentatonic (missing 3 and 7)
The modes of the major pentatonic scale in order would be -
Ionian Pentatonic  (missing 4 and 7)
Dorian Pentatonic  (missing 3 and 6)
Phrygian Pentatonic  (missing 2 and 5)
Mixolydian Pentatonic (missing 3 and 7)
Aeolian Pentatonic (missing 2 and 6)
Hope this helps, I'm a bass player and usually refer to them as positions ie,
A Minor Pentatonic (aeolian) position 1
C Major Pentatonic (ionian) position 3
D Minor Pentatonic (dorian) position 4
E Minor Pentatonic  (phrygian) position 5
G Major Pentatonic (mixolydian) position 2
The pentatoinc scale is missing the root notes from the lydian and locrian modes

Different modes of pentatonic scale


Unable to get master.sys.sp_MSforeachdb to insert into table

Question: I am using the master.sys.sp_MSforeachdb sp to pull data from multiple databases. The select query works fine, however when I attempt to insert it into a table, it kicks back an error. How would I get it to insert each result into a table I created?
Msg 245, Level 16, State 1, Line 4
Conversion failed when converting the nvarchar value 'master' to data type int.
EXECUTE master.sys.sp_MSforeachdb 'USE [?];

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
Insert INTO Connstrings.dbo.Results(host_name,user_name,program_name,request_duration_ms,[database])
select s.host_name, s.original_login_name AS user_name, s.program_name,
(DATEDIFF (ms,last_request_end_time, last_request_start_time )) AS request_duration_ms, DB_NAME() AS [database]
FROM sys.dm_exec_requests r
join sys.dm_exec_sessions s
on r.session_id = s.session_id'

Answer: The [database] column in Connstrings.dbo.Results table is of type INT. Either change the table definition:
alter table Results alter column [database] sysname

Or change the query:
EXECUTE master.sys.sp_MSforeachdb 'USE [?];

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
Insert INTO Connstrings.dbo.Results(host_name,user_name,program_name,request_duration_ms,[database])
select s.host_name, s.original_login_name AS user_name, s.program_name,
(DATEDIFF (ms,last_request_end_time, last_request_start_time )) AS request_duration_ms, DB_ID() AS [database]
FROM sys.dm_exec_requests r
join sys.dm_exec_sessions s
on r.session_id = s.session_id'


Low Maintenance Wordpress Hosting

Question: This is a follow up to a long series of questions seen here before.  That is the most recent one I could find, and it is about a year old.
I am trying to help out a friend, to just get him started up with a WP blog for easy creation of static web content for a non-profit they want to start.  I have been brought in to help them set it up, not a long-term thing. They wanted me to host on GoDaddy, and I clearly had problems with that.  I also explained WP needs to be updated regularly lest they be an example of what not to do.  I am considering a hosted WP.com instance with their own domain name, but it missing just the right stuff.  Does anyone recommend some good full-service hosting other than Dreamhost and the list on wordpress.org?  I am just curious, and I would greatly appreciate advice from the vets here.
Answer: I know you specify "other than Dreamhost", but...I just recently set up a wordpress site for a non-profit using Dreamhost.  If it is a true, registered-with-IRS-non-profit, Dreamhost offers free hosting to 501(c)(3) non-profit organizations.  So that may be an additional factor to consider.
Comment: This is very interesting to know.  I will keep that in mind.
Comment: It appears that Wordpress migh actually [offer what I asked for](http://blog.dreamhost.com/2009/09/06/update-your-wordpress/).  After seeing your mention of this, I thought it was worth considering. @David Mackintosh might have something to say about their promises re upgrading consistently.  Thanks for your input.
Answer: There's a difference between "just set up" and "full-service".  With Wordpress, the difference is critical.
If someone "just sets up" Wordpress for your friend, the inevitable security and version updates become his problem.  Because WordPress is so popular, vulnerabilities are specifically targeted by spammers and link-spam generators.  You have to stay up to date.
This becomes even more time consuming if you use third-party themes and plugins to extend Wordpress functionality.  The problem will be that eventually your theme and/or plugins will no longer be compatible with some mandatory security upgrade.
I say this from personal experience.
The worst-of-all-possible combinations is the dreaded "Click-and-Install" packages offered by many hosting companies.  This rolls an automatic install of Wordpress for you, but keeping it up-to-date is your problem.
The simplest, most-secure way to deal with this problem is to use Wordpress.com as a host with their domain name.  They restrict your usage as much as possible to ensure that when security updates happen (and they happen automatically for you) they don't impede what you are trying to do.
There is a trade-off between functionality and maintenance-free.
Comment: I am well aware of these issues.  I was hoping someone would enlighten me on a service that does Wordpress hosting and I guess update management.  I have been researching parallel to this q on SF.  I have yet to find something, so I guess the answer is no.

Low Maintenance Wordpress Hosting


different styles for labels inside CSS tab setup

Question: Hopefully tis is a reallllly easy fix that I'm just not seeing, but I've been trying every solution I could find that arched even close to this in previously submitted questions and I'm just getting nowhere.
The short of it: I've got a CSS tab setup working that's great, EXCEPT for when it comes to styling the actual labels on the tabs.  It works great with a single style, but as soon as I try to introduce a secondary font style (bringing the font size down to 11px), the right hand side of the tab disappears.
And unfortunately I NEED to be able to have those two different font sizes/styles displayed in the tab label.  I've tried using span, div, etc. treatments but everything makes the right border of the tab go away.  Any help is HUGELY appreciated!
Here's a fiddle: http://jsfiddle.net/wKtPL/
Here's my sample HTML:

       <input type="radio" id="tab-1" name="tab-group-1" checked>
       Library
 123

          content goes here

       <input type="radio" id="tab-2" name="tab-group-1">
       Institution's Subscriptions

          content goes here

       <input type="radio" id="tab-3" name="tab-group-1">
       Copyright Agent

          content goes here

       <input type="radio" id="tab-4" name="tab-group-1">
       Internet Archive

          content goes here

       <input type="radio" id="tab-5" name="tab-group-1">
       HathiTrust

         content goes here

And the CSS behind it:
.tabs {
  position: relative;
  min-height: 550px;
  clear: both;
  margin: 25px 0;
}
.tab {
  float: left;
}
.tab label {
  background: #dadcde;
  color: #3f4b54;
  padding: 10px;
  border: 1px solid #ccc;
  margin-left: -1px;
  position: relative;
  left: 1px;
  -moz-border-radius-topright:3px;
  -webkit-border-top-right-radius:3px;
  border-top-right-radius:3px;
  -moz-border-radius-topleft:3px;
  -webkit-border-top-left-radius:3px;
  border-top-left-radius:3px;
  font-size: 14px;
  font-weight:bold;
  margin-right:5px;
}
.tab-count {
font-size: 11px;
}
.tab [type=radio] {
  display: none;
}
.content {
  position: absolute;
  top: 28px;
  left: 0;
  background: white;
  right: 0;
  bottom: 0;
  padding: 20px;
  border: 1px solid #ccc;

  overflow: hidden;
}
.content > * {
  opacity: 0;

  -webkit-transform: translate3d(0, 0, 0);

  -webkit-transform: translateX(-100%);
  -moz-transform:    translateX(-100%);
  -ms-transform:     translateX(-100%);
  -o-transform:      translateX(-100%);

  -webkit-transition: all 0.6s ease;
  -moz-transition:    all 0.6s ease;
  -ms-transition:     all 0.6s ease;
  -o-transition:      all 0.6s ease;
}
[type=radio]:checked ~ label {
  background: white;
  border-bottom: 3px solid white;
  z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
  z-index: 1;
}
[type=radio]:checked ~ label ~ .content > * {
  opacity: 1;

  -webkit-transform: translateX(0);
  -moz-transform:    translateX(0);
  -ms-transform:     translateX(0);
  -o-transform:      translateX(0);
}

Comment: So the right hand side of the Library tab disappears?
Answer: By secondary font style  do you mean the div nested in the label?  If that's the one with class .tab-count you could set float:right.  That will keep it in the same line.
.tab-count {
   font-size: 11px;
   float:right;
}

Answer: This is caused by the usage of a block element inside your label element, which is an inline element. To fix this, change your
 123
 to  123. Here is a demo of it.
If you want to allow block-level elements to be placed within inline elements, you could like @setek said, use the alternative inline-block which is a kind of hybrid of block elements and inline elements.
You should never use block elements inside inline elements, since that will cause problems like this one. What was happening was that the styles for the inline  tag were being dragged across 2 lines, since the
 was taking up an extra line. That dragged the left border down a line too, which is why you didn't see it anymore (it was below the other tabs).
Answer: A couple of things, firstly the 123 is being hidden under the .content so you need a taller top value.
Secondly, your labels, while being position: relative; are still only being implicitly rendered as display: inline;, so it's hiding the 123 div underneath the label itself.
http://jsfiddle.net/wKtPL/1/
.tab label {
  [ ... ]
    display: inline-block;
    min-height: 2.5em;
}

.content {
  [ ... ]
  top: 60px;
}

... and muck with styling as you need.
Comment: Actually -- sigh -- I'm getting pushback from the programming guys.  They absolutely 100% have to use DIVs instead of spans for the count feature; still fixable or am I boned?
Comment: Umm I never changed your HTML, so: yes, you can continue using `div`s :)
Comment: thank you! (sorry, way tired and nursing a flu, I've really got to up my comprehension game)
Comment: That's alright :) if this answer fixes your problem, could you mark it as answered please? So it isn't part of the unanswered queue.


Parse images from RSS when img is placed in content:encoded

Question: I'm trying to parse images from RSS doing this
Elements imgEle = docHtml.select("img");

_item.setImage(imgEle.attr("src"));

it is working here
working (img is in description):
<description><p><a href="http://www.androidpolice.com/wp-content/uploads/2015/11/nexus2cee_linkedin-material.png" class=" no-style"><img class="alignnone size-hero-size wp-image-345522" src="http://www.androidpolice.com/wp-content/uploads/2015/11/nexus2cee_linkedin-material-728x485.png"

But not here (img is in content:encoded):
<img class=" size-large wp-image-2207218 aligncenter" src="http://st.ilfattoquotidiano.it/wp-content/uploads/2015/11/14618338_small-630x404.jpg"

======================================================================
EDIT: Just found a solution. I'll leave it here for who is interested (very happy :) )
https://github.com/enricocid/iven-feed-reader/commit/e2f8a487d0fd9dff3ca96024ddf9715e2887a916
Comment: Can you better explain what is the problem in the second case? I see that in the first example there are html entities like `<` and `>`. Are them ok or is it writing mistake?
Comment: this is the source code of the feeds, the first is android police and the 2nd is "il fatto quotidiano" ... from the first i can get the images, using the code i posted above, from the 2nd not and I don't why... Yesterday I've tried to see the output of getdescription ... the one for android police contains the articles images , the 2nd one not... it seems like in the 2nd one the images are in content:encoded and not in description and I don't know how to parse images from content:encoded  :/
Comment: When you say that it doesn't work, what is the error you get? Is `imgEle` null?
Comment: exactly, imgEle returns null :)
Comment: It would be good if you can add both the sources of the rss.
Comment: this is the source code of the app:   https://github.com/enricocid/iven-feed-reader android police feed: http://pastebin.com/Dxm6pVF8   and il fatto quotidiano: http://pastebin.com/ju6Pa37d
Answer: You can store images/images url from RSS into a List then load image from web using Picasso .
Like this :
Picasso.with(context).load(data.getImage()).into(imageView);

Comment: I know, and I'm already doing this using glide, so this is not the problem

the problem is that the above code I posted does not work with some RSS ... read the op post better


Trouble with the upgrade of core 8.9 to 9.2

Question: We are in the process of migrating to Drupal 9, and I am having nothing but problems with composer and trying to get Drupal core updated.
I have provided my composer.json file, and a HUGE list of errors it's spitting out at me, and I have absolutely no idea how to fix it.
The command I have been running is composer update

Gathering patches for root package.
No patches supplied.
Loading composer repositories with package information
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drupal/core 8.0.0-beta6 requires doctrine/common dev-master#a45d110f71c323e29f41eb0696fa230e3fa1b1b5 -> no matching package found.
    - remove drupal/admin_menu 3.x-dev|keep drupal/admin_menu dev-3.x
    - Conclusion: remove drupal/admin_menu dev-3.x
    - drupal/core-recommended 9.2.6 requires drupal/core 9.2.6 -> satisfiable by drupal/core[9.2.6].
    - Conclusion: don't install drupal/core 9.2.6
    - drupal/core-recommended 9.2.5 requires drupal/core 9.2.5 -> satisfiable by drupal/core[9.2.5].
    - Conclusion: don't install drupal/core 9.2.5
    - drupal/core-recommended 9.2.4 requires drupal/core 9.2.4 -> satisfiable by drupal/core[9.2.4].
    - Conclusion: don't install drupal/core 9.2.4
    - drupal/core-recommended 9.2.3 requires drupal/core 9.2.3 -> satisfiable by drupal/core[9.2.3].
    - Conclusion: don't install drupal/core 9.2.3
    - drupal/core-recommended 9.2.2 requires drupal/core 9.2.2 -> satisfiable by drupal/core[9.2.2].
    - Conclusion: don't install drupal/core 9.2.2
    - drupal/core-recommended 9.2.1 requires drupal/core 9.2.1 -> satisfiable by drupal/core[9.2.1].
    - Conclusion: don't install drupal/core 9.2.1
    - drupal/core-recommended 9.2.0 requires drupal/core 9.2.0 -> satisfiable by drupal/core[9.2.0].
    - Conclusion: don't install drupal/core 9.2.0
    - drupal/core-recommended 9.2.0-rc1 requires drupal/core 9.2.0-rc1 -> satisfiable by drupal/core[9.2.0-rc1].
    - Conclusion: don't install drupal/core 9.2.0-rc1
    - drupal/core-recommended 9.2.0-beta3 requires drupal/core 9.2.0-beta3 -> satisfiable by drupal/core[9.2.0-beta3].
    - Conclusion: don't install drupal/core 9.2.0-beta3
    - drupal/core-recommended 9.2.0-beta2 requires drupal/core 9.2.0-beta2 -> satisfiable by drupal/core[9.2.0-beta2].
    - Conclusion: don't install drupal/core 9.2.0-beta2
    - drupal/core-recommended 9.2.0-beta1 requires drupal/core 9.2.0-beta1 -> satisfiable by drupal/core[9.2.0-beta1].
    - Conclusion: don't install drupal/core 9.2.0-beta1
    - drupal/core-recommended 9.2.0-alpha1 requires drupal/core 9.2.0-alpha1 -> satisfiable by drupal/core[9.2.0-alpha1].
    - Conclusion: don't install drupal/core 9.2.0-alpha1
    - Installation request for drupal/admin_menu 3.x-dev -> satisfiable by drupal/admin_menu[3.x-dev].
    - drupal/core-recommended 9.3.x-dev requires drupal/core 9.3.x-dev -> satisfiable by drupal/core[9.3.x-dev].
    - Conclusion: don't install drupal/core 9.3.x-dev
    - drupal/admin_menu 3.x-dev requires drupal/core ~8.0 -> satisfiable by drupal/core[8.9.17, 8.0.0, 8.0.0-beta10, 8.0.0-beta11, 8.0.0-beta12, 8.0.0-beta13, 8.0.0-beta14, 8.0.0-beta15, 8.0.0-beta16, 8.0.0-beta6, 8.0.0-beta7, 8.0.0-beta8, 8.0.0-beta9, 8.0.0-rc1, 8.0.0-rc2, 8.0.0-rc3, 8.0.0-rc4, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.0.x-dev, 8.1.0, 8.1.0-beta1, 8.1.0-beta2, 8.1.0-rc1, 8.1.1, 8.1.10, 8.1.2, 8.1.3, 8.1.4, 8.1.5, 8.1.6, 8.1.7, 8.1.8, 8.1.9, 8.1.x-dev, 8.2.0, 8.2.0-beta1, 8.2.0-beta2, 8.2.0-beta3, 8.2.0-rc1, 8.2.0-rc2, 8.2.1, 8.2.2, 8.2.3, 8.2.4, 8.2.5, 8.2.6, 8.2.7, 8.2.8, 8.2.x-dev, 8.3.0, 8.3.0-alpha1, 8.3.0-beta1, 8.3.0-rc1, 8.3.0-rc2, 8.3.1, 8.3.2, 8.3.3, 8.3.4, 8.3.5, 8.3.6, 8.3.7, 8.3.8, 8.3.9, 8.3.x-dev, 8.4.0, 8.4.0-alpha1, 8.4.0-beta1, 8.4.0-rc1, 8.4.0-rc2, 8.4.1, 8.4.2, 8.4.3, 8.4.4, 8.4.5, 8.4.6, 8.4.7, 8.4.8, 8.4.x-dev, 8.5.0, 8.5.0-alpha1, 8.5.0-beta1, 8.5.0-rc1, 8.5.1, 8.5.10, 8.5.11, 8.5.12, 8.5.13, 8.5.14, 8.5.15, 8.5.2, 8.5.3, 8.5.4, 8.5.5, 8.5.6, 8.5.7, 8.5.8, 8.5.9, 8.5.x-dev, 8.6.0, 8.6.0-alpha1, 8.6.0-beta1, 8.6.0-beta2, 8.6.0-rc1, 8.6.1, 8.6.10, 8.6.11, 8.6.12, 8.6.13, 8.6.14, 8.6.15, 8.6.16, 8.6.17, 8.6.18, 8.6.2, 8.6.3, 8.6.4, 8.6.5, 8.6.6, 8.6.7, 8.6.8, 8.6.9, 8.7.0, 8.7.0-alpha1, 8.7.0-alpha2, 8.7.0-beta1, 8.7.0-beta2, 8.7.0-rc1, 8.7.1, 8.7.10, 8.7.11, 8.7.12, 8.7.13, 8.7.14, 8.7.2, 8.7.3, 8.7.4, 8.7.5, 8.7.6, 8.7.7, 8.7.8, 8.7.9, 8.7.x-dev, 8.8.0, 8.8.0-alpha1, 8.8.0-beta1, 8.8.0-rc1, 8.8.1, 8.8.10, 8.8.11, 8.8.12, 8.8.2, 8.8.3, 8.8.4, 8.8.5, 8.8.6, 8.8.7, 8.8.8, 8.8.9, 8.8.x-dev, 8.9.0, 8.9.0-beta1, 8.9.0-beta2, 8.9.0-beta3, 8.9.0-rc1, 8.9.1, 8.9.10, 8.9.11, 8.9.12, 8.9.13, 8.9.14, 8.9.15, 8.9.16, 8.9.18, 8.9.19, 8.9.2, 8.9.3, 8.9.4, 8.9.5, 8.9.6, 8.9.7, 8.9.8, 8.9.9, 8.9.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.0-beta2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.0-beta3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.10].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.11].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.12].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.13].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.14].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.15].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.16].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.17].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.18].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.19].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta10].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta11].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta12].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta13].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta14].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta15].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta16].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-beta9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-rc2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-rc3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.0-rc4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.0.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.0-beta2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.10].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.1.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.0-beta2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.0-beta3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.0-rc2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.2.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.0-alpha1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.0-rc2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.3.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.0-alpha1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.0-rc2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.4.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.0-alpha1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.10].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.11].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.12].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.13].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.14].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.15].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.5.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.0-alpha1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.0-beta2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.10].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.11].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.12].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.13].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.14].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.15].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.16].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.17].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.18].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.6.9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.0-alpha1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.0-alpha2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.0-beta2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.10].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.11].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.12].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.13].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.14].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.7.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.0].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.0-alpha1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.0-beta1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.0-rc1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.1].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.10].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.11].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.12].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.2].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.3].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.4].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.5].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.6].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.7].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.8].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.9].
    - Can only install one of: drupal/core[9.2.x-dev, 8.8.x-dev].
    - Can only install one of: drupal/core[9.2.x-dev, 8.9.17].
    - drupal/core-recommended 9.2.x-dev requires drupal/core 9.2.x-dev -> satisfiable by drupal/core[9.2.x-dev].
    - Installation request for drupal/core-recommended ^9.2.0 -> satisfiable by drupal/core-recommended[9.2.0, 9.2.0-alpha1, 9.2.0-beta1, 9.2.0-beta2, 9.2.0-beta3, 9.2.0-rc1, 9.2.1, 9.2.2, 9.2.3, 9.2.4, 9.2.5, 9.2.6, 9.2.x-dev, 9.3.x-dev].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

and my composer.json
{
  "name": "acquia/drupal-minimal-project",
  "description": "Minimal Acquia-compatible Drupal application based on the Drupal Recommended Project",
  "license": "GPL-2.0-or-later",
  "authors": [
    {
      "name": "Acquia Engineering",
      "homepage": "https://www.acquia.com",
      "role": "Maintainer"
    }
  ],
  "repositories": {
    "drupal": {
      "type": "composer",
      "url": "https://packages.drupal.org/8"
    }
  },
  "require": {
    "composer/installers": "^1.9",
    "cweagans/composer-patches": "^1.6",
    "dompdf/dompdf": "^1.0",
    "drupal/acquia_connector": "^3.0",
    "drupal/admin_menu": "3.x-dev",
    "drupal/admin_toolbar": "^3.0",
    "drupal/autologout": "^1.3",
    "drupal/better_exposed_filters": "^5.0@beta",
    "drupal/block_exclude_pages": "^2.0",
    "drupal/bootstrap4": "^2.1",
    "drupal/config_devel": "^1.8",
    "drupal/config_distro": "^1.0@alpha",
    "drupal/config_distro_filter": "^1.0@alpha",
    "drupal/config_filter": "2.2.0",
    "drupal/config_ignore": "^2.3",
    "drupal/config_merge": "^1.0@RC",
    "drupal/config_normalizer": "^1.0@alpha",
    "drupal/config_provider": "^2.0@RC",
    "drupal/config_snapshot": "^1.0@RC",
    "drupal/config_split": "^2.0",
    "drupal/config_sync": "^2.0@beta",
    "drupal/config_update": "^1.7",
    "drupal/console": "^1.9",
    "drupal/content_sync": "^2.1",
    "drupal/core-composer-scaffold": "^9.2.0",
    "drupal/core-project-message": "^9.2.0",
    "drupal/core-recommended": "^9.2.0",
    "drupal/custom_add_another": "^1.0@beta",
    "drupal/devel": "^4.1",
    "drupal/externalauth": "^1.4",
    "drupal/fast_404": "^2.0@alpha",
    "drupal/field_group": "^3.1",
    "drupal/fontawesome": "^2.19",
    "drupal/httpswww": "^2.0",
    "drupal/jquery_ui_accordion": "^1.1",
    "drupal/memcache": "^2.3",
    "drupal/multiple_fields_remove_button": "^1.0@alpha",
    "drupal/paragraphs": "^1.12",
    "drupal/password_policy": "^3.0",
    "drupal/select_or_other": "^1.0@alpha",
    "drupal/shield": "^1.4",
    "drupal/simplesamlphp_auth": "^3.2",
    "drupal/siteimprove": "^1.11",
    "drupal/theme_switcher": "^1.2",
    "drupal/toolbar_anti_flicker": "^9.3",
    "drupal/toolbar_menu": "^2.2",
    "drupal/twig_tweak": "^2",
    "drupal/views_bulk_operations": "^4.0",
    "drupal/views_conditional": "^1.4",
    "drupal/views_data_export": "^1.0",
    "drush/drush": "^10.5",
    "picqer/php-barcode-generator": "^2.2",
    "scriptotek/google-books": "^0.2.5",
    "tecnickcom/tcpdf": "^6.4",
    "zaporylie/composer-drupal-optimizations": "^1.2"
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "config": {
    "sort-packages": true
  },
  "extra": {
    "drupal-scaffold": {
      "locations": {
        "web-root": "docroot/"
      },
      "file-mapping": {
        "[web-root]/sites/default/default.services.yml": {
          "mode": "replace",
          "path": "docroot/core/assets/scaffold/files/default.services.yml",
          "overwrite": false
        },
        "[web-root]/sites/default/default.settings.php": {
          "mode": "replace",
          "path": "docroot/core/assets/scaffold/files/default.settings.php",
          "overwrite": false
        }
      },
      "gitignore": true
    },
    "installer-paths": {
      "docroot/core": [
        "type:drupal-core"
      ],
      "docroot/libraries/{$name}": [
        "type:drupal-library"
      ],
      "docroot/modules/contrib/{$name}": [
        "type:drupal-module"
      ],
      "docroot/profiles/contrib/{$name}": [
        "type:drupal-profile"
      ],
      "docroot/themes/contrib/{$name}": [
        "type:drupal-theme"
      ],
      "drush/Commands/contrib/{$name}": [
        "type:drupal-drush"
      ],
      "docroot/modules/custom/{$name}": [
        "type:drupal-custom-module"
      ],
      "docroot/themes/custom/{$name}": [
        "type:drupal-custom-theme"
      ]
    },
    "enable-patching": true,
    "patchLevel": {
      "drupal/core": "-p2"
    },
    "patches": {}
  },
  "require-dev": {
    "drupal/core-dev": "^9.2.0"
  }
}

Is there anybody that can assist me with this?
Please and thank you.
Comment: I mostly got it. I ended up re-pulling down the acquia/minimal-project and rebuilt everything and included my custom and contrib modules in the composer. Everything seems to be good now.
Comment: The odd detail that jumps out at me is the line that says `drupal/core 8.0.0-beta6 requires doctrine/common dev-master#a45d110f71c323e29f41eb0696fa230e3fa1b1b5 -> no matching package found.` I'm not sure what package thinks it requires core version 8.0.0-beta6. You may want to look for that in your `composer.lock`. But first, see my answer below -- you may fix your Composer issues during the process of upgrading from Composer 1 to Composer 2.
Comment: Any luck with the upgrade?
Comment: Acquia is great, but I recommend sticking as closely as possible to the `drupal/recommended-project` to avoid Composer headaches. (To be fair, now that the Acquia Lightning installation profile is [nearing its end of life](https://support.acquia.com/hc/en-us/articles/1500006393601-Frequently-Asked-Questions-FAQ-regarding-End-of-Support-for-Acquia-Lightning), the worst may be behind us!)
Answer: You may have heard that upgrading from Drupal 8 to Drupal 9 is the easiest Drupal core upgrade yet (and that is true!) but there are still a few steps to upgrading.
Hopefully, you are using git or another form of version control, because you should start by rolling back your site to the last stable state, when you were running Drupal 8. Then you can address some prerequisites, and run some tests, before upgrading to Drupal 9.
You are still using Composer 1. You should start the upgrade by preparing your site for Composer 2. (There's a lot of info at the linked page. Usually, link-only answers are frowned upon, but it's beyond the scope of this answer to include all that info here. Besides, it's part of the official Drupal documentation on Drupal.org, so I think that's fair game for linking, unlike a blog post that might disappear.)
Once you have that straightened out, make certain that you have upgraded Drupal core and contributed modules to the very latest versions available, and then install the Upgrade Status module to test your site for Drupal 9 readiness. If it detects any problems, you'll need to fix them before upgrading.
Here's a link to the official Drupal docs on Upgrading a Drupal 8 site to Drupal 9:

Short summary

Ensure your hosting environment matches the platform requirements of Drupal 9.
Update to Drupal 8.8.x or 8.9.x (if not already on that version)
Update all contributed projects and ensure they are Drupal 9 compatible
Make custom code Drupal 9 compatible
Update core codebase to Drupal 9
Run update.php

If you're looking for step by step directions, you'll find more details in the upgrading section.

After you have followed all these steps, come back and update your question if you are still seeing a Composer-related error.
LATER:
OK, I'll take your word for it that you have followed all the prerequisites above.
My hunch is that you are having trouble upgrading because you are using the acquia/drupal-minimal-project, but I can't be sure.
Please create a new Drupal 8.9 project:
composer create-project drupal/recommended-project:^8.9 $SITE_NAME

Substitute your desired project name for $SITE_NAME.
Then use composer require to add all the packages from your composer.json (there are not too many, so it should not take too long.) If you have any custom modules and themes in your site, move them into the new 8.9 site at this time.
Since your site is hosted on Acquia, the one change you should make from the recommended-project is to change the docroot directory from web to docroot:
        "drupal-scaffold": {
            "locations": {
                "web-root": "docroot/"
            }
        },
        "installer-paths": {
            "docroot/core": [
                "type:drupal-core"
            ],
            "docroot/libraries/{$name}": [
                "type:drupal-library"
            ],
            "docroot/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "docroot/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "docroot/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "docroot/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "docroot/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },

Then import the database from your site into the new 8.9 site and make sure that it runs as expected. (If you are using something like Lando, DDEV, or Docksal, this should be pretty easy. Actually I recommend setting up Lando with the new Acquia recipe, which is pretty sweet.)
After that, you should be able to complete the Drupal 9 upgrade by following the instructions I linked to above:
https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-to-drupal-9-or-later#s-upgrading-a-composer-based-drupal-8-site
Note: this is not as simple as manually updating a composer.json file and running composer update. In particular:

Temporarily add write access to protected files and directories:
chmod 777 web/sites/default
chmod 666 web/sites/default/*settings.php
chmod 666 web/sites/default/*services.yml

Next, you'll need to pull in both the Drupal 9 version of core-recommended and dev-dependencies packages as dependencies. We use --no-update to avoid a chicken-and-egg problem with mutual dependencies:
composer require 'drupal/core-recommended:^9' 'drupal/core-composer-scaffold:^9' 'drupal/core-project-message:^9' --update-with-dependencies --no-update

If you have drupal/core-dev installed:
composer require 'drupal/core-dev:^9' --dev --update-with-dependencies --no-update

Now, actually perform the update to the code itself:
composer update

That's all the advice I have! Good luck!
Comment: Thanks for your response. I should have included in my original post that I have done all the pre-requisite stuff to upgrade to 9 and no issues were found. I also do not have a composer.lock as I removed it to see if it would update, to which it didn't. I did update to composer 2, however I'm still getting the same errors, albeit faster than using composer 1.


How to find $n^{th}$ derivative of $e^{2x}\cos^2x \sin x$?

Question: Given : $y=e^{2x} \times \cos^2x \times \sin x$ and I have to find it's $n^{th}$ derivative
I have managed to break $y$ down to:
$y= \frac{1}{4} \times (e^{2x}.\sin 3x + e^{2x}.\sin x)$
But I don't know how to apply Leibnitz Rule in cases like $(e^{ax} \times \sin bx)$.
 Please guide
Answer:
Hint: Use the representation
  \begin{align*}
\cos x=\frac{e^{ix}+e^{-ix}}{2}\qquad\qquad \sin x=\frac{e^{ix}-e^{-ix}}{2i}
\end{align*}
  expand
  \begin{align*}
y(x)=e^{2x}\cos^2(x)\sin(x)
\end{align*}
  and differentiate.

Alternative:

Recall the general Leibniz rule and consider
  \begin{align*}
\frac{d^n}{dx^n}\left(e^{ax}\sin(bx)\right)=\sum_{k=0}^n\binom{n}{k}\frac{d^k}{dx^k}\left(e^{ax}\right)\frac{d^{n-k}}{dx^{n-k}}\left(\sin(bx)\right)
\end{align*}
Answer: $$4y=2e^{2x}(1+\cos2x)\sin x=2e^{2x}\sin x+e^{2x}[\sin3x-\sin x]=e^{2x}\sin3x+e^{2x}\sin x$$
$e^{ax}\sin bx=$imaginary part of $$e^{x(a+ib)}$$
Now see $100$-th derivative of the function $f(x)=e^{x}\cos(x)$
Comment: I am sorry, but I am not very fluent with complex numbers. Kindly elaborate a bit?
Comment: @TheDeadLegend,  $a+ib$  essentially a constant being independent of $x$   $$\dfrac{d^n[e^{cx}]}{dx^n}=c^ne^{cx}$$
Answer: $y= \dfrac{1}{4}  (e^{2x}\sin 3x + e^{2x}\sin x)=\dfrac{1}{4}{\bf Im}\left(e^{(2+3i)x} + e^{(2+i)x}\right)$
so
$$y^{(n)}= \dfrac{1}{4}{\bf Im}\left((2+3i)^ne^{(2+3i)x} + (2+i)^ne^{(2+i)x}\right)$$


Solving $|a| < |b|$

Question: I apologize if this question in general, but I've been having trouble finding solutions as Google discards absolute value signs and inequality symbols.
I am looking for a way to eliminate absolute value functions in $|a| < |b|$.
I can solve $|a| < b$ and $|a| > b$, but I am unsure what method / combination of methods to use to eliminate absolute value signs from both sides.
Thank you!
An example problem:
$$|x + 2| < |x - 4|$$
Comment: It's useful to review the definition of the absolute value function: $$ \text{abs}(a) = \begin{cases} a & 0 \leq a \\ -a & a < 0 \end{cases}$$ In order to eliminate *one* absolute value function from an expression, you will need to consider two cases: the case where its argument is non-negative, and the case where its argument is negative. This will give you an expression with two cases with one less absolute value function. Iterating this process will give an expression without the absolute value sign.
Comment: perhaps you could give some specific problems that trouble you.
Comment: Good suggestion. I've added one above.
Comment: Since you mentioned trying Google, maybe you should try [Wolfram Alpha](http://www.wolframalpha.com/input/?i=|x%2B2|<|x−4|) instead
Answer: We have $|a| \lt |b|\,$ if any of these is true:
(i) $\,a$ and $b$ are $\gt 0$ and $a \lt b$
(ii) $a\lt 0$ and $b\ge 0$ and $-a \lt b$
(iii) $b \lt 0$ and $a \gt 0$ and $a \lt -b\,$
(iv) $\,a\lt 0$ and $b\lt 0$ and $-a\lt -b$. We can rewrite this as $b \lt a$.
Four cases! Not surprising, since eliminating a single absolute value sign often involves breaking up the problem into $2$ cases.
Sometimes, one can exploit the simpler $|a| \lt| b|\,$ iff $\,a^2\lt b^2$. But squaring expressions generally makes them substantially messier.
Added: With your new sample problem, squaring happens to work nicely. We have $|x+2| \lt |x-4|$ iff $(x+2)^2 \lt (x-4)^2$. Expand. We are looking at the inequality
$$x^2+4x+4 \lt x^2-8x+16.$$
The $x^2$ cancel, and after minor algebra we get the equivalent inequality $12x \lt 12$, or equivalently $x\lt 1$.  The squaring strategy works well for any inequality of the form $|ax+b| \lt |cx+d|$.
But the best approach for this particular problem is geometric. Draw a number line, with $-2$ and $4$ on it. Our inequality says that we are closer to $-2$ than we are to $4$. The number $1$ is halfway between $-2$ and $4$, so we must be to the left of $1$.
Comment: Ha! I never would of thought of this. This is brilliant! Thank you so much for your help!
Answer: There are different approaches; one is to look at the zeroes of the expressions inside the absolute values, and split up $\mathbb R$ into intervals accordingly. In your example $|x + 2| < |x - 4|$, the points of interest are at $x=-2$ and $x=4$. You can therefore consider three cases:
1. If $x \in (-\infty,-2)$, then $x+2 < 0$ and $x-4 < 0$, so the absolute values will reverse the signs of both. This gives:
$$\begin{align} -(x+2) &< -(x-4) \\
x+2 &> x-4 \\
2 &> -4
\end{align}$$
This is true for all $x$ in the interval.
2. If $x \in [-2,4)$, then $x+2 \geq 0$ so its sign is unaffected by the absolute value, but $x-4 <0$ so its sign will be reversed:
$$\begin{align} x+2 &< -(x-4) \\
2x+2 &< 4 \\
x &< 1
\end{align}$$
Combining this last inequality with the assumption that $x \in [-2,4)$, we see that any $x$ in $[-2,1)$ is valid.
3. Finally, if $x \in [4,\infty)$, neither expression's sign is reversed:
$$\begin{align} x+2 &< x-4 \\
2 &< -4
\end{align}$$
This is false for all $x$ in the interval.
Putting all the information together from the above three cases, we have $x \in (-\infty, 1)$.

Note: as some other contributors have mentioned, there are simpler ways to deal with your problem, such as viewing it geometrically. The method that I have shown above is more useful when the expressions are more complicated or when you have several absolute values; for example, an inequality like $3 |x^2-1|+|x-2|+|x^2-3x| > 5$.
Comment: Pedantry: you probably want $x\in[-2,4)$ for step 2 and $x\in[4,\infty)$ for step 3 (or change where you say $x-4<0$, but I think my way is more natural/consistent)
Comment: @BenMillwood: Fair enough! I've changed it.
Answer: We can see $|x-a|$ as a distance point $x$ from point $a$.
Now, the question with the above "definition" would be like:
For which $x$ values distance point $x$ from $-2$ be less than distance point $x$ from $4$?
Clearly, by drawing it maybe, you can observe that the answer is for all $x<1$.
Answer: We can divide by $|b|$ to get $|a/b|<1$. Let $x=a/b$ then $|x|<1$ so $-1<x<1$.
Now multiply through by $b$.
If $b>0$  then $-b<a<b$.
If $b<0$ then $-b>a>b$
Answer: $|a| < |b| \iff -|b| < a < |b| \iff
\begin{cases}
   -b < a < b & \text{If $b > 0$} \\
   \text{No solution.} &\text{If $b=0$} \\
   b < a < -b & \text{If $b < 0$}
\end{cases}$
E. G. $|x + 2| < |x - 4|$
\begin{align}
   x > 4 &\implies-x+4 < x+2 < x-4 \\
         &\implies -2x+4 < 2 < -4 \\
         &\implies \text{No solution.}
\end{align}
\begin{align}
   x > 4 &\implies -x+4 < x+2 < x-4 \\
         &\implies  4 < 2 < 2x-4 \\
         &\implies x < 1
\end{align}
\begin{align}
   x < 4 &\implies x-4 < x+2 < -x+4 \\
         &\implies  -4 < 2 < -2x+4 \\
         &\implies x < 1
\end{align}
Hence $x \in (-\infty, 1)$

Solving $|a| < |b|$