Don't understand the solution of this geometry problem

Question:
In this question, AF cuts the parallelogram ABCD. BE, CF, DG are $\perp$s from the other vertices to AF. LM is also a $\perp$ where L is the intersection of 2 diagonals in the parallelogram. Prove CF = BE - DG.
Now the solution is as follow:
In the trapezoid BEDG, L is the mid-point of BD and LM is $\parallel$ BE and DG. So M is the mid-point of the diagnoal GE.

I don't understand this part.

Since M is the mid-point of the diagonal, LM = $\frac{1}{2}(BE-DG)$.

I also don't understand this part.

I find this difficult to understand in a 3D context. Can someone understand the solution and explain it in another way to me?
Comment: Are the answers sufficient to understand the solution?
Answer: Let $GDPE$ be a parallelogram(rectangle) and $LM\cap DP=\{Q\}$.
Thus, since $L$ is a mid-point of $DB$, we obtain:
$$LM=LQ-QM=\frac{1}{2}PB-DG=\frac{1}{2}(BE+PE)-DG=\frac{1}{2}(BE-DG).$$
Now, use that $CF=2LM.$
Answer: An easy way to understand it. Consider all possible segments that connects the lines $AF$ and $BD$ and that are perpendicular to $AF$. These segments are clearly parallel among them, and the segments $BE$ and $DG$ are two of these. Now focus on the behaviour of these segments moving from $BE$ to $DG$.
Starting from $BE$ and moving towards the left in your figure, the length of these segments decreases, reduces to a single point (the crossing point between $AF$ and $BD$) and then increases, until we arrive to $DG$. This change of dimension occurs progressively in a linear manner. So, the length of the "central" segment (which in this case is $LM$) is necessarily the average between the length of the initial and final segment. To show that $LM$ is the central segment, note that $L$ is the midpoint of $DB$, because it is the intersection point of the diagonals $DB$ and $AC$ of the parallelogram $ABCD$ (this is a well known property of parallelograms: the diagonals intersect each other at the half-way point). As a result, since $DL=LB$, we also have $GM=ME$, as $GM$ and $ME$ are the projections of $DL$ and $LB$ on $AF$. Then, $M$ is the midpoint of $GE$.
In this case, since the length of our segments decreases to zero and then increases, we have to consider the length of the final segment $BD$ as negative (this can be easily understood hypothesizing the case in which the final segment is equal to the initial one: their average would be zero and accordingly the central segment would be reduced to a point). So we have $$LM=(BE-DG)/2$$


Issue installing packages on Solaris

Question: I am trying to setup a utility that requires several packages. However, when I attempt to install the packages, the install fails with the message Unable to parse repository response - what do I need to do to rectify this?
root@SRSS1:~# /opt/SUNWut/sbin/utadm -L on
Error: SUNWdhcsb SUNWdhcs SUNWdhcm packages are not installed.  These are the Binary
        File Format data modules used to store the DHCP data.  These
        packages are required for Sun Ray interface configuration.
root@SRSS1:~# pkg install SUNWdhcsb
pkg: 0/1 catalogs successfully updated:

Unable to contact valid package repository: http://pkg.oracle.com/solaris/release
Encountered the following error(s):
Unable to parse repository response
root@SRSS1:~# uname -a
SunOS SRSS1 5.11 snv_151a i86pc i386 i86pc Solaris

Comment: You should post that as an answer and mark it "accepted".
Comment: PEBCAK - firewall was blocking it.
Answer: This problem was caused by a firewall blocking access to the repository.

Issue installing packages on Solaris


Is it possible to have multiple SQL instructions in a ADO.NET Command.CommandText property?

Question:
Summary

I'm currently writing an application where I have located my SQL instructions into a project's parameters.
Within the code, I get the value of my query which returns the query itself. Let's for instance say that my SQL query is like so:
select col1, col2, col3 from my_table

Besides, col1, col2 and col3 are from different tables and are migrated as foreign key into my_table. So, when it comes to the insert, I have to perform multiple INSERT statements to get the values from the other tables for these above-mentioned columns. Let's say as follows:
BEGIN TRANSACTION

insert into first_table (col_x, col_y) values ('col_x', 'col_y')
insert into second_table (col_z, col_a) values ('col_z', 'col_a')
insert into third_table (col_b, col_c) values ('col_b', 'col_c')

and finally:
insert into my_table (col1, col2, col3, col_v) values (@col1, @col2, @col3, 'col_v')

COMMIT

Take it that these col1, col2, col3 columns are auto-increment integers for tables first, second and third.

Questions

Could I write a complex SQL statement into the IDbCommand.CommandText property while each instruction would be separated by a semicolon (;)?
Is it possible to include a BEGIN TRANSACTION...COMMIT/ROLLBACK into this CommandText property?
In short, could I write something like this?
Using cnx = New SqlConnection(connString)
    Using cmd = cnx.CreateCommand()
        cmd.CommandText = "BEGIN TRANSACTION " _
                  & "insert into first_table (col_x, col_y) values ('col_x', 'col_y');" _
                  & "insert into second_table (col_z, col_a) values ('col_z', 'col_a');" _
                  & "insert into third_table (col_b, col_c) values ('col_b', 'col_c');" _
                  & "insert into my_table (col1, col2, col3, col_v) values (@col1, @col2, @col3, 'col_v'); " _
                  & "COMMIT"
        cmd.ExecuterNonQuery()
    End Using
End Using

EDIT #1

I should have mentioned it before... Mack's answer is the way I would like to go, except that I can't because of strange policies within the IT department of my client, except if I use their custom component which I rather avoid for simplicity sake. Notice that I upvoted Mack's answer anyway since it is a viable solution no matter what.
Thanks in advance for your precious help and time! This is crucial for me!
Answer: If you can't use stored procedures then perhaps this code may meet your requirements:
SqlConnection cnx = new SqlConnection(connString);
SqlCommand cmd = cnx.CreateCommand();
cnx.Open();
string complexCommand = string.Concat(
"DECLARE @first_table AS TABLE(col1 int IDENTITY, col_x varchar(20), col_y varchar(20))"
, " DECLARE @second_table AS TABLE(col2 int IDENTITY, col_z varchar(20), col_a varchar(20))"
, " DECLARE @third_table AS TABLE(col3 int IDENTITY, col_b varchar(20), col_c varchar(20))"
, " DECLARE @my_table AS TABLE(col1 int, col2 int, col3 int, col_v varchar(20))"
, " DECLARE @col1 int"
, " DECLARE @col2 int"
, " DECLARE @col3 int"
, " BEGIN TRAN"
, " BEGIN TRY"
, "   insert into @first_table (col_x, col_y) values ('col_x', 'col_y')"
, "   SET @col1=@@IDENTITY"
, "   insert into @second_table (col_z, col_a) values ('col_z', 'col_a')"
, "   SET @col2=@@IDENTITY"
, "   insert into @third_table (col_b, col_c) values ('col_b', 'col_c')"
, "   SET @col3=@@IDENTITY"
, "   insert into @my_table(col1, col2, col3, col_v) values (@col1, @col2, @col3, 'col_v')"
, "   COMMIT"
, " END TRY"
, " BEGIN CATCH"
, "   ROLLBACK"
, " END CATCH");

cmd.CommandText = complexCommand;
cmd.ExecuteNonReader();

I have added table variables as necessary to get the example code running, obviously you can utilise your permanent tables.
Comment: @WillMarcouiller C# supports multiline string literals.
Answer: Try using transactions...
using (SqlConnection cnx = new SqlConnection(connString))

{
    cnx.Open();

    // Start a local transaction.
    SqlTransaction sqlTran = cnx.BeginTransaction();

    // Enlist a command in the current transaction.
    SqlCommand command = cnx.CreateCommand();
    command.Transaction = sqlTran;

    try
    {
        // Execute two separate commands.
        command.CommandText = "insert into first_table (col_x, col_y) values ('col_x', 'col_y')";
        command.ExecuteNonQuery();
        command.CommandText = "insert into second_table (col_z, col_a) values ('col_z', 'col_a')";
        command.ExecuteNonQuery();
        command.CommandText = "insert into third_table (col_b, col_c) values ('col_b', 'col_c')";
        command.ExecuteNonQuery();
        command.CommandText = "insert into my_table (col1, col2, col3, col_v) values (@col1, @col2, @col3, 'col_v')";
        command.ExecuteNonQuery();

        // Commit the transaction.
        sqlTran.Commit();
    }
    catch (Exception ex)
    {
        // Handle the exception if the transaction fails to commit.
        // do something with this (ex.Message);
        try
        {
            // Attempt to roll back the transaction.
            sqlTran.Rollback();
        }
        catch (Exception exRollback)
        {
            // Throws an InvalidOperationException if the cnx
            // is closed or the transaction has already been rolled
            // back on the server.
            // do something with this (exRollback.Message);
        }
    }
}

Comment: +1 Your approach is definitely THE way to go, according to me. Unfortunately, I am unallowed to use transactions within the code itself except by using custom components which I shall avoid for simplicity sake. I should perhaps have mentioned it before, sorry. And thanks for your time answering the question. =)
Comment: Sadly, I can't. It is somehow not within the "legal" practices, according to the architects team. As I am a simple consultant for the customer, no exception rules are allowed.
Comment: I _can_ use transactions in my C# code, so this solution was the solution for me.


What is the lifetime of an attachment sent to a Discord bot with a slash command, and where is this documented?

Question: I have a slash command for my bot that allows users to attach an image. My bot stores the attachment URL for later use. How long does this URL remain valid? Where is this documented?
Answer: From the official Discord Developer server: https://discord.com/channels/613425648685547541/1079307503403290685
"...attachments last for 2 weeks but that might change in the future so it is intentionally undocumented..."


problemas em usar o FrameWorks Laravel

Question: Estou seguindo uma vídeo aula para entender como se comporta o vue, porém essa vídeo aula é em cima de um projeto PHP, eu entendo pouco de PHP.
Fiz como forme no vídeo abaixo;
1 - CRUD en LARAVEL & VUEjs - Webpack, Laravel Mix, NPM, Axios | Rimorsoft Online
Porém quando mando subir a aplicação para o servidor digitando o comando npm run dev eu não consigo encontrar a URL para visualizar a pagina;
Eu tentei essas opções:

localhost/laravel-vue-crud/public/
localhost/laravel-vue-crud/
localhost:8080

Alguém poderia dá uma olhada no vídeo porque pode ser que eu esteja digitando a URL errada.
Answer: Pelo que verifiquei, o problema que está ocorrendo é sobre qual URL acessar ao subir o servidor, correto? Se for isto, verifique se você possui o .env criado na raiz de sua aplicação.
Basicamente, o .env é um arquivo de configuração de todas as variáveis de ambiente do Laravel. Note que se estiver utilizando Linux, todos os arquivos que iniciam com "." são ocultos. Uma outra informação é que este arquivo não é versionado, logo ele pode ser copiado do arquivo .env.example que geralmente é acompanhado nos repositórios em geral.
Você pode verificar na linha APP_URL, ou alterá-la para a porta que deseja, exemplo: APP_URL=http://localhost:8080/

problemas em usar o FrameWorks Laravel


Is there a difference between ++i and i++ in this loop?

Question: The array.prototype.reduce function at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
It has the following loop:
for (index = 0; length > index; ++index) {
    if (this.hasOwnProperty(index)) {
      if (isValueSet) {
         value = callback(value, this[index], index, this);
      } else {
        value = this[index];
        isValueSet = true;
      }
    }
}

I don't think there is a difference whether the index is pre or post incremented here since it's done after the loop iterates each time, but want to be certain.
Can this be changed to index += 1 so it passes jslint? Please don't debate the merits of jslint's warning.
Would this change make any difference?
Comment: Another piece of code saved by JSLint... Ugh.
Comment: Well, `/*jslint plusplus: true */` and you can be unsaved. ;^)
Answer: The only difference between i++, ++i, and i += 1 is the value that's returned from the expression. Consider the following:
// Case 1:
var i = 0, r = i++;
console.log(i, r); // 1, 0

// Case 2:
var i = 0, r = ++i;
console.log(i, r); // 1, 1

// Case 3:
var i = 0, r = (i += 1);
console.log(i, r); // 1, 1

In these cases, i remains the same after the increment, but r is different, i += 1 just being a slightly more verbose form of ++i.
In your code, you're not using the return value at all, so no, there is no difference. Personally, I prefer to use i++ unless there is a specific need to use one of the other forms.
Comment: Additionally, some background-information, why there's people who use `++index` to increment a variable: There might be a performance difference between `index++` and `++index` in *compiled* languages as the compiler can transform the latter to fewer machine instructions. However in Javascript this is no such difference (and modern compilers should be able to detect if you're not accessing the variable and optimize it anyway).
Comment: Thank you, p.s.w.g.  You answered another one of my questions very clearly previously.  I appreciate your help very much.  As I get more skilled I hope to help others one day soon like you've helped me.
Comment: He/She answered it from my perspective.  No difference in outcome.  The loop and function will do exactly the same thing with my change.  I did find this immaterial performance difference though http://jsperf.com/i-vs-i/2 in another post but it makes no difference to the outcome.
Comment: @p.s.w.g—cool. I have no idea why Crockford prefers `i+=1` to `i++` but I guess I can't start that discussion here… :-)


Comando SQL PARTITION BY?

Question: Estou lendo e não ficou muito claro o comando PARTITION BY na criação de tabelas no bancos de dados estruturados (SQL), um exemplo básico:
CREATE TABLE employees  (
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(25) NOT NULL
)
PARTITION BY RANGE(id)  (
    PARTITION p0 VALUES LESS THAN (5),
    PARTITION p1 VALUES LESS THAN (10),
    PARTITION p2 VALUES LESS THAN (15),
    PARTITION p3 VALUES LESS THAN MAXVALUE
);

Pergunto:

Para que server de uma maneira geral o comando PARTITION BY?
Quais a vantagens e desvantagens desse comando?
Comment: Tem algum problema a pergunta, ela não faz sentido, o que posso fazer para melhorar, já faz algum tempo que ando sendo perseguido e tomando votos negativos todos os dias.
Answer: Basicamente o PARTITION BY cria uma tabela com uma ou mais partições; em outras palavras, são criadas tabelas físicas que serão acessadas através da tabela especificada.
Exemplificando, ao criar a tabela imovel e definir que ela deve ser particionada pela quantidade de quartos pares e ímpares, seriam criados no BD duas tabelas, "imovelQuartosPares" e "imovelQuartosImpares", que seriam acessíveis através do select * from tabelas.
Esse particionamento pode ser controlado de várias formas, serão mostrados apenas dois para ajudar no entendimento, mas uma lista com as possibilidades e explicações pode ser encontrada neste link:
PARTITION BY LIST
Pode ser usado quando a partição precisar ser feita baseada em valores definidos, por exemplo particionar a tabela usuarios pelo sexo:
CREATE TABLE usuarios
( id NUMBER, nome VARCHAR2(50), idade NUMBER, sexo VARCHAR2(1))
PARTITION BY LIST (sexo) (
    PARTITION masculino VALUES ('M'),
    PARTITION feminino VALUES ('F')
);

PARTITION BY RANGE
Usado quando a partição precisar ser feita com base em intervalos, como por exemplo faixa etária:
CREATE TABLE usuarios
( id NUMBER, nome VARCHAR2(50), idade NUMBER, sexo VARCHAR2(1))
PARTITION BY RANGE (idade) (
    PARTITION crianca VALUES LESS THAN (18),
    PARTITION adulto VALUES LESS THAN (65),
    PARTITION idoso VALUES LESS THAN MAXVALUE
);

Entendendo o exemplo da pergunta:
CREATE TABLE employees  (
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(25) NOT NULL
)
PARTITION BY RANGE(id)  (
    PARTITION p0 VALUES LESS THAN (5),
    PARTITION p1 VALUES LESS THAN (10),
    PARTITION p2 VALUES LESS THAN (15),
    PARTITION p3 VALUES LESS THAN MAXVALUE
);

Criada a tabela employees particionada em quatro outras tabelas:

p0 - registros com id menor que 5;
p1 - registros com id maior ou igual a 5 e menor que 10;
p1 - registros com id maior ou igual a 10 e menor que 15;
p3 - registros com id maior ou igual a 15.
Comment: _"seriam acessíveis através do `select * from tabelas`"_ - beleza, isso é responsabilidade do sgbd. No caso, a consulta seria escrita como você fez (`select * from tabela where code > 30`) sem precisar informar em qual partição pesquisar.
Comment: Gostei da sua resposta, como seria a parte do SQL? ficaria a cargo do próprio banco pegar os dados das outras tabelas criadas?
Comment: como assim "a parte do SQL"? É preciso definir como será feita essa _divisão_, não ficará a cargo do sgbd (se é que entendi correto).
Comment: Talvez tenha expressando mau, exemplo `select * from tabela where code > 30` vamos dizer que o dado esteja nas tabelas auxiliares... ? tipo não preciso fazer nada o banco se encarregada de buscas as informações nos tabelas auxiliares?
Answer: Particionar uma tabela significa dividir uma tabela, que é logicamente grande, em várias tabelas fisicamente pequenas com o objetivo de melhorar o desempenho das aplicações que utilizam o banco de dados.
Por exemplo você pode particionar uma tabela de vendas em diversas tabelas cada uma referente a um ano-mês da venda, logicamente você tem todas as vendas mas fisicamente os acessos a cada ano-mês das vendas serão otimizados.

Comando SQL PARTITION BY?


What is the best way to handle train set having one more row than test set?

Question: I have train and test data sets of the Ames, Iowa housing prices data set.
The source data has been split approximately 50/50.
My train set has 1460 observations and the test set has 1459.
I've found that when predicting on the test set, R complains when the train and test sets do not have the same number of observations.
I am a beginner, so I'm unsure whether to impute one row in the test set or to delete, perhaps, a random row from the train set.
So should I delete a random row from the train set or impute one row in the test set?
Or is there a better solution altogether that I don't know of?
Comment: Thank you for the responses. I don't have enough reputation to upvote yet.

In fact, I posted this question because I had been getting a warning "'newdata' had 1459 rows but variables found have 1460 rows".

I realize now that this warning was due to other reasons.
Answer: There is no need for a training set and test set to have the same number of observations. (In fact, often, the test set is much smaller than the training set.) Perhaps you've made a programming mistake.
Answer: In real world it is almost never happen for the size of training set is equal to the size of testing set. Usually training set is much bigger than testing / production use.
Think about you want to build a handwriting digit recognition system, where your training set can be million samples of historical database. But testing / production can be only 5 digits zip code in one letter.
The reason you got the error is because you are using R incorrectly.
Here is an example that works well with different training (size 30) and testing set (size 2).
<code>> d_train=mtcars[1:30,]

> d_test=mtcars[31:32,]

> fit=lm(mpg~wt,d_train)

> predict(fit,d_test)
Maserati Bora    Volvo 142E
     18.35444      22.55856
</code>


debian 9 + odbc + mariadb : [01000] Can't open lib , file not found

Question: I install that:
sudo apt-get install unixodbc unixodbc-dev

I download mariadb-connector-odbc-3.0.2-ga-debian-x86_64.tar.gz from here https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.0.2/ and copy libmaodbc.so from archive to /usr/lib/x86_64-linux-gnu/odbc/
Next I configure odbcinst.ini:
[MariaDB]
Description=MariaDB
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
FileUsage=1

and next odbc.ini:
[ast-con]
Description           = MariaDB connection to 'asterisk' database
Driver                = MariaODBC
Database              = AsteriskDB
Server                = localhost
UserName              = zk
Password              = rt131cvn
Port                  = 3306
Socket                = /var/run/mysqld/mysqld.sock

Command:
root@asterisk:/etc# odbcinst -q -d
[MariaODBC]

Next I try to check odbc with isql:
root@asterisk:/etc# isql -v ast-con
[01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so   # latest stable from https://downloads.mariadb.org/connector-odbc/+releases/' : file not found
[ISQL]ERROR: Could not SQLConnect

I try search google, and find 1 solution, but it doesn't help:
I set LD_LIBRARY_PATH
root@asterisk:/etc# env
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/odbc
SSH_CONNECTION=xx.xxx.xxx.xxx 64759 xx.xxx.xxx.xx 22
OLDPWD=/root
XDG_SESSION_ID=26153
USER=root
PWD=/etc
HOME=/root
SSH_CLIENT=xx.xxx.xxx.xxx 64759 22
SSH_TTY=/dev/pts/0
MAIL=/var/mail/root
TERM=xterm
SHELL=/bin/bash
SHLVL=1
LOGNAME=root
XDG_RUNTIME_DIR=/run/user/0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env

Next command:
root@asterisk:/etc# ldd /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
        linux-vdso.so.1 (0x00007fffad26f000)
        libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007f5ad171d000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5ad1419000)
        libssl.so.1.0.0 => not found
        libcrypto.so.1.0.0 => not found
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5ad107a000)
        libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f5ad0e6e000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5ad0c51000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5ad1be9000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5ad0a4d000)

Usually there is libodbcinst.so.1 => not found and then
exec something like this:
ln -s libodbcinst.so.1 libodbcinst.so.2.0.0
but my result is different, and I can not to understand what should I do ? Help please!
Comment: Are you following the same instructions? I'm running into the same issue right now with this https://www.powerpbx.org/content/asterisk-freepbx-install-guide-debian-v9-asterisk-v14-freepbx-v14-v1
Comment: Yes, the same instructions, and the same result.
Answer: This is very annoying and I've narrowed it down to a few things:

If you follow the instructions, Debian will be installing libssl-dev for you, however libmaodbc.so is linked to libssl.so.1.0.0 and libcrypto.so.1.0.0 -- therefore it will encounter ENOENT (No such file or directory) when trying to find these two .so, hence throwing out "file not found" error (doing an strace on the command will provide you with details that it has found the libmaodbc.so file, but not the two other files)
Even if you do manage to get libssl1.0-dev it will remove other packages that are required for FreePBX/Asterisk.
Even then, it will still fail on libc.mo searching for locales en_US

The solution to this is to find another libmaodbc.so that is linked properly against libssl1.1
Comment: Yes, with `ldd libmaodbc.so` you can check the dependencies. So in my case, `ldd` reports `libssl.so.1.0.0 => not found` because I have a newer version installed.
Answer: i have same problem, try older driver version eg /mariadb-connector-odbc-2.0.15-ga-debian-x86_64 work for me!
Answer: Just load the lib fron debian site and isntall it manually!
Comment: Which one was it?
Comment: I kinda just came to the conclusion debian 9 wasn't officially recognized as something to throw freepbx on by freepbx themselves and got it running on centos 7 instead considering I don't have to mess too much up in the base system to get it running
Comment: think I tried something like the package mariadb-plugin-connect
Comment: Using the v2 connector instead of v3 solved it for me.


Laravel form button outside of form model

Question: I have following form built on laravel 5.1:
     {!! Form::model($user,['method'=>'PATCH', 'action' => ['ProfileController@update',$user->id]]) !!}

               First name
                {!! Form::text('first_name',null,[

                    'id' => 'user_first_name'

                ]) !!}

                Last name
                {!! Form::text('last_name',null,[

                    'id' => 'user_last_name'

                ]) !!}

                Email address

                    {!! Form::text('email',null,[

                    'id' => 'user_last_name'

                    ]) !!}

                Phone (optional)
                {!! Form::text('phone',null,[

                   'id' => 'user_phone'

                   ]) !!}

                Personal website address (optional)
                {!! Form::text('url','http://',[

                   'id' => 'user_url'

                   ]) !!}

                        Bio (optional)
                        {!! Form::textarea('bio',null,[

                         'id' => 'user_bio'

                         ]) !!}

                        <input name="user[receive_announcements]" type="hidden" value="0"><input type="checkbox" value="1" checked="checked" name="user[receive_announcements]" id="user_receive_announcements">
                        Please keep me up to date about important developments by email.

We periodically send out important news about us to our users via email. We keep the email volume to an absolute minimum.

                                Change password

                                    New password
                                    <input size="30" type="password" name="user[password]" id="user_password">

                                    Confirm new password
                                    <input size="30" type="password" name="user[password_confirmation]" id="user_password_confirmation">

    {!! Form::close() !!}

Now my button is outside of the Form::open and Form::close:
 {!! Form::button('Update', ['class'=>'btn js-btn-primary js-btn-loadable has-loading btn-primary']) !!}

How can I trigger the form to submit data while the button is outside of the Form? As currently whenever I click the button the form is not submitting the data.
Thanks!!
Comment: Why do you want that?
Comment: @aldrin27 due to css styling. I can place the button inside the form, but had to fix my css
Comment: If you place that outside you must use AJAX.
Answer: you can submit the form with javascript using form.submit() method.
Attach click listener on button to submit form.
Form:
{!! Form::model($user,['id'=>'form1', 'method'=>'PATCH', 'action' => ['ProfileController@update',$user->id]]) !!}

Button:
 {!! Form::button('Update', ['class'=>'btn js-btn-primary js-btn-loadable has-loading btn-primary', 'id'=>'form-submit-button']) !!}

jQuery:
$(function(){
  $('#form-submit-button').on('click', function(){
    $('#form1').submit();
  });
})

Plain javascript:
document.addEventListener("DOMContentLoaded ", function(){
    document.getElementById('form-submit-button').addEventListener("DOMContentLoaded ", function(){
      document.getElementById("#form1").submit();
    });
});


Using a 3rd party js file with TypeScript

Question: I am new to typeScript and I want to be able to use a 3rd party library that does not have definition file.  Does typescript allow you to use the external libraries?
The library i am trying to use is filesaver.js  https://github.com/eligrey/FileSaver.js/
Do I need to create a definition file for this library?
I just need someone to point me in the right direction.
thanks so much!
Comment: On [this documentation of typescript](https://typescript.codeplex.com/wikipage?title=Modules%20in%20TypeScript) you can check on the section named "Working with Other JavaScript Libraries" To find the solution you seek. Hope this helps.
Answer:
Does typescript allow you to use the external libraries?

Very easily. You just need to tell typescript about it. lets look at your case.

The library i am trying to use is filesaver.js

Simple just one function saveAs. The simplest declaration:
declare var saveAs:any;

and now the following will compile just fine:
declare var saveAs:any;
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");

To write more advanced declrations take a look at: https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/declaration%20files/Introduction.md
Note
A more exact but possibly overly restrictive sample :
declare function saveAs(data:Blob , filename:string );
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");

Answer: Another way to call external libraries in typescript without compiling error is to use the  window"myglobalfunction" notation.
For example:
jQuery call: window["$"]
fileSaver.js : window["saveAs"](blob, "hello world.txt");

etc...
These calls inside typescript don't generate compilation errors, but they are full functioning ways to call the same standard functions.
Comment: WARNING: This type of notation should never ever be used in TS as any compiler that either does tree shanking or uglify of code will rename and thus change the name of the function causing such code to fail as the string will not be updated to reflect the uglified function name.
Comment: Good point, this code works only on plain code,  not on obfuscated code.
Answer: Out of the pragmatic but perhaps not quite kosher categoy, a less elegant and non-TypeScript approach would be to simply declare but not assign the variable/function you want to use with TypeScript. This does not give you Intellisense, but it does allow you to very quickly use the library without creating any declarations or roll your own d.ts file.
For instance, here's an Angular example to provide OidcTokenManager as a constant on an app.core module:
((): void => {
    angular
        .module('app.core')
        .constant('OidcTokenManager', OidcTokenManager);

})();

This will generate a TS2304 - Cannot find name 'OidcTokenManager' TypeScript error.
However, by simply declaring OidcTokenManager as of type any, TypeScript will let you pass:
((): void => {
    let OidcTokenManager: any;

    angular
        .module('app.core')
        .constant('OidcTokenManager', OidcTokenManager);

})();


Descending trill in Chopin's Military Polonaise?

Question: I looked at the sheet music of the Military Polonaise by Chopin that I have. I saw something which looks more difficult than even the fast speed or the octaves. I saw a descending trill. I have never seen anything like it though I have heard it in Beethoven's 3rd piano concerto(the descending trill).

That last trill(or set of trills) on that page in the D major section is descending. There are a few octave trills before that but I assume I would be doing 1 trill in each hand and in contrary motion(so 1 trill starts on the principal note and the other and octave above starts on the auxiliary note). In my sheet music, that descending set of trills is written as just a single trill symbol over 5 descending notes. I bet I would have to use my 4th and 5th fingers for the beginning of the trill. But I can't trill well with those fingers. I could do a 4 measure long trill with my 2nd and 3rd fingers but my 4th and 5th fingers, I am lucky if I can trill for 1 measure evenly, normally I can only have 1 beat of it be even and my trill slows down as my 4th and 5th fingers get tired.
I have played some difficult Bach pieces that require me to do that 45 fingering for the trill so that I can reach down to about an octave away from the trill with my 1st, 2nd, and 3rd fingers and I still can't do it evenly. I don't know if I should try to learn this piece given that it has that descending trill. And how would I even play such a trill? Starting on the auxiliary note for the first trill and then the principal note for all the trills after that?
Answer: Based on the picture, it looks like you're using the wrong fingering for the descending trills in the last bar. Each trill actually starts with fingers 1, 3, and 2, not your fingers 4 and 5. That should make your life easier (and, IMO, you might be able to get away with mordents instead of full trills there).
Based on the 1-3-2 fingering, I'd suspect that you start with the principal note for all the descending trills, then the upper auxiliary note.
Comment: That fingering 1-3-2 suggests that you only play 3 notes as the trill, mordents as Dekkadeci wrote. There isn't really time for more than that. Open YouTube in your browser and in the search box type "Military Polonaise by Chopin". You will then find several examples of the polonaise. One of them with sheet music displayed. Then find the section in question and you will find that 3 notes on each trill seems to be common.


NoSuchMethodError SpelParserConfiguration

Question: I'm doing migration spring framework.
so, every maven dependency is well in project. but when running server,
java.lang.NoSuchMethodError: org.springframework.expression.spel.SpelParserConfiguration.
<init>(Lorg/springframework/expression/spel/SpelCompilerMode;Ljava/lang/ClassLoader;)V

this error is occur.
I'm crazy about this damn error. how can i remove this evil red?
Here is my project configure:
...
<org.springframework-version>4.1.9.RELEASE</org.springframework-version>
...

        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-xml</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>

In first time, version is 4.3.25.RELEASE  but  nothing going on, so down version but still error occur.
please someone help me.
Comment: Use `mvn depenency:tree` to see what gets pulled in. I suspect that Spring WS is pulling in some newer version somewhere.
Comment: I suspect spring-ws-core:2.3.1.RELEASE is pulling spring 4.0.9 version that is causing the error
Comment: Is it correctly right the version? I mean, ws-core 2.3.1 required 4.0.9 but i use 4.1.9 that more high version. then it is occur error?

Interesting.
Comment: I think it solved, but again, god damn NoSuchMethodError.

Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z

Why this damn red is not going out?
Answer: I had the same problem, it was caused by duplicate dependencies in the pom.xml. I deleted duplicates, left the ones with latest versions and... problem solved!.


Empty set and cardinality

Question: Is it correct to write that the set E = { {{∅}} , {∅}} has cardinality of 2, but the empty set is not an element of the set?
Comment: yes, that would be correct.
Answer: That is correct. $E$ has two elements, and they are $\{\{\emptyset\}\}$ and $\{\emptyset\}$. Neither of those is $\emptyset$, so $\emptyset \notin E$.

Empty set and cardinality


Adding a date as a section header in a tableView

Question: I have a tableView that has data organised by date added, from the latest to the oldest. I want to add a section header that separates/organises each of these cells by date. I have attached a picture of how Fitbit has their section headers. They do their sections in week intervals but I want to show mine separated by days.
This is my code and attempt at it and it doesn't show anything for now though adding a string like "Today" shows that string in the section.
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {

        if let sections = fetchedProgressResultController.sections {

            return sections.count
        }

        return 0

    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        if let numberOfObjects = fetchedProgressResultController.sections?[section].numberOfObjects {

            return numberOfObjects

        }

        return 0

    }

//MARK: Section Headers
    override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {

        if let numberOfObjects = fetchedProgressResultController.sections?[section].indexTitle {

            return numberOfObjects

        }

        return nil

        //return "TODAY"
    }

    override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {

        let header = view as! UITableViewHeaderFooterView
        header.textLabel?.font = UIFont(name: "SFUIText-Semibold", size: 15)
        header.textLabel?.textColor = UIColor(fromHexString: "3A3E44")

    }

Here are the NSFetchRequest functions that show the sorting by date.
//MARK: Progress Model Fetch Function
    func progressReportFetchRequest() -> NSFetchRequest {

        let fetchRequest = NSFetchRequest(entityName: "ProgressModel")
        let sortDescriptor = NSSortDescriptor(key: "exerciseDate", ascending: false) //From latest to Oldest
        fetchRequest.sortDescriptors = [sortDescriptor]
        return fetchRequest

    }

    func getProgressReportFetchedResultsController() -> NSFetchedResultsController {

        let fetchedProgresssResultController = NSFetchedResultsController(fetchRequest: progressReportFetchRequest(), managedObjectContext: managedProgressObjectContext, sectionNameKeyPath: nil, cacheName: nil)

        return  fetchedProgresssResultController

    }

Here is my cellForRowAtIndexPath function showing how the data is pulled
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    //Access the different Elements daysOfWeek Array
    let progressItems = fetchedProgressResultController.objectAtIndexPath(indexPath) as! ProgressModel

    var progressReportCells : ProgressReportTableViewCell! = tableView.dequeueReusableCellWithIdentifier("ProgressReportTableViewCell") as? ProgressReportTableViewCell

    if (progressReportCells == nil) {
        tableView.registerNib(UINib(nibName: "ProgressReportTableViewCell", bundle: nil), forCellReuseIdentifier:"ProgressReportTableViewCell")
        progressReportCells = tableView.dequeueReusableCellWithIdentifier("ProgressReportTableViewCell") as? ProgressReportTableViewCell

    }

    progressReportCells.workoutTitle.text = progressItems.exerciseName

    //Subtitle
    progressReportCells.workoutDetails.text = "\(progressItems.distanceOrReps!) \(unitsDefaults.stringForKey(kCCDistanceKeyMetric)!)   |   \(progressItems.durationOrSets!) min"

    //Image
    progressReportCells.backgroundImage.image = UIImage(data: progressItems.backgroundExerciseImage!, scale: 1.0)
    progressReportCells.backgroundImage.layer.masksToBounds = true
    progressReportCells.backgroundImage.clipsToBounds = true

}

This is how my model is organised
extension ProgressModel {
    ....
    @NSManaged var backgroundExerciseImage: NSData?
    @NSManaged var distanceOrReps: String?
    @NSManaged var exerciseDate: NSDate?
    @NSManaged var exerciseName: String?
    ...
}

Any ideas on how I can do it? Thanks.
Comment: Your code doesn't contain any kind of data division as per date. Organize your data first, then populate into tableview.
Comment: Apologies. I have added the NSFetchRequest that shows how the data pulled from Coredata is sorted by date (NSDate) - which is one of the attributes of the entity.
Comment: Can you share your exerciseDate format?
Comment: @SucharuHasija I have added that. ;)
Answer: You can do like this
 override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {

        if let numberOfObjects = fetchedProgressResultController.sections?[section].indexTitle {

    let df = NSDateFormatter()
    df.dateFormat = "yyyy-MM-DD" // Date format for exerciseDate
   let exerciseDate = df.dateFromString(numberOfObjects)
  let currentDate = NSDate()
let result = NSCalendar.currentCalendar().compareDate(currentDate, toDate: exerciseDate!,
                                                              toUnitGranularity: .Day)
        let TommorrowDate = currentDate.dateByAddingTimeInterval(60 * 60 * 24)
        let result1 = NSCalendar.currentCalendar().compareDate(TommorrowDate, toDate: exerciseDate!,
                                                               toUnitGranularity: .Day)

        if result == NSComparisonResult.OrderedSame
        {

            return "TODAY"

        }
        if result1 == NSComparisonResult.OrderedSame
        {

            return "TOMMORROW"

        }

        let df1 = NSDateFormatter()
        df1.dateFormat = "dd MMMM, yyyy"

            return df1.stringFromDate(exerciseDate!)

        }

        return nil

        //return "TODAY"
    }

Comment: I am trying to figure out the last date (sDate!). I can't follow where it's declared!
Comment: I have updated the code please use this or use exerciseDate instead of sDate


Unable to connect to appcenter server from android device

Question:
We have deployed IBM App Center (from IBM MobileFirst Foundation 8.0) for Android in our Application Center.
Log on the Application Center install site to download IBM App Center.
Downloaded and installed IBM App Center to Mobile device and installed successfully.
When trying to log on to IBM AppCenter (mobile app) on the Mobile device, we get the following error:

Error on mobile device: "connection failed. check your connection details (http status 404)"
  Trace_log: "[1/13/17 13:14:03:673 GST] 00002f71 id= DeviceService 3 create Response: [{"os":"Android","os_description":"Android 5.0"," model":"ALE-L21","nickname":"demo's ALE-L21","link":"http: //httpservername.companyname.com: 8080/applicationcenter/service/device/e6c6f83ef30e5c1d"," user_display":"****","maker":"HUAWEI","device_id":"e6c6f83ef30e5c122"," os_version":"21","created":"2017-01-13T09:14:03.663Z","updated":"2017- 01-13T09:14:03.663Z","family":"","user_id":"***"}]"

Additional info:
Loadbalancer (443) > ibm httpserver (8080) > Liberty (9080) > db2
Comment: Looks like the App center client is trying to hit ""http: //httpservername.companyname.com: 8080". Is that expected?
Comment: Explained here : http://www.ibm.com/support/knowledgecenter/SSHS8R_8.0.0/com.ibm.worklight.installconfig.doc/appcenter/r_ac_appres_endpoint.html
Answer: Ideally 404 comes if the context is not proper. I am not sure if you have changed that. But in this link you can find an explanation how to properly configure the appcenter server definitions.


Pr. 5 of chapter 1 of Walter Rudin.

Question:
Pr 5. Let $A$ be a nonempty set of real no. Which is bdd below. Let $-A$ be set of all no. $-x; x \in A$. Prove $\inf(A)=-\sup(-A)$.

My attempt:
If $x>0, \inf(A) \ge 0$ & by def $\inf(A) \le x$, for all $x\in A$.
Then, $-x < 0$, any $\mathbb R^+$ real no. is an upper bdd of set $-A$. Thus it has a LUB. $\sup(-A) \le 0$ & by def $\sup(-A) \ge -x$, for all $x\in A$. So, $x \ge -\sup(-A)$. Combining above inequality to obtain $-\sup(-A) \le (x\in A) \ge \inf(A)$. Similar argument can be done for $x \le 0$. The equality holds when $x=-\sup(-A)=\inf(A)$.
My question is: What if $\inf(A)$ is not an element of set $A$? Then equality doesn't hold, right? So, $\inf(A) \neq-\sup(-A)$.
This is my first and only solution came to my mind while solving this problem.
There are plenty of correct sol. on internet. Like sol. to selected exercise by sam blinstein(unfortunately now I can't find link to pdf). In that solution it is shown that, it is not possible $\gamma(r) > -\sup(-A) r\ge x, x\in A$. By step-by-step logical argument.
Do I have to do the same thing? If yes, then my sol. is not efficient. I just want to know, why my solution isn't working despite using definition of supremum and infimum.
Comment: Please use MathJax https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference  It's not very hard to learn. Often just surrounding math by dollar signs makes it look better. Type `$x \in A$` to render $x \in A$.
Comment: Okay. I will learn mathjax. I'm using stack exchange on my phone.
Comment: I don't know how often you plan on using your phone to post, but I have my settings with text replacement on my keyboard. When I type "rrn", my phone types `\mathbb{R}^{n}`, and when I type "bmat", my phone types `\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}`, etc.
Comment: I'm not sure why you are breaking up the cases: $x<0$, $x>0$, and $x=0$. I think you should just show that $\forall x \in -A \,, x \le -\operatorname{inf}(A)$, and that if $y < -\operatorname{inf}(A)$, then $\exists x \in -A$ such that $y \inf A$ we know $y$ is *not* a lower bound of $A$ (definition of $\inf A$), we should be able to prove that for all $w < -\inf A$ that $w$ is *not* an upper bound of $-A$.
Comment: Yes inequality hold, but I think equality doesn't.
Answer: Your proof is on the right track, but you don't need to consider separate cases like $x>0$.
Also, notation like $-\sup(-A) \le (x\in A) \ge \inf(A)$ is confusing. I think I know what you are trying to say, but you should not write $a \le b \ge c$.
First, before we go into the details of the proof, lets outline the general steps. Your plan seems to be:

Show that $-A$ has a supremum.
Show that $-\sup(-A)$ is the infimum of $A$.

That's a good plan. Let's break up step 2 into:

show that $-\sup(-A)$ is a lower bound for $A$
show that it is the greatest lower bound of $A$

For step 1, rather than take separate cases, such as $x>0$, just use that we know that $A$ has an infimum (since it is non-empty and bounded below). Then, instead of $x > 0$, we just need $x \ge \inf(A)$. Then we know that $-x \le -\inf(A)$. Hence, $-\inf(A)$ is an upper bound on $-A$. Also, we know that $-A$ is non-empty. Therefore, we know that $-A$ has a supremum. Step 1 complete.
You have step 2a in your proof, but I'll just state it slightly differently:
$\forall x \in A$, we know that $-x \in -A$, so that $-x \le \sup(-A)$, and therefore $x \ge -\sup(-A)$. Hence $-\sup(-A)$ is a lower bound on $A$.
For step 2b, it does not matter if $\inf(A)$ is in $A$ or not. We just need to show that $-\sup(-A)$ is the greatest lower bound on $A$. We show that by showing that if some number is greater, then it is not a lower bound:
Let $y > -\sup(-A)$. Then $-y < \sup(-A)$, which means that $\exists z \in -A$ such that $-y < z$
(since otherwise $-y$ would be an upper bound of $-A$ that was less than $\sup(-A)$)
Then we know that $-z \in A$ and $-z < y$, so that $y$ is not a lower bound on $A$.
Therefore $-\sup(-A)$ is the greatest lower bound on $A$.
Comment: Small correction, last sentence, -sup(-A) is the greatest lower bound.
Comment: Great answer! Combination of where I was getting trapped (kind of wrong) and non-ambiguous proof. If I'm not mistaken nature of proof is similar to step 3(last part) of proof of theorem 1.19 (step 2b). Now, I got two different ways to proof this question(both are fundamentally same). Thank you.
Comment: You're welcome. That's definitely an important correction!  It was hard bouncing back and forth between typing lower bound and upper bound :)

Pr. 5 of chapter 1 of Walter Rudin.


I am trying to factor $(a^2 - 2ab + b^2 + 1)$ into $n$ terms for $a$ and $b$.

Question: Let $z_a$ and $z_b$ be any real or complex-valued number. I am trying to factor the following expression into separate terms for $z_a$ and $z_b$:
$$z_a^2 - 2z_az_b + z_b^2 +1 \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space (1)$$
A concrete example would be the attempt to rewrite this expression into two quadratic polynomials with coefficients that can be real or imaginary. Let $\xi$ be a real valued coefficient of some kind (possibly denoting the branches at intervals of $\frac{2m\pi}{n}:m \in \mathbb{Z}(0,...,n-1)$). I have thought about expressing this as some relation of complex conjugate pairs, IE:
$$z_a^2 - 2z_az_b + z_b^2 + 1  = (z_a \pm e^{\xi i})(z_b \pm e^{\xi i)})$$
To be honest though, I'm very confused about what my options are for factoring $(1)$, and if it is even possible. Any help would be massively appreciated.
EDIT: I tried to follow the comment from @Suzu Hirose and took my quadratic formula coefficients $(a=1),(b=0),(c=0)$ coefficients from $$1(z_a - z_b)^2 + 0(z_a - z_b)^1 + 1(z_a - z_b)^0$$
I then inserted into the formula of
$$ \frac{-0 \pm\sqrt{0^2-4(1)(1)}}{2} = \pm \frac{2i}{2}=\pm{i}$$
I'm not sure how I would proceed from here though.
Comment: $$a^2 - 2ab + b^2 + 1 = (a-b)^2 - i^2 = (a-b+i)(a-b-i) $$
Comment: Quadratic formula.
Comment: I don't want to bump this needlessly, but if you edit, could you please remove the complex-geometry tag? (The two tags "geometry" and "complex-numbers" capture the presumed intent.)
Comment: @Suzu Hirose This is a very noob question but how do I do quadratic formula when I have two leading terms $z_a$ and $z_b$ that are second degree polynomials? How do I choose the $(a,b,c)$-coefficient values from $(1)$?
Answer: Write
$$a^2-2ab+(b^2+1)=0\\
\Delta_a=b^2-b^2-1=-1=i^2\\
a_1=b+i,\quad a_2=b-i$$
Then applying Fundamental theorem of algebra we have,
$$a^2-2ab+(b^2+1)=(a-b-i)(a-b+i).$$

Note: You can also write
$$a^2-2ab+b^2+1=b^2-2ab+(a^2+1)=0.$$


How would I be able to get the full URL from an image field?

Question: In a node template, how would I be able to get the URL from an image field?
Like if it were something like this:

{{ content.field_image.URL }}

Or if there is a similar alternative perhaps?
Answer: Have you seen the answer of this question?
Answer: {{ content.field_image[0]['#item'].target_id }} would return the file entity id.
{{ content.field_image[0]['#item'].getUploadLocation() }} would return the file upload location uri (public://image-1)
It is better to use a preprocess function for this kind of logic and pass the result as a variable.
Comment: How would one do that? I've been trying to accomplish this but I keep getting an undefined variable error.
Answer: Getting the URL in a way that is actually a URL is not so easy and I think can currently only be done in preprocess. You need something like this:
enter code herefile_create_url($variables['node']->field_image->entity->getFileUrl())


Primefaces dialog vs regular page - which better?

Question: A simple task of updating data is usually performed by showing dataTable with rows, allowing to select row we intend to change, and...
and I can use primefaces dialog to display a form populated from dataTable or I can achieve the same by redirecting to standard jsf page with populated inputs, and commandButtons refering to actions in backing bean.
So I can do update (content of table) both ways, through primefaces dialog or standard jsf page. Is your experience suggesting that one way of realization update is better than other? Is it only a question of look and feel? Are there some important advantages or good practice?
Answer:
If the dialog box form is short, i.e. only 3-4 fields are to be
updated and we do not deal with the data immediately, I would prefer
dialog box.
But if it is a large form or some more operations are to be performed even after submitting, I would like to redirect to another page.
Primefaces dialog box will submit the request with the help of ajax and if the method bound is in the same managed bean, then the data of thea bean will be available for any operations.
If you are redirecting to some other page, then you will have to stuff the data in request and again retrieve it back there.

According to me, dialog box will be a nice pick if operations are small and of course for look and feel.
Ohh yes... while dealing with primefaces, make sure everyone is using latest browsers.
Answer: Some point of views about using the dialog:

functional: I would prefer the dialog if it can help to enrich an action on a specific field, which is part of a wider feature, for example an user creation page might use a dialog to load and choose user's city of birth.
look and feel: using dialog might require little extra work to realize a responsive layout
security: using dialog might require some extra work, often you put the dialog in your output page just as an hidden component, and with browser's dev tools someone might be able to make the dialog visible and perform undesired operations.


this/apply/call/bind in JavaScript, invisible parameters

Question: I'm working on a JavaScript problem that involves hiding a parameter to demonstrate how this works.
The problem involves searching for an array, [1,2], in a search space which is a multidimensional array, e.g [[2,3], [3,4]]. However, the search space is passed in as part of this value to the function.
Function definition:
function contains(cell) {}

How do I access the search space passed in as this to the function? The accompanying testcase uses bind() to pass in the search space e.g
contains.bind([[2,3], [3,4]])

Here is the attempt at completing the function:
function contains(cell){
   let found = false;
   [x, y] = cell;

   // How do I access searchSpace passed in through `this`?
   searchSpace.forEach((element) => {
     [j, k] = element;
     // match first occurrence in array
     if (x === j && y === k){
        found = true;
     }
   });
   return found;
}

How do I invoke the function:
// contains(cell)
contains([1,2])

Comment: I think it should be `contains.bind(this, [[2,3], [3,4]])` (if you just want to bind the context to the function, without calling it yet), or `contains.call(this, [[2,3], [3,4]])` if you want to pass the context and call the function immediately. But if you do `contains().bind()` you are _executing_ `contains()`, and then, applying `.bind()` to whatever it returns (`found`, which is a boolean). A boolean has no `.bind()` method.
Comment: I need to substitute the line `searchSpace.forEach(` for `this.forEach(` because after calling bind(), I think `this` should contain the object, `[[2,3], [3,4]]` but in my case, it contains the global window object.
Answer: You should be able to pass that value as a variable to the contains function. this refers to something different in and out of the function (see this question for more context).
The easiest approach would be:
function contains(cell, searchSpace){
   let found = false;
   [x, y] = cell;

   // How do I access searchSpace passed in through `this`?
   searchSpace.forEach((element) => {
     [j, k] = element;
     // match first occurrence in array
     if (x === j && y === k){
        found = true;
     }
   });
   return found;
}

contains([1,2], this.searchSpace);

Comment: Thanks, but that is not what I'm looking for. Doing `this.searchSpace` is not necessary as the function signature already accepts two parameters one being the `searchSpace` in your example. I'd like to access the `searchSpace` without passing it in the function as a parameter, so the function remains to be `function contains(cell){}`
Answer: If you want to bind [[2,3], [3,4]] as this to the contains function it would be contains.bind([[2,3], [3,4]]) and not contains().bind([[2,3], [3,4]]).
And bind does not change the function on which it is called directly so contains.bind([[2,3], [3,4]]) alone and then calling contains won't do anything.
bind returns a new function, and that function then calls contains with the given value as this.

How do I access the search space passed in as this to the function?

By using this in the function.

function contains(cell) {
   console.dir(this)
   console.dir(cell)
}

const containsWithBind = contains.bind([[2,3], [3,4]])

containsWithBind([1,2])

How your code attempt should look like:

function contains(cell){
   let found = false;
   [x, y] = cell;

   // How do I access searchSpace passed in through `this`?
   this.forEach((element) => {
     [j, k] = element;
     // match first occurrence in array
     if (x === j && y === k){
        found = true;
     }
   });
   return found;
}

const containtsWithBind =  contains.bind([[2,3], [3,4]])

// contains(cell)
console.log(containtsWithBind([1,2]))
console.log(containtsWithBind([2,3]))
Comment: @Brayoni `Do you mean the line, searchSpace.forEach( should be substituted for this.forEach(` yes. `Doing that doesn't work. this contains the global window object.` you then didn't follow my instructions (`bind` does not change the function on which it is called, it returns a new function for which the given value is bound as `this`). In addition to the original simplified version, I now added your code with `searchSpace` replaced by `this` into my answer and it works.
Comment: Do you mean the line, `searchSpace.forEach(` should be substituted for `this.forEach(` because after calling `bind()`, `this` now contains the object, `[[2,3], [3,4]]`?

Doing that doesn't work. `this` contains the global window object.


Probability of picking 2 balls with the same colour

Question: A bag contains three red balls, three black balls, and three blue balls. You pick two balls at random (without replacement). Given that you pick two balls with the same colour, what is the probability that they are blue?
I let A be the event 'you pick 2 balls of the same colour' and
I let B be the event 'you pick to blue balls'
To work out P(B|A), first I tried to find the P(A), which I believe is 3/9*1/2 however, I'm unsure what to do after.
Comment: Symmetry is a proof, of course.  The only way to get two of the same color is to get two reds, two blues, or two blacks and it is clear that these are equiprobable.  Otherwise, just compute the probability of getting two reds (or two blues, etc.).
Comment: Well, symmetry makes the answer pretty clear, no?
Comment: @lulu Symmetry makes me believe the answer is 1/3, but I would like to know how to get to that answer
Comment: Note:  to get the probability of drawing two of the same color, note that the first ball can have any color and that, then, there is a $\frac 28=\frac 14$ chance that the second will have the same color.
Answer: $$P(B|A)=\frac{P(B\cap A)}{P(A)}=\frac{\frac{3}{9}\times \frac{2}{8}}{3\times\frac{3}{9}\times\frac{2}{8}}$$
$P(A)$ is the probability of two balls are same color
$P(B)$ is the probability of two balls are blue


Drupal 7 quantity of content type

Question: I have a Drupal 7 website with a content type for each product type. In the past I have incorporated sizes (XS,S,M,L,XL) with term reference into one of the product types (the other are size independent).
I would like to have stock information available now too (without using Drupal Commerce).
I could add an integer field to the content types for this. But the products that are size dependant should have stock info for each size.
One important thing it that it should be easy to manage the content types with their stock information with drupal feeds
Does anyone have an idea for achieving this?
Thank you in advance.
Answer: What about using the Field collection module to make a field collection that contains a size field, and stock levels field. This would be attached to a product, so each product can have multiple sizes, and each size has a stock level.
Comment: I was looking at that module as we speak. Any experience in combination with feeds module? Would it work?
Comment: No, I have no experience of using those 2 modules together myself but see [Field collection feeds](https://drupal.org/project/field_collection_feeds)
Comment: aha there is a plugin to the feeds module for it. I'll have a go at it, will report back with my findings
Comment: This wil work i think. The only drawback is that I need a separate feed for the content type and the stock information

Drupal 7 quantity of content type


not iterable python (different integer values for assigned variable in loop and making them into one)

Question: I was making a betting game and output results in matplotlib. Just couldn't find a solution to my problem. for the x variable - there are multiple funds values in the end of the simple game. I wish to do some calculations on them but they seem to output separately in the console.[100][120][80]
I can't seem to merge them into one as the value of funds is a "seperated" integer in each iteration of the program.
import random
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

def simple_bettor(funds,fraction,wager_count):
    def rollDice():
        roll = random.randint(1,2)
        if roll == 2:
            return True
        elif roll == 1:
            return False
    wX= [0]
    vY= [funds]
    no_of_bets = 1

    while no_of_bets <= wager_count:
        if rollDice() is False:
            funds -= fraction
            wX.append(no_of_bets)
            vY.append(funds)
        else:
            funds += fraction
            wX.append(no_of_bets)
            vY.append(funds)
        no_of_bets += 1
    if funds < 0:
        funds = 0
    # print('Funds:', value)
    plt.plot(wX,vY)
    x =[]
    x.append(funds)
    print(x)

iterations = 0
while iterations < 3:
    simple_bettor(100,10,10)
    iterations += 1

plt.ylabel('Account Value')
plt.xlabel('Number of Bets')
plt.show()

Comment: Welcome to StackOverflow.  You've made a good start by posting complete, verifiable example.  I suspect that your issue doesn't relate specifically to `matplotlib` (which I don't have so I can't run your example).  And it definitely doesn't yet use pandas or numpy.  Please eliminate everything that's not crucial, to create a [Minimal, Complete, Verifiable Example](https://stackoverflow.com/help/mcve).
Comment: Replacing `plt` with `print` calls, I get output, but I can't tell what it is you want the output to be and how it would differ from what I get.  Post the expected output.  I can't figure out what  you mean by "merge".  Do you want the printed values to be in a single list?
Comment: Sorry for that . Will make changes :-)
Answer: It's not entirely clear to me what you're trying to accomplish - does this work for you?
import random
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

def simple_bettor(funds,fraction,wager_count):
    def rollDice():
        roll = random.randint(1,2)
        if roll == 2:
            return True
        elif roll == 1:
            return False
    wX= [0]
    vY= [funds]
    no_of_bets = 1

    while no_of_bets <= wager_count:
        if rollDice() is False:
            funds -= fraction
            wX.append(no_of_bets)
            vY.append(funds)
        else:
            funds += fraction
            wX.append(no_of_bets)
            vY.append(funds)
        no_of_bets += 1
    if funds < 0:
        funds = 0
    # print('Funds:', value)
    plt.plot(wX,vY)
    return funds

iterations = 0
x =[]
while iterations < 3:
    x.append(simple_bettor(100,10,10))
    iterations += 1

print(x)

plt.ylabel('Account Value')
plt.xlabel('Number of Bets')
plt.show()

Comment: Awesome! 1) I added `return funds` to your function, so that its output can be used later; 2) I moved the initialisation (and `appends`) related to the list `x` outside of the function and around the `while` loop.
Comment: that's amazing, so you just return the variable "funds" and created a list x and appended the final values to it. Thank you for the help!
Comment: Happy to help! Remember that you can accept the answer if it solved your problem


Installing Ansible 2.9 on Ubuntu 21.04

Question: Is it possible to install Ansible 2.9 on Ubuntu 21.04 via apt?
Apt on Ubuntu 21.04 installs Ansible 2.10 by default, and playbooks written for Ansible 2.9 do not always work well on Ansible 2.10.
The command
<code>apt install -y ansible=2.9.*
</code>
doesn't work on Ubuntu 21.04, even if I add the ppa:ansible/ansible repository as recommended by the Ansible docs.
Comment: Related, from another SE site: [Getting older packages from ppa](https://askubuntu.com/questions/231074/getting-older-packages-from-ppa)?
Answer: Even though Ansible 2.10 is the release that split modules out as collections, your prior playbooks should still work.
The ansible package bundles the previous modules and plugins. Short names from 2.9 are aliased to the fully qualified collection names.
2.10 Porting Guide contains behavior changes from 2.9 to 2.10. Undocumented behavior changes are bugs, please file an issue in that collection's issue tracker, a link is on that collection's Ansible Galaxy listing.

To stay on 2.9 for a while longer, consider uninstalling the deb packages and installing from pip. Even though I like OS package management for everything, convenient to use pip to install whatever version in my home directory or a virtualenv, and avoid getting clever with apt.
As of July 2021, both Debian packaging of ansible and Ansible's PPA lag behind the official pip package. The latter of which is currently at version 4.2. Choose what package you want, but keep in mind that all third party packages are lagging.
Answer: Yes, it's possible. The package Ansible 2.9 is available for Ubuntu 21.04 Hirsute Hippo.
Comment: The [package](http://launchpadlibrarian.net/516153033/ansible_2.9.16+dfsg-1.1_all.deb) is still available. Try to download and install it manually. I'm also curious why do they supersede it? At the moment Ansible 2.9, 2.10, 2.11 are supported (the latest 3 versions) by upstream. Lack of resources to maintain all versions at devel branch perhaps?
Comment: Ref: https://launchpad.net/ubuntu/hirsute/amd64/ansible . Its status is "superseded". So, we may have to download the `.deb` file manually to install it.
Comment: So only manual installation is possible, there's no possibility to to install Ansible 2.9 via apt in Ubuntu 21.04?
Answer: If you cant install it try sudo apt-get update.
This updates all the repository list.

Installing Ansible 2.9 on Ubuntu 21.04


Android Imageview fill the screen width

Question: Here my layout file:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#000"
tools:context=".CproductDetails" >

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape_bg"
        >

        <ImageView
            android:id="@+id/product_image"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_tweet_placeholder_photo_dark_error"
            android:scaleType="center" />

        <TextView
            android:id="@+id/product_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textIsSelectable="true"
            android:textColor="#95ab56"
            android:textSize="20sp"
            android:layout_marginTop="7dip" />

        <TextView
            android:id="@+id/product_price"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textIsSelectable="true"
            android:textSize="20sp"
            android:textColor="#efeeea" />

        <TextView
            android:id="@+id/product_commerce"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textIsSelectable="true"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/product_city"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textIsSelectable="true"
            android:textSize="15sp"
            android:layout_marginTop="10dip"
            android:layout_marginBottom="10dip" />

        <TextView
            android:id="@+id/product_township"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textIsSelectable="true"
            android:textSize="15sp"
            android:visibility="gone"
            android:layout_marginBottom="10dip"
            android:drawableLeft="@drawable/location_place"
            android:drawablePadding="7dip" />

        <TextView
            android:id="@+id/product_website"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textIsSelectable="true"
            android:autoLink="web"
            android:textSize="15sp"
            android:drawableLeft="@drawable/location_web_site"
            android:drawablePadding="7dip"
            android:visibility="gone" />

         <TextView
            android:id="@+id/product_tel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textIsSelectable="true"
            android:textSize="20sp"
            android:drawableLeft="@drawable/device_access_call"
            android:drawablePadding="7dip"
            android:visibility="gone" />

    </LinearLayout>

The result in a phone:

and the result in a 7in tablet:

I want to make the image fill the screen width also in tablet. Like Twitter app for example:
Comment: Your answer is going to depend on your layout, so why don't you post the entire XML layout file?
Comment: android:layout_height="fill_parent"
Comment: **android:layout_width='fill_parent'** will certainly solve your issue, but i think that will distort or rather stretch your image which will not look good. I think the output you are getting now looks pretty OK to me.
Answer: Sounds to me like you want to use android:scaleType="fitCenter" and android:adjustViewBounds="true" on your ImageView.
Answer: Thank you to all but none of your answers solve my problem. Finally I used Maurycy Wojtowicz's ScaleImageView class.

This view will auto determine the width or height by determining if the height or width is set and scale the other dimension depending on the images dimension
Comment: The class manually adds centerInside or centerCrop scaling to the image. It is a bloated version of many better answers on both this and the 10 duplicates of this question that do not require an extraneous class.
Answer: use android:scaleType="fitXY".

This will scale the image in X and Y independently, so that src matches dst exactly. This
  may change the aspect ratio of the src.
Comment: which is relatively useless for most photos, since aspect ratio is critical
Answer: android:scaleType="fitXY" .Go for it
Comment: fitXY will take the complete x axis and y axis as our described layout height

Android Imageview fill the screen width


Can I find $b$ from $a = b \times c$?

Question: So I just started studying the TNB (or Frenet-Serret) frame, where B = T × N. Then my book also goes on to say that T = N × B and N = B × T. Basically, we can find a new valid cross-product equation by "shifting" the terms over the equality sign. My question is, is this property general for all cross products a = b × c, or just something unique to the TNB frame (or any other set of 3 vectors that meet particular criteria - if so, I'd like to know those criteria)?
P.S. New to this site, so might be disregarding a lot of expected niceties. Thanks in advance for your consideration and time!
Comment: For a fixed $\mathbf a$ and $\mathbf c$, not both zero, $\mathbf a=\mathbf b\times\mathbf c$ is either the equation of a line or, when $\mathbf a\cdot\mathbf c\ne0$, has no solution at all.
Answer: It is very special indeed. This is the situation when you have a (right-handed) orthonormal set of vectors, i.e., three unit vectors that are perpendicular to one another (taken in the "right-handed" order). [Can you prove that this is a necessary condition for it to work?]
With regard to the title of your question (which seems totally different), the answer is no. You can add any multiple of $\mathbf c$ to $\mathbf b$ without changing the cross product.
Comment: Yeah, 5 mins after writing my question, I realised that it's only possible if two of the vectors in question are perpendicular unit vectors (their cross product will also naturally be a unit vecor perpendicular to each of them). So I understand that this is a necessary condition, but is it also sufficient?
Comment: Sufficiency is the easier one. The cross product of two orthogonal unit vectors is a unit vector orthogonal to them both.
Answer: Here's the answer:
$$ v \times w = sp(v) \cdot w $$
with
$$ sp(v) = \begin{bmatrix}
0 & -v_3 & v_2 \\
v_3 & 0 & -v_1 \\
-v_2 & v_1 & 0
\end{bmatrix}
$$
so we have:
$$
a = b \times c = -c \times b = -sp(c) \cdot b
$$
Now we would look for the inverse, but
$$
det(sp(c)) = 0
$$
so no inverse exists

Can I find $b$ from $a = b \times c$?


Can Nifi insert data into uppercase table in postgesql?

Question: I create a dataflow try to insert data into uppercase table in postgesql.
But it does not work.
Appreciate any help on this issue, I am new to Nifi.
nifi dataflow
Here are my setting for QueryDatabaseTable and PutDatabaseRecord.
nifi dataflow querydatabasetable
nifi dataflow putdatabaserecord
The error message show below.
org.apache.nifi.processors.standard.db.TableNotFoundException: Table "ACPMA" not found, ensure the Catalog, Schema, and/or Table Names match those in the database exactly
nifi dataflow table is not exist
Here is a uppercase table ACPMA in postgesql.
nifi dataflow db table is exist
Answer: Try updating the table name to ACPMA (without quotes) in PutDatabaseRecord.
Comment: Thanks for your help, it works after name without quotes!Can find the table in postgesql!


Finding hosting provider, basic criteria?

Question: i am a professional in web software development but know little about hosting.
I selected Bluehost because of good reviews. Every day i experience between 30 min and 2 hour downtime, which is in direct contradiction to all i read about this Hoster. My problem now, how do i find the right hoster.

What are the types of Hosters? In sequence from the simplest to the best ones? Smth. like:

Shared
Virtual Private
Dedicated
etc

Which Hoster would you suggest as the best for each type (from own experience)?
Which hoster can provide least to none down-time of my web pages? Thus far, i found that many hosters "cheat" until you really ask the right questions:

Bluehost said we guarantee up-time but in general, i.e. for nobody, just average uptime. Thats just bad
Another hoster said "we guarantee 99.99 up-time". And as i asked what if they fail me, they said "we give your money back for that month" (which is 5 USD / month :) ). That is equally bad

please help me with my little problem:)
Thank you
Comment: Knowing your budget would be very helpful; you reference $5/month, which isn't going to get you a dedicated server anywhere, for example.
Comment: My budget: 5$ is no reference here. I can allow up to 200 $ / month, i just need to know the right hoster
Comment: @ BMdan. Read you post, it helps me big time. But it still doesn't answer all my questions.
Comment: Nick, thanks for the clarification.  I've edited my answer accordingly.  Please let me know if there's anything I didn't thoroughly answer from your original question.
Comment: @ BMdan. Awesome answer!
Answer: Take a look at this answer and see if it applies to your situation.  If not, good luck finding a $5/month host which doesn't suck.  AFAIK, they don't (and cannot, profitably) exist.
Edit: Okay, time to expand on this again a bit.
First, I'll tackle your third question.  SLAs: they are... interesting.  Here's how it works: no matter what the company says ("100,000%-money-back uptime guarantee!"), every single last one of them will have at least one of these caveats, and most will have both:

Only downtime in the core network (i.e., the enormous big iron at the heart of the network that never goes down, ever) counts.  In most cases, not even upstream connectivity problems count.
Downtime is computed, refunds are issued, but in no case will liability exceed [monthly|weekly|rarely, yearly] hosting cost.  i.e., your, "Here's your five bucks back, sorry about that weeklong downtime," example.

In addition to those, every SLA includes exclusions for scheduled downtime, meaning that, at the end of the day, almost all SLAs are pretty worthless in terms of helping you recover the actual lost business value.  And even if none of this applied, it's still messed up; if your solution is down for one second every fourth second, that's much worse than being down for one solid week; in the latter case, customers see you're having problems, and you lose the ones that were ready to buy during that week, while in the former case, all but the most-determined customers won't even bother to continue their visit after a page or two.
What you're looking for isn't an SLA, it's business-continuity insurance.  The SLA is just a safety net below that.
As to hosting cost, I'm glad to hear you aren't stuck on $5/month hosting.  The question now becomes, what level of effort do you want to expend versus the level of effort you expect from your hoster?  At the high end, firms like mine, BlackMesh, provide unlimited support, 24/7 monitoring, managed backups, architecture consultation, and so forth, all bundled into one flat price up-front.  At the low end, companies like SliceHost give you a (virtual) box and say, "Go," and everything you want to add to that (backups, bandwidth, storage) is a few (dozen) extra bucks.
IMHO, and with the obvious caveat that I work for a managed-hosting company, most people end up spending more of their time doing (bad, or at least suboptimal) sysadmin work than they buy by using cheaper hosting.  The example I like to cite is the hypothetical development shop owner who was going back and forth between using us and a cheaper solution provider that didn't include any support.  In the end, he might save $100/month/box across ten boxes, but now one of his developers is almost a full-time sysadmin, so he has to hire a new developer.  He saved $12,000/year in hosting fees, and now pays an extra $50,000 or $100,000 per year in salary.  And if his sysadmin ever quits (or doesn't know the answer to a specialized question, or is on vacation and unreachable when the server crashes), he's screwed.
Anyway, enough ranting.  Basically, here are your options, in order from simplest to "best".  All numbers approximate and at the bottom end of the scale.

Shared ($5/month)
Cloud ($15/month)
Slice (as distinguished from VPS) ($25/month)
VPS (1:1 mapping between virt and host CPUs) ($100/month)
Dedicated/Colo ($100/month colo, $200/month dedicated)
Managed VPS ($300/month)
Managed Dedicated/Colo ($500/month)
Custom Enterprise Hosting ($100k+/month)

Of these, BlackMesh offers the last three.  Feel free to drop us an email ("sales@...") if you'd like any more information on our offerings.  Otherwise, best of luck, and let us know if you find a winner in the other categories.


How to do whirlpool shot in football (soccer)?

Question: Drama

I was the only guy in the defence line in a free kick when opponent placed his ball. The opponent had massive leg muscles and he was far taller than me. He scored a goal I have never seen in any football game ever, it barely touched the top of my hairs when I tried to hit the ball back with my head. The flight path of the ball was like a whirlpool: it rised just over me, it spinned to the left, it then went down and then again up so that goaltender was totally flabbergasted by the rapid change in the movements of the ball. For me, it looked like a whirlpool shot due to the whirlpool flight path.

I have tried to understand this shot now years later through golf-tennis terminology. The ball changed direction two times so it must have had:

topspin for changing the direction first time from up to bottom and
sidespin from right to left
second turn from left to right: how?!

now I haven't been able to repeat this shot, neither with a golf club nor tennis racket. Even physically it is hard for me comprehend it.

How can you do a whirlpool shot in football?
Comment: I do not follow the description, is it like the diving/dipping shot that has gotten so famous lately? Something like this: https://www.youtube.com/watch?v=h1tw3t78fVE?
Answer: In summary, we have this picture.

This picture shows the ball kicked from the right because the wind is heading towards the left. (Let's ignore for now the possibility of strong tailwinds.) Because the ball is rotating backward from the top, this ball has negative topspin - also defined as backspin.
As for the wind lines...the closer the wind lines are, the lower the fluctuations in speed (and it means that there is low turbulence//wind is heading in one direction); either way, this is unimportant and only mentioned for clarity.
For now, let's understand that a ball kicked in the above manner will have the bottom of the ball going against the wind but the top of the ball will be going in the same direction as the wind (because of the backward rotation!)
This means that the bottom of the ball is encountering air resistance.
The top of the ball will be going in the same direction of the wind. This means that the top of the ball will be facing negative air resistance. This then means that the ball, by nature, will want to move in the same direction!
As shown in the picture, there is higher air pressure at the bottom because of the two different directions of air. At the top, there is lower pressure of air. The ball will once again want to naturally move to lower pressure, just like you would want to move to lower pressure zones because it's naturally easier.
This explains why the ball, when kicked with a backspin, will stay in the air longer. For topspin, there will be lower pressure at the bottom for reasons described above - so the ball will want to move towards the bottom faster, which explains why topspin balls fall quickly:
http://www.youtube.com/watch?v=PJirUc_Dolg
In general, when kicking a ball away from you, if the left side spins toward you it will fall to the left. The worst free kicks possible would be where the ball's left corner spins towards you, because then it heads towards the center of the net, where the goalie is :P
Now that we understand that, in your situation the ball must have been kicked such that, if you were the opponent that kicked the ball, then the ball was initially kicked with the bottom left corner of the ball spinning towards you with low spin speed and switched directions completely such that the ball's upper right corner was then spinning towards you at high speed. This may be due to a strong headwind.
For extra information,

This is called the Magnus effect.
We define drag to be any force acting opposite to the motion of an object. In this case, air resistance means drag.
We go to 32:50 of the following video for a postliminary understanding:
http://www.youtube.com/watch?v=xGMnuqKexG8
Comment: Awesome answer, this has a lot of useful information to help analyse the situation +1. Turbulence phase 35:50 and volleys 1.15:00 are pretty interesting in the last video, thank you for sharing.
Answer: More likely what happened is that the shot had little to no spin on it at all. This is difficult to perfect and hit on target, and the flight mechanics are virtually identical to a knuckleball in baseball. It probably did not actually change spin, but instead jumped about in a way that the kicker could not have even predicted.
Comment: I have actually observed that phenomenon with different balls, thanks for pointing it out +1. The seams are enough to create the effect with no spins in the ball creating very sporadic flight paths. In tennis, I have noticed balls that change the direction after hitting the round -- not understanding how this actually works, the round somehow deflects the spin?


What does $|a| = |b|$ is equal to?

Question: I want to know what does $|a| = |b$| is equal to. I think it's equal to $a = \pm b$. Please tell me if I'm right or if I'm wrong.
Comment: Sorry, if this sounded nitpicking. I also realize that you may have problems expressing yourself in English. But, it is IMNSHO important to learn the difference between "equal to" and "equivalent to". If only all oour freshmen... back in the day my teacher started hammering this down (relatively gently) in junior high. Now, get off my lawn.
Comment: This means either $a=b$ or $a=-b$. The informal notation $a=\pm b$ is not really incorrect, but I don't like it too much (what does $a\pm b\pm c$ mean, for instance?)
Comment: How can an equation be "equal" to something else?
Comment: It is not *equal to* anything really. With some conventions in place it could evaluate to "True" or "False" depending on the values of $a$ and $b$. For example "|2|=|3|" is equal to "False". However, it is *equivalent to* many other propositions in the two variables $a$ and $b$.
Comment: @Jean-ClaudeArbaut As far as I have have been taught $a\pm b\pm c$ means $a+b+c$ or $a-b-c$. $a\pm b\mp c$ means $a+b-c$ or $a-b+c$.
Answer: It is equivalent to:
$a=b$ if both are positive or both are negative, or both are zero, and
$a=-b$ if their signs are different.
It means their magnitudes are the same, but not necessarily their signs.
It's important to note that if you restrict yourself to the positive integers then this means $a=b$ as there is no number $-a$ or $-b$ so $\lvert a\rvert = a $ but in the most common high school setting of all real numbers it is as above.
The statement has a more complex meaning in the complex numbers $x=re^{i\theta}$ in which case $\lvert x\rvert=r$, which is again a measure of magnitude with the measure of positive or negative abstracted away.  But in this case rather than the simple $\pm$ being abstracted away, we are removing a more sophisticated measure of the "positiveness" which is $\theta$; a direction vector whose proximity to $\pi$ or $2\pi$ in a sense measures how positive or negative a number is on a circular scale.
Comment: @RobertFrost That depends on the domain of the function. If it's not $\Bbb R$ but an adequate interval, the function is injective. A function is not just an expression, you have to consider the domain.
Comment: How can an equation "equal" something else?
Comment: @ZacharySelk equations can be equal e.g. $f(2x)=4x\equiv f(x)=2x$ but I get your point; to talk of such it's important we discriminate different types of equality; usually done via use of the word "equivalent".
Comment: I have to prove if the function x=|y|+3 is injective so I did |a|+3=|b|+3 --> |a|=|b|. So at this point I can say it isn't injective because a could also be equal to -b, right?
Comment: @JonD the answer to that question (is the function injective) is always "NO" if you can find two numbers that the function maps to the same result so yes you basically have it.  In the case of your function $y$ and $-y$ map to the same result.
Answer: I think it's better to say that it's equivalent to $$a=b$$ or $$a=-b.$$
Answer: It depends on what you're dealing with. If you're dealing with real numbers, then you're correct: either $a=b$ or $a=-b$ (or both, if $a=b=0$).
If you're dealing with complex numbers, the best you can say is that $a=be^{i\theta}$ for some real $\theta.$
Answer: Consider, $$ a^2=b^2$$ which is the same as $$|a|=|b|$$
(Removing even powers results in modulus).
Now $$a^2= b^2 \iff (-a)^2 = a^2 = b^2 = (-b)^2 $$
And that's why, $$|a|=|b| \iff |a|=±b$$ but $$|a|=-b $$ is not possible as modulus of any thing cannot be negative. So $$|a| = b$$
$$ \iff ±a=b $$
$$ \text{OR} \ \ \ \ \ a=b , a=-b \ \ \ \ \  \square $$
I would like to give $ \text{ONE MORE} $ proof.
We have, $$|a|=|b|$$
So, consider the most simple implication,
$$ |a| = ±b \ \ \ \ \text{AND} \ \ \ \ ±a =|b| $$
See, we've used 'AND' but not 'OR' , which means the intersection of both cases.
Proceeding further,
$$ |a|= b \ \ \ \ \text{AND} \ \ \ \ a =|b| $$
$$ ±a = b \ \ \ \ \text{AND} \ \ \ \ a =±b $$
$$ ( a = b \ OR \ -a = b ) \ \ \ \ \text{AND} \ \ \ \ ( a = b \ OR \ -b ) $$
$$ \text{COMBINING BOTH} \ \ \ \ a=b, a=-b$$

What does $|a| = |b|$ is equal to?


crontab -l not showing previous job

Question: Earlier we scheduled a job in crontab and jobs are running fine.  One of my teammates executed the crontab command; now previously scheduled jobs are not listing when you execute the crontab -l command in an AIX system. How to retrieve the old jobs scheduled in the crontab?
Comment: In general : when you use the crontab command to replace an existing cron schedule, the previous  one is replaced and gone. I'm not very familiar with AIX but in the Unix versions I know best, cron schedules are stored in files (`var/spool/cron` for example) and when included in your backup, you can of course restore them
Answer: Find out the user from which you create the cronjobs.
Login to the same user and then run crontob -l command or you can login as a root and use cronjob -l -u username to check the cronjob of a specific user
Comment: when i execute crontab -l command its not showing previously scheduled jobs
Comment: it will not, read the manual of  [crontab](https://linux.die.net/man/1/crontab) it lists the current active one. thats why you should watch your logs usually ;-)
Comment: how should i retrieve old jobs now
Comment: @RAM grab the file from your backups. It'll be in `/var/spool/cron` or somewhere similar (I don't have an AIX system to check)
Answer: Assuming this is not just confusion over which user's crontab is being listed (as noted in a different answer), I think it may be a case of having accidentally replaced the crontab file.
Regarding the "what to do" part: Probably restore the relevant crontab file from backup, unless it can be trivially recreated.
Regarding the "what happened" part, I am not sure of any AIX specifics, but presumably a new blank(?) crontab file was installed based on the input to that first crontab command. (Although the details of what exactly was done are not clear from the question).
Answer: crontab -l command is user specific. It will show only cron jobs of user, currently you are running command as (user). You can find all your cron files on this path - /var/spool/cron/

crontab -l not showing previous job


Is the semicubical parabola differentiable?

Question: Let $\alpha(t)=(t^2,t^3)$ for $t \in \mathbb{R}$.
The image of the curve looks like the semicubical parabola.
I wanted to know if $\alpha$ is differentiable.
The component functions are both differentiable, with
$\alpha'(t)=(2t,3t^2)$
But looking at its image, it should not be differentiable in $t=0$.
I am a little bit confused, because as far as I know,
if $f :[a,b] \rightarrow \mathbb{R}^n$. Then f is differentiable in $x_0$ if every component function $f_1,...,f_n$ is differentiable in $x_0$.
I did some thinking/calculating and on one hand $\alpha$ should be differnetiable, but on the other hand the curve $\beta(t)=(x,x^{2/3})$ has the same image whilst not being differentiable in $0$.
Is $\alpha$ differentiable in $0$ (and why/why not)?
Are there "representation functions" of a image that are not differentiable and other representations that are?
Edit:
I meant, the graph of the function $\beta(t)=x^{2/3}$ is the same as the image of $\alpha$.
Comment: Looking at a function and looking at its image are two different questions. Are you asking if the image is a differentiable submanifold of the plane?
Comment: They do *NOT* have the same image -- one image is a set of real numbers and one image is a set of points in the plane.  They don't even have the same graph -- one graph lives in $\Bbb{R}^2$ and one graph lives in $\Bbb{R}^3$.
Comment: $\alpha$ is a map to $\Bbb{R}^2$ and $\beta$ is a map to $\Bbb{R}$.  Why should the differentiability of one be tied to the differentiability of the other?
Comment: @EricTowers They have the same image and differentiability ensures some kind of "smoothness". So I thought why should the same "image" habe a differentiable and a not differentiable "representation".
Answer: Differentiability is a property of a function, not a property of a curve. The example you found
$$\alpha(t)=(t^2,t^3),$$
$$\beta(t)=(t,t^{3/2})$$
shows that it is possible for a differentiable function and a non-differentiable  function to trace the same curve (for $t\geq 0$ in this example).
In the comments, you mention that differentiablility ensures some kind of smoothness. This is true, but the object that is smooth is the graph of the function. The non-smooth parametric curve traced by $\alpha(t)$ in $\mathbb R^2$ is not the graph of $\alpha$. The graph of $\alpha$ includes a coordinate for the input $t$ as well. In other words, the graph of $\alpha$ is the curve traced by $(t,t^2,t^3)$ in $\mathbb R^3$, and it is smooth (the cusp at $t=0$ disappears). Furthermore, the graph of $\beta$ is different from the graph of $\alpha$, and it is not smooth.